&GetBudget
&GetBudgetByOrderNumber
+ &GetBudgetByCode
&GetBudgets
&GetBudgetHierarchy
&AddBudget
return $result;
}
+=head2 GetBudgetByCode
+
+ my $budget = &GetBudgetByCode($budget_code);
+
+Retrieve all aqbudgets fields as a hashref for the budget that has
+given budget_code
+
+=cut
+
+sub GetBudgetByCode {
+ my ( $budget_code ) = @_;
+
+ my $dbh = C4::Context->dbh;
+ my $query = qq{
+ SELECT *
+ FROM aqbudgets
+ WHERE budget_code = ?
+ };
+ my $sth = $dbh->prepare( $query );
+ $sth->execute( $budget_code );
+ return $sth->fetchrow_hashref;
+}
+
=head2 GetChildBudgetsSpent
&GetChildBudgetsSpent($budget-id);
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI;
use Carp;
use Number::Format qw(:all);
+use YAML qw/Load/;
use C4::Context;
use C4::Auth;
});
my $cgiparams = $input->Vars;
-my $op = $cgiparams->{'op'};
+my $op = $cgiparams->{'op'} || '';
my $booksellerid = $input->param('booksellerid');
my $bookseller = GetBookSellerFromId($booksellerid);
my $data;
booksellerid => $booksellerid,
booksellername => $bookseller->{name},
);
-my $ordernumber;
if ($cgiparams->{'import_batch_id'} && $op eq ""){
$op = "batch_details";
loop_currencies => \@loop_currency,
);
import_biblios_list($template, $cgiparams->{'import_batch_id'});
- if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber ) {
+ if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
# prepare empty item form
my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
# retrieve the file you want to import
my $import_batch_id = $cgiparams->{'import_batch_id'};
my $biblios = GetImportRecordsRange($import_batch_id);
+ my @import_record_id_selected = $input->param("import_record_id");
+ my @quantities = $input->param('quantity');
+ my @prices = $input->param('price');
+ my @budgets_id = $input->param('budget_id');
+ my @rrp = $input->param('rrp');
+ my @discount = $input->param('discount');
+ my @sort1 = $input->param('sort1');
+ my @sort2 = $input->param('sort2');
+ my $cur = GetCurrency();
for my $biblio (@$biblios){
- # 1st insert the biblio, or find it through matcher
+ # Check if this import_record_id was selected
+ next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected;
my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 );
my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0;
+ my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
+ my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
+ my $c_rrp = shift( @rrp ); # rrp include tax
+ my $c_discount = shift ( @discount);
+ $c_discount = $c_discount / 100 if $c_discount > 100;
+ my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
+ my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
+ # 1st insert the biblio, or find it through matcher
unless ( $biblionumber ) {
# add the biblio
my $bibitemnum;
# remove ISBN -
- my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn', '' );
+ my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn', '' );
if ( $marcrecord->field($isbnfield) ) {
foreach my $field ( $marcrecord->field($isbnfield) ) {
foreach my $subfield ( $field->subfield($isbnsubfield) ) {
}
}
( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' );
- SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
# 2nd add authorities if applicable
if (C4::Context->preference("BiblioAddsAuthorities")){
my $headings_linked =BiblioAutoLink($marcrecord, $cgiparams->{'frameworkcode'});
# get quantity in the MARC record (1 if none)
my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
my %orderinfo = (
- "biblionumber", $biblionumber, "basketno", $cgiparams->{'basketno'},
- "quantity", $quantity, "branchcode", $branch,
- "budget_id", $budget_id, "uncertainprice", 1,
- "sort1", $cgiparams->{'sort1'},"sort2", $cgiparams->{'sort2'},
- "order_internalnote", $cgiparams->{'order_internalnote'}, "budget_id", $cgiparams->{'budget_id'},
- "currency",$cgiparams->{'currency'},
- "order_vendornote" => $cgiparams->{'order_vendornote'},
+ biblionumber => $biblionumber,
+ basketno => $cgiparams->{'basketno'},
+ quantity => $c_quantity,
+ branchcode => $patron->{branchcode},
+ budget_id => $c_budget_id,
+ uncertainprice => 1,
+ sort1 => $c_sort1,
+ sort2 => $c_sort2,
+ order_internalnote => $cgiparams->{'all_order_internalnote'},
+ order_vendornote => $cgiparams->{'all_order_vendornote'},
+ currency => $cgiparams->{'all_currency'},
);
-
- my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
-
+ # get the price if there is one.
+ my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
if ($price){
- eval {
- require C4::Acquisition;
- import C4::Acquisition qw/GetBasket/;
- };
- if ($@){
- croak $@;
- }
- eval {
- require C4::Bookseller;
- import C4::Bookseller qw/GetBookSellerFromId/;
- };
- if ($@){
- croak $@;
- }
- my $basket = GetBasket( $orderinfo{basketno} );
- my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
+ # in France, the cents separator is the , but sometimes, ppl use a .
+ # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
+ $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
+ $price = $num->unformat_number($price);
$orderinfo{gstrate} = $bookseller->{gstrate};
- $orderinfo{rrp} = $price;
- $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $bookseller->{discount} / 100 );
- $orderinfo{listprice} = $orderinfo{rrp};
+ my $c = $c_discount ? $c_discount / 100 : $bookseller->{discount} / 100;
+ if ( $bookseller->{listincgst} ) {
+ if ( $c_discount ) {
+ $orderinfo{ecost} = $price;
+ $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c );
+ } else {
+ $orderinfo{ecost} = $price * ( 1 - $c );
+ $orderinfo{rrp} = $price;
+ }
+ } else {
+ if ( $c_discount ) {
+ $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
+ $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c );
+ } else {
+ $orderinfo{rrp} = $price / ( 1 + $orderinfo{gstrate} );
+ $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
+ }
+ }
+ $orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate};
$orderinfo{unitprice} = $orderinfo{ecost};
- $orderinfo{total} = $orderinfo{ecost};
+ $orderinfo{total} = $orderinfo{ecost} * $c_quantity;
} else {
- $orderinfo{'listprice'} = 0;
+ $orderinfo{listprice} = 0;
}
# remove uncertainprice flag if we have found a price in the MARC record
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
- my $basketno;
- ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
+ my ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
# 4th, add items if applicable
# parse the item sent by the form, and create an item just for the import_record_id we are dealing with
push @{ $item->{indicator} }, $indicator[0];
my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator );
my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
- for (my $qtyloop=1;$qtyloop <=$quantity;$qtyloop++) {
+ for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) {
my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
NewOrderItem( $itemnumber, $ordernumber );
}
- } else {
- SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
}
}
# go to basket page
# build budget list
my $budget_loop = [];
-$budgets = GetBudgetHierarchy;
-foreach my $r ( @{$budgets} ) {
+my $budgets_hierarchy = GetBudgetHierarchy;
+foreach my $r ( @{$budgets_hierarchy} ) {
next unless (CanUserUseBudget($borrower, $r, $userflags));
if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
next;
push @{$budget_loop},
{ b_id => $r->{budget_id},
b_txt => $r->{budget_name},
+ b_sort1_authcat => $r->{'sort1_authcat'},
+ b_sort2_authcat => $r->{'sort2_authcat'},
b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
};
}
$CGIsort1 = GetAuthvalueDropbox( $budget->{'sort1_authcat'}, $data->{'sort1'} );
}
} elsif ( scalar(@$budgets) ) {
- $CGIsort1 = GetAuthvalueDropbox( @$budgets[0]->{'sort1_authcat'}, '' );
+} elsif ( scalar(@$budgets_hierarchy) ) {
+ $CGIsort1 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{'sort1_authcat'}, '' );
}
# if CGIsort is successfully fetched, the use it
# else - failback to plain input-field
if ( defined $budget->{'sort2_authcat'} ) {
$CGIsort2 = GetAuthvalueDropbox( $budget->{'sort2_authcat'}, $data->{'sort2'} );
}
-} elsif ( scalar(@$budgets) ) {
- $CGIsort2 = GetAuthvalueDropbox( @$budgets[0]->{sort2_authcat}, '' );
+} elsif ( scalar(@$budgets_hierarchy) ) {
+ $CGIsort2 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{sort2_authcat}, '' );
}
if ($CGIsort2) {
$template->param( CGIsort2 => $CGIsort2 );
record_sequence => $biblio->{'record_sequence'},
overlay_status => $biblio->{'overlay_status'},
match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0,
- match_citation => $#$match > -1 ? $match->[0]->{'title'} . ' ' . $match->[0]->{'author'} : '',
+ match_citation => $#$match > -1 ? $match->[0]->{'title'} || '' . ' ' . $match->[0]->{'author'} || '': '',
match_score => $#$match > -1 ? $match->[0]->{'score'} : 0,
);
+ my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
+ my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
+ my $infos = get_infos_syspref($marcrecord, ['price', 'quantity', 'budget_code', 'rrp', 'discount', 'sort1', 'sort2']);
+ my $price = $infos->{price};
+ my $quantity = $infos->{quantity};
+ my $budget_code = $infos->{budget_code};
+ my $rrp = $infos->{rrp};
+ my $discount = $infos->{discount};
+ my $sort1 = $infos->{sort1};
+ my $sort2 = $infos->{sort2};
+ my $budget_id;
+ if($budget_code) {
+ my $biblio_budget = GetBudgetByCode($budget_code);
+ if($biblio_budget) {
+ $budget_id = $biblio_budget->{budget_id};
+ }
+ }
+ $cellrecord{price} = $price || '';
+ $cellrecord{quantity} = $quantity || '';
+ $cellrecord{budget_id} = $budget_id || '';
+ $cellrecord{rrp} = $rrp || '';
+ $cellrecord{discount} = $discount || '';
+ $cellrecord{sort1} = $sort1 || '';
+ $cellrecord{sort2} = $sort2 || '';
+
push @list, \%cellrecord;
}
my $num_biblios = $batch->{'num_biblios'};
}
$template->param(available_matchers => \@matchers);
}
+
+sub get_infos_syspref {
+ my ($record, $field_list) = @_;
+ my $syspref = C4::Context->preference('MarcFieldsToOrder');
+ my $yaml = YAML::Load($syspref);
+ my $r;
+ for my $field_name ( @$field_list ) {
+ my @fields = split /\|/, $yaml->{$field_name};
+ for my $field ( @fields ) {
+ my ( $f, $sf ) = split /\$/, $field;
+ next unless $f and $sf;
+ if ( my $v = $record->subfield( $f, $sf ) ) {
+ $r->{$field_name} = $v;
+ }
+ last if $yaml->{$field};
+ }
+ }
+ return $r;
+}
--- /dev/null
+#!/usr/bin/perl
+
+# Copyright 2012 BibLibre
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+=head1 NAME
+
+ajax-getauthvaluedropbox.pl - returns an authorised values dropbox
+
+=head1 DESCRIPTION
+
+this script returns an authorised values dropbox
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item name
+
+The name of the dropbox.
+
+=item category
+
+The category of authorised values.
+
+=item default
+
+Default value for the dropbox.
+
+=back
+
+=cut
+
+use Modern::Perl;
+
+use CGI;
+use C4::Budgets;
+use C4::Charset;
+
+my $input = new CGI;
+my $name = $input->param('name');
+my $category = $input->param('category');
+my $default = $input->param('default');
+$default = C4::Charset::NormalizeString($default);
+
+binmode STDOUT, ':encoding(UTF-8)';
+print $input->header(-type => 'text/plain', -charset => 'UTF-8');
+my $avs = GetAuthvalueDropbox($category, $default);
+my $html = qq|<select id="$name", name="$name">|;
+for my $av ( @$avs ) {
+ if ( $av->{default} ) {
+ $html .= qq|<option value="$av->{value}" selected="selected">$av->{label}</option>|;
+ } else {
+ $html .= qq|<option value="$av->{value}">$av->{label}</option>|;
+ }
+}
+$html .= qq|</select>|;
+
+print $html;
SetVersion($DBversion);
}
+$DBversion = "3.15.00.XXX";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MarcFieldsToOrder','','Set the mapping values for a new order line created from a marcrecord (staged file). In a YAML format.', NULL, 'textarea')");
+ print "Upgrade to $DBversion done (Bug 7180: Added MarcFieldsToOrder syspref)\n";
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 TableExists($table)
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 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';
-
-// FIXME: --------- twice , coz the 2 requests get mixed up otherwise
-
- 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);
-
-}
-*/
-
-
-
-//USED BY NEWORDEREMPTY.PL
-function fetchSortDropbox(f) {
- var budgetId=f.budget_id.value;
-
-for (i=1;i<=2;i++) {
-
- var sort_zone = document.getElementById('sort'+i+'_zone');
- var url = '../acqui/fetch_sort_dropbox.pl?sort='+i+'&budget_id='+budgetId;
-
- var xmlhttp = null;
- xmlhttp = new XMLHttpRequest();
- if ( typeof xmlhttp.overrideMimeType != 'undefined') {
- xmlhttp.overrideMimeType('text/xml');
- }
-
- xmlhttp.open('GET', url, false);
- xmlhttp.send(null);
-
- xmlhttp.onreadystatechange = function() {
- if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
- // stupid JS...
- } else {
- // wait for the call to complete
- }
- };
- // rc = eval ( xmlhttp.responseText );
- var retRootType = xmlhttp.responseXML.firstChild.nodeName;
- var existingInputs = sort_zone.getElementsByTagName('input');
- if (existingInputs.length > 0 && retRootType == 'input') {
- // when sort is already an input, do not override to preseve value
+function getAuthValueDropbox( name, cat, destination, selected ) {
+ if (cat == null || cat == "") {
+ $(destination).replaceWith(' <input type="text" name="' + name + '" />' );
return;
}
- sort_zone.innerHTML = xmlhttp.responseText;
-}
+ $.ajax({
+ url: "/cgi-bin/koha/acqui/ajax-getauthvaluedropbox.pl",
+ data: {
+ name: name,
+ category: cat,
+ default: selected
+ },
+ async: false,
+ success: function(data){
+ if(data === "0"){
+ $(destination).replaceWith(' <input type="text" name="' + name + '" />' );
+ }else{
+ $(destination).replaceWith(data);
+ }
+ }
+ });
}
-
-
-
-
-
-
//USED BY NEWORDEREMPTY.PL
function totalExceedsBudget(budgetId, total) {
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'datatables.inc' %]
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
-<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
<script type="text/JavaScript">
//<![CDATA[
$(document).ready(function() {
- $("#files,#recordst").dataTable($.extend(true, {}, dataTablesDefaults, {
+ $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] },
"aaSorting": []
} ) );
- $("form#Aform").submit(function() {
- var total_errors = CheckMandatorySubfields(this);
- if (total_errors > 0) {
- var alertString = _("Form not submitted because of the following problem(s)");
- alertString += "\n------------------------------------------------------------------------------------\n";
- alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
- alert(alertString);
- return false;
+ $("select[name='budget_id']").change(function(){
+ var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
+ var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
+ var destination_sort1 = $(this).siblings('span.sort1').find('input[name="sort1"]');
+ var sort1 = $(destination_sort1).val();
+ if ( destination_sort1.length < 1 ) {
+ destination_sort1 = $(this).siblings('span.sort1').find('select[name="sort1"]');
}
- return true;
+ var destination_sort2 = $(this).siblings('span.sort2').find('input[name="sort2"]');
+ var sort2 = $(destination_sort2).val();
+ if ( destination_sort2.length < 1 ) {
+ destination_sort2 = $(this).siblings('span.sort2').find('select[name="sort2"]');
+ }
+ getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
+
+ getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
+ } );
+
+ $("select[name='budget_id']").change();
+
+ $("select[name='all_budget_id']").change(function(){
+ var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
+ var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
+ var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
+ if ( destination_sort1.length < 1 ) {
+ destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
+ }
+ var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
+ if ( destination_sort2.length < 1 ) {
+ destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
+ }
+ getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
+ getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
+ $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
+ $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
+ $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
+ $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
+ } );
+
+ $('input:checkbox[name="import_record_id"]').change(function(){
+ if ( $(this).is(':checked') ) {
+ $(this).parent().addClass("selected");
+ $(this).parent().removeClass("unselected");
+ } else {
+ $(this).parent().addClass("unselected");
+ $(this).parent().removeClass("selected");
+ }
+ } );
+
+ $("input:checkbox").attr("checked", false);
+ $("div.biblio.unselected select").attr("disabled", false);
+ $("div.biblio.unselected input").attr("disabled", false);
+
+ $("#checkAll").click(function(){
+ $("#Aform").checkCheckboxes();
+ $("input:checkbox[name='import_record_id']").change();
+ return false;
+ });
+ $("#unCheckAll").click(function(){
+ $("#Aform").unCheckCheckboxes();
+ $("input:checkbox[name='import_record_id']").change();
+ return false;
});
+
});
+
+ function disableUnchecked(form){
+ $("div.biblio.unselected").each(function(){
+ $(this).find('select').attr('disabled', 'disabled');
+ $(this).find('input').attr('disabled', 'disabled');
+ });
+ form.submit();
+ }
//]]>
</script>
</head>
<div id="yui-main">
<div class="yui-b">
[% IF ( batch_details ) %]
- <h1>Add orders from [% comments %]
+ <h1>Add orders from [% comments %]
([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
- </h1>
- <div>
- <form action="[% scriptname %]" method="post" name="import_biblios">
- <table id="recordst">
- <thead>
- <tr>
- <th class="anti-the">Citation</th>
- <th>Match?</th>
- <th>Order</th>
- </tr>
- </thead>
- <tbody>
- [% FOREACH biblio_lis IN biblio_list %]
- <tr>
- <td>
- [% biblio_lis.citation %]
+ </h1>
+ <div>
+ <span class="checkall"><a id="checkAll" href="#">Check All</a></span>
+ <span class="uncheckall"><a id="unCheckAll" href="#">Uncheck All</a></span>
+ <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform" onsubmit="disableUnchecked(this); return false;">
+ <input type="hidden" name="op" value="import_records"/>
+ <input type="hidden" name="basketno" value="[% basketno %]" />
+ <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
+ <input type="hidden" name="import_batch_id" value="[%import_batch_id %]" />
+ <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
+
+ [% FOREACH cur IN loop_currencies %]
+ <input type="hidden" name="[% cur.currency %]" value="[% cur.rate %]" />
+ [% END %]
- </td>
- <td>
+ [% FOREACH biblio IN biblio_list %]
+ <div class="biblio unselected" style="border-radius: 5px 5px; -moz-border-radius: 5px; padding: 5px; margin:5px; border-style : solid; border-color : grey; border-width:1px;">
+ <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id %]" value="[% biblio.import_record_id %]" />
+ <input type="hidden" value="[% biblio.rrp %]" name="rrp" />
+ <label for="record_[% biblio.import_record_id %]"><span class="citation" style="font-weight:bold;">[% biblio.citation %]</span></label>
+ <span class="match" style="display:block;">
[% IF ( biblio_lis.overlay_status == 'no_match' ) %]
No match
[% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
[% ELSE %]
[% biblio_lis.overlay_status %]
[% END %]
- </td>
- <td><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]&booksellerid=[% booksellerid %]&breedingid=[% biblio_lis.import_record_id %]&import_batch_id=[% biblio_lis.import_batch_id %]&biblionumber=[% biblio_lis.match_biblionumber %]">Add order</a></td>
- </tr>
- [% IF ( biblio_lis.match_biblionumber ) %]
- <tr>
- <td class="highlight" colspan="3"> Matches biblio [% biblio_lis.match_biblionumber %] (score = [% biblio_lis.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio_lis.match_biblionumber %]">[% biblio_lis.match_citation %]</a></td>
- </tr>
- [% END %]
- [% END %]
- </tbody>
- </table>
- </form>
- </div>
- [% IF ( pages ) %]
- <div class="pages">
- Page
- [% FOREACH page IN pages %]
- [% IF ( page.current_page ) %]
- <span class="current">[% page.page_number %]</span>
- [% ELSE %]
- <a class="nav" href="[% page.script_name %]?import_batch_id=[% page.import_batch_id %]&offset=[% page.offset %]">[% page.page_number %]</a>
- [% END %]
- [% END %]
- [% END %]
- [% ELSE %]
- <div>
- <h1>Choose the file to add to the basket</h1>
- <table id="files">
- <thead>
- <tr>
- <th>File name</th>
- <th>Comments</th>
- <th>Status</th>
- <th class="title-string">Staged</th>
- <th># Bibs</th>
- <th class="NoSort"> </th>
- </tr>
- </thead>
- <tbody>
- [% FOREACH batch_lis IN batch_list %]
- <tr>
- <td>[% batch_lis.file_name %]</td>
- <td>[% batch_lis.comments %]</td>
- <td>
- [% IF ( batch_lis.import_status == 'cleaned' ) %]
- Cleaned
- [% ELSIF ( batch_lis.import_status == 'imported' ) %]
- Imported
- [% ELSIF ( batch_lis.import_status == 'importing' ) %]
- Importing
- [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
- Reverted
- [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
- Reverting
- [% ELSIF ( batch_lis.import_status == 'staged' ) %]
- Staged
- [% ELSE %]
- [% batch_lis.import_status %]
- [% END %]
- </td>
- <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
- <td>[% batch_lis.num_biblios %]</td>
- <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&basketno=[% basketno %]&booksellerid=[% booksellerid %]">Add orders</a></td>
- </tr>
- [% END %]
- </tbody>
- </table>
- </div>
- [% END %]
- </div>
- [% IF ( import_batch_id ) %]
- <div class="yui-b">
- <h2>Import all</h2>
- <p>Import all the lines in the basket with the following parameters:</p>
- <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
- <input type="hidden" name="op" value="import_records"/>
- <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
- <input type="hidden" name="basketno" value="[% basketno %]" />
- <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
- <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
-
- [% FOREACH loop_currencie IN loop_currencies %]
- <input type="hidden" name="[% loop_currencie.currency %]" value="[% loop_currencie.rate %]" />
- [% END %]
-
- [% IF ( items ) %]
- <fieldset class="rows">
- <legend>Item</legend>
- [% IF ( NoACQframework ) %]
- <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
- [% END %]
-
- [% FOREACH item IN items %]
- <div id="outeritemblock">
- <div id="itemblock">
- <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
- <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
- [% IF (iteminformatio.mandatory) %]
- <label class="required">[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
+ </span>
+ [% IF ( biblio.match_biblionumber ) %]
+ Matches biblio [% biblio.match_biblionumber %] (score = [% biblio.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.match_biblionumber %]">[% biblio.match_citation %]</a>
+ [% END %]
+ <span class="quantity" style="display:block;">
+ Quantity: <input type="text" value="[% biblio.quantity %]" name="quantity" />
+ </span>
+ <span class="price" style="display:block;">
+ Price: <input type="text" value="[% biblio.price %]" name="price" />
+ </span>
+ <span class="discount" style="display:block;">
+ Discount: <input type="text" value="[% biblio.discount %]" name="discount" />
+ </span>
+ <span class="budget" style="display:block;">
+ [% IF ( close ) %]
+ <span class="label">Budget: </span>
+ <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
[% ELSE %]
- <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
+ <label for="budget_id">Budget: </label>
+ <select size="1" name="budget_id">
+ <option value=""></option>
+ [% FOREACH budget IN budget_loop %]
+ [% IF ( budget.b_id == biblio.budget_id ) %]
+ <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]" selected="selected">[% budget.b_txt %]</option>
+ [% ELSE %]
+ <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %]</option>
+ [% END %]
+ [% END %]
+ </select>
[% END %]
- [% iteminformatio.marc_value %]
- <input type="hidden" name="itemid" value="1" />
- <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
- <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
- <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
- <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
- [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
- </div></li>
+ <span class="sort1">
+ <label for="sort1">Planning value1: </label>
+ <input type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
+ </span>
+ <span class="sort2">
+ <label for="sort2">Planning value2: </label>
+ <input type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
+ </span>
+ </span>
+ </div>
[% END %]
- </ol>
- </div><!-- /iteminformation -->
- </div>
+ <div>
+ <h2>Import all</h2>
+ <p>Import all the lines in the basket with the following parameters:</p>
- [% END %] <!-- /items -->
- </fieldset>
- [% END %] <!-- items -->
- <fieldset class="rows">
- <legend>Accounting details</legend>
- <ol>
- <li>
- <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
- <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
- </li>
- <li>
- [% IF ( close ) %]
- <span class="label">Budget: </span>
- <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
- [% ELSE %]
- <li>
- <label for="currency">Currency:</label>
- <select name="currency" id="currency">
- [% FOREACH loop_currencie IN loop_currencies %]
- [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
- </select>
- </li>
- <li>
- <label for="budget_id">Budget: </label>
- <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
- [% FOREACH budget_loo IN budget_loop %]
- [% IF ( budget_loo.b_sel ) %]
- <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
- [% ELSE %]
- <option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
- [% END %]
- [% END %]
- </select>
- </li>
+ [% IF ( items ) %]
+ <fieldset class="rows">
+ <legend>Item</legend>
+ [% IF ( NoACQframework ) %]
+ <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
[% END %]
- </li>
- <li>
- <label for="order_internalnote">Internal note: </label>
- <textarea id="order_internalnote" cols="30" rows="3" name="order_internalnote"></textarea>
- </li>
- <li>
- <label for="order_vendornote">Vendor note: </label>
- <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote"></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>
- <span id="sort1_zone">
- [% IF CGIsort1 %]
- <select id="sort1" size="1" name="sort1">
- [% FOREACH sort_opt IN CGIsort1 %]
- [% IF sort_opt.default %]
- <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
+ [% FOREACH item IN items %]
+ <div id="outeritemblock">
+ <div id="itemblock">
+ <ol>
+ [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
+ <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
+ [% IF (iteminformatio.mandatory) %]
+ <label class="required">[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
+ [% ELSE %]
+ <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
+ [% END %]
+
+ [% iteminformatio.marc_value %]
+ <input type="hidden" name="itemid" value="1" />
+ <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
+ <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
+ <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
+ <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
+ [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
+ </div></li>
+ [% END %]
+ </ol>
+ </div><!-- /iteminformation -->
+ </div>
+ [% END %] <!-- /items -->
+ </fieldset>
+ [% END %] <!-- items -->
+
+ <fieldset class="rows">
+ <legend>Accounting details</legend>
+ <ol>
+ <li>
+ <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
+ <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
+ </li>
+ <li>
+ [% IF ( close ) %]
+ <span class="label">Budget: </span>
+ <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
[% ELSE %]
- <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
+ <li>
+ <label for="all_currency">Currency:</label>
+ <select name="all_currency" id="all_currency">
+ [% FOREACH loop_currencie IN loop_currencies %]
+ [% IF ( loop_currencie.selected ) %]
+ <option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>
+ [% ELSE %]
+ <option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ <li>
+ <label for="all_budget_id">Budget: </label>
+ <select id="all_budget_id" size="1" name="all_budget_id">
+ [% FOREACH budget_loo IN budget_loop %]
+ [% IF ( budget_loo.b_sel ) %]
+ <option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]" selected="selected">[% budget_loo.b_txt %]</option>
+ [% ELSE %]
+ <option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
[% END %]
- [% END %]
- </select>
- [% ELSE %]
- <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
- [% END %]
- </span>
- </li>
- <li>
- <label for="sort2">Planning value2: </label>
- <span id="sort2_zone">
- [% IF CGIsort2 %]
- <select id="sort2" size="1" name="sort1">
- [% FOREACH sort_opt IN CGIsort2 %]
- [% IF sort_opt.default %]
- <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
+ </li>
+ <li>
+ <label for="all_order_internalnote">Internal note: </label>
+ <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
+ </li>
+ <li>
+ <label for="all_order_vendornote">Vendor note: </label>
+ <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></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>
+ [% IF CGIsort1 %]
+ <select id="all_sort1" size="1" name="all_sort1">
+ [% FOREACH sort_opt IN CGIsort1 %]
+ [% IF sort_opt.default %]
+ <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
+ [% ELSE %]
+ <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
+ [% END %]
+ [% END %]
+ </select>
[% ELSE %]
- <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
+ <input type="text" id="all_sort1" size="20" name="all_sort1" value="[% sort1 %]" />
[% END %]
- [% END %]
- </select>
- [% ELSE %]
- <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
- [% END %]
- </span>
- </li>
- <li>
-
- </li>
- </ol>
- </fieldset>
- <fieldset class="action">
- <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
- </fieldset>
- </form>
- </div>
- [% END %]
+ </li>
+ <li>
+ <span id="sort2_zone">
+ <label for="sort2">Planning value2: </label>
+ [% IF CGIsort2 %]
+ <select id="all_sort2" size="1" name="all_sort1">
+ [% FOREACH sort_opt IN CGIsort2 %]
+ [% IF sort_opt.default %]
+ <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
+ [% ELSE %]
+ <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ [% ELSE %]
+ <input type="text" id="all_sort2" size="20" name="all_sort2" value="[% sort2 %]" />
+ [% END %]
+ </span>
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
+ </fieldset>
+
+ </div>
+ </form>
+ [% ELSE %]
+ <div>
+ <h1>Choose the file to add to the basket</h1>
+ <table id="files">
+ <thead>
+ <tr>
+ <th>File name</th>
+ <th>Comments</th>
+ <th>Status</th>
+ <th class="title-string">Staged</th>
+ <th># Bibs</th>
+ <th class="NoSort"> </th>
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH batch_lis IN batch_list %]
+ <tr>
+ <td>[% batch_lis.file_name %]</td>
+ <td>[% batch_lis.comments %]</td>
+ <td>
+ [% IF ( batch_lis.import_status == 'cleaned' ) %]
+ Cleaned
+ [% ELSIF ( batch_lis.import_status == 'imported' ) %]
+ Imported
+ [% ELSIF ( batch_lis.import_status == 'importing' ) %]
+ Importing
+ [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
+ Reverted
+ [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
+ Reverting
+ [% ELSIF ( batch_lis.import_status == 'staged' ) %]
+ Staged
+ [% ELSE %]
+ [% batch_lis.import_status %]
+ [% END %]
+ </td>
+ <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
+ <td>[% batch_lis.num_biblios %]</td>
+ <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&basketno=[% basketno %]&booksellerid=[% booksellerid %]">Add orders</a></td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ </div>
+ [% END %]
+ </div>
</div>
</div>
</div>
-
- Upon receiving items, update their subfields if they were created when placing an order (e.g. o=5|a="foo bar").
- pref: AcqItemSetSubfieldsWhenReceived
+ -
+ - Set the mapping values for a new order line created from a marcrecord (staged file). In a YAML format, so you have to finished with an empty line.
+ - pref: MarcFieldsToOrder
+ type: textarea
Printing:
-