2f2d7b9368
This patch adds: - 1 syspref MarcFieldsToOrder - 1 Ajax script acqui/ajax-getauthvaluedropbox.pl - 1 routine C4::Budgets::GetBudgetByCode Before this patch you were not able to order 1 or all the records from your staged file. You were allowed to specify some information ("Import All" and "Accounting details" areas) for the order. With this patch, the previous behaviour still exists. But now you can *select* which records you want to ordered. For these ones you can specify independently quantity, price, budget, sort1 and sort2. The cherry on the cake is that you can pre-fill these fields with values from the MARC record. Test plan: 1. Fill the new syspref MarcFieldsToOrder with something like: ==BEGIN== price: 947$c quantity: 969$h budget_code: 922$a rrp: 010$d discount: 969$d sort1: 923$a sort2: 924$a ==END== The empty line at the end is mandatory! The budget (corresponding to your budget_code) can be filled with authorized value categories (statistic 1 and 2). The sort1 and sort2 values can be filled with the an authorized value (of the category previously selected) 2. Choose randomly one or more biblio(s) and fill fields with what is relevant. 3. Export the biblio and import it (with the "Stage MARC records for import" tool). 4. Go on a basket and add an order from a staged file. Select your staged file. 5. Well. Now you can see your biblio (or biblios if your had exported more than one). For each one, fields should be pre-filled with the biblio values. The budget should be selected on the budget corresponding to the budget_code (in the field 922$a) and the "planning values" too (with fields 923$a and 924$a). You can modify these values (or not) and choose a default value for budget and planning values (in the "Accounting details" area). 6. Save and check the prices values. Modify the order and check that budget and sort* are good Prices are calculated following some parameters: if there is no price => listprice = 0 else => - the gstrate value for your order is the gstrate value of the bookseller - discount = if filled : the discount value / 100 else: the discount value of the bookseller - if the bookseller includes tax( List item price includes tax: Yes ) if a discount exists: ecost = price rrp = ecost / ( 1 - discount ) else: # a discount does not exist ecost = price * ( 1 - discount ) rrp = price else # the bookseller does not include tax if a discount exists: ecost = price / ( 1 + gstrate ) rrp = ecost / ( 1 - discount ) else: # a discount does not exist rrp = price / ( 1 + gstrate ) ecost = rrp * ( 1 - discount ) - in all cases: listprice = rrp / currency rate unitprice = ecost total = ecost * quantity 7. Retry with different parameters 8. Check the 'Import all' action still works Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
73 lines
1.8 KiB
Perl
Executable file
73 lines
1.8 KiB
Perl
Executable file
#!/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;
|