From fa31fe3c0aa520d2fb8d0264eaa23c13b3c385ab Mon Sep 17 00:00:00 2001
From: Fridolyn SOMERS
Date: Mon, 7 Jan 2013 15:46:26 +0100
Subject: [PATCH] Bug 7253: fast cataloging not always checking out
When using fast cataloguing to create a biblio and item on the fly, workflow looses datas when a duplicate is detected.
This comes from the use of a mix of circborrowernumber and borrowernumber in forms.
This patch corrects by using always circborrowernumber in fast cataloguing workflow.
Also adds html and uri escape for barecode where necessery.
Test plan :
With duplicate :
- Go to a borrower circulation page
- Enter a non existing barcode
- Enter a due date
- Click on "Check Out"
=> a message says the barcode was not found
- Click on "Fast cataloguing"
=> The biblio edition page appears with fast cataloguing framework
- Fill mandatory fields by using an existing ISBN
- Click on "Save"
=> a yes/no message says "Duplicate record suspected"
(Choosing yes will brake fast caloguing workflow, in this case librarian should create an item and checkout again)
- Click on "No"
=> The item edition page appears with barcode already filled
- Fill mandatory datas
- Click on "Add item"
=> Borrower circulation page appears again, check that item has been checked out with the specified due date
You may test without duplicate
Signed-off-by: Nicole C. Engard
Tested following the plan and by fast cataloging a non-duplicate.
All works as expected.
Signed-off-by: koha.aixmarseille
Signed-off-by: Katrin Fischer
Signed-off-by: Jared Camins-Esakov
Conflicts:
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
Signed-off-by: Chris Cormack
---
cataloguing/addbiblio.pl | 34 +++++++++++-------
cataloguing/additem.pl | 36 ++++++++++++-------
.../prog/en/modules/cataloguing/addbiblio.tt | 11 +++---
.../prog/en/modules/cataloguing/additem.tt | 4 ++-
.../prog/en/modules/circ/circulation.tt | 6 ++--
5 files changed, 59 insertions(+), 32 deletions(-)
diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index 3db1a65526..565d43ddd7 100755
--- a/cataloguing/addbiblio.pl
+++ b/cataloguing/addbiblio.pl
@@ -39,6 +39,7 @@ use C4::Charset;
use Date::Calc qw(Today);
use MARC::File::USMARC;
use MARC::File::XML;
+use URI::Escape;
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
MARC::File::XML->default_record_format('UNIMARC');
@@ -730,8 +731,13 @@ my $redirect = $input->param('redirect');
my $dbh = C4::Context->dbh;
my $hostbiblionumber = $input->param('hostbiblionumber');
my $hostitemnumber = $input->param('hostitemnumber');
+# fast cataloguing datas in transit
+my $fa_circborrowernumber = $input->param('circborrowernumber');
+my $fa_barcode = $input->param('barcode');
+my $fa_branch = $input->param('branch');
+my $fa_stickyduedate = $input->param('stickyduedate');
+my $fa_duedatespec = $input->param('duedatespec');
-
my $userflags = 'edit_catalogue';
if ($frameworkcode eq 'FA'){
$userflags = 'fast_cataloging';
@@ -753,11 +759,13 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
if ($frameworkcode eq 'FA'){
# We need to grab and set some variables in the template for use on the additems screen
- $template->{VARS}->{'circborrowernumber'} = $input->param('borrowernumber');
- $template->{VARS}->{'barcode'} = $input->param('barcode');
- $template->{VARS}->{'branch'} = $input->param('branch');
- $template->{VARS}->{'stickyduedate'} = $input->param('stickyduedate');
- $template->{VARS}->{'duedatespec'} = $input->param('duedatespec');
+ $template->param(
+ 'circborrowernumber' => $fa_circborrowernumber,
+ 'barcode' => $fa_barcode,
+ 'branch' => $fa_branch,
+ 'stickyduedate' => $fa_stickyduedate,
+ 'duedatespec' => $fa_duedatespec,
+ );
}
# Getting the list of all frameworks
@@ -870,13 +878,15 @@ if ( $op eq "addbiblio" ) {
}
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view")){
if ($frameworkcode eq 'FA'){
- my $borrowernumber = $input->param('circborrowernumber');
- my $barcode = $input->param('barcode');
- my $branch = $input->param('branch');
- my $stickyduedate = $input->param('stickyduedate');
- my $duedatespec = $input->param('duedatespec');
print $input->redirect(
- "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&borrowernumber=$borrowernumber&branch=$branch&barcode=$barcode&stickyduedate=$stickyduedate&duedatespec=$duedatespec"
+ '/cgi-bin/koha/cataloguing/additem.pl?'
+ .'biblionumber='.$biblionumber
+ .'&frameworkcode='.$frameworkcode
+ .'&circborrowernumber='.$fa_circborrowernumber
+ .'&branch='.$fa_branch
+ .'&barcode='.uri_escape($fa_barcode)
+ .'&stickyduedate='.$fa_stickyduedate
+ .'&duedatespec='.$fa_duedatespec
);
exit;
}
diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index fea1be186f..0a3fd1aa90 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -285,6 +285,12 @@ my $itemnumber = $input->param('itemnumber');
my $op = $input->param('op');
my $hostitemnumber = $input->param('hostitemnumber');
my $marcflavour = C4::Context->preference("marcflavour");
+# fast cataloguing datas
+my $fa_circborrowernumber = $input->param('circborrowernumber');
+my $fa_barcode = $input->param('barcode');
+my $fa_branch = $input->param('branch');
+my $fa_stickyduedate = $input->param('stickyduedate');
+my $fa_duedatespec = $input->param('duedatespec');
my $frameworkcode = &GetFrameworkCode($biblionumber);
@@ -430,13 +436,15 @@ if ($op eq "additem") {
undef($itemrecord);
}
}
- if ($frameworkcode eq 'FA' && $input->param('borrowernumber')){
- my $redirect_string = 'borrowernumber=' . uri_escape($input->param('borrowernumber')) .
- '&barcode=' . uri_escape($input->param('barcode'));
- $redirect_string .= '&duedatespec=' . uri_escape($input->param('duedatespec')) .
- '&stickyduedate=1';
- print $input->redirect("/cgi-bin/koha/circ/circulation.pl?" . $redirect_string);
- exit;
+ if ($frameworkcode eq 'FA' && $fa_circborrowernumber){
+ print $input->redirect(
+ '/cgi-bin/koha/circ/circulation.pl?'
+ .'borrowernumber='.$fa_circborrowernumber
+ .'&barcode='.uri_escape($fa_barcode)
+ .'&duedatespec='.$fa_duedatespec
+ .'&stickyduedate=1'
+ );
+ exit;
}
@@ -731,11 +739,15 @@ $template->param(
);
if ($frameworkcode eq 'FA'){
- $template->{VARS}->{'borrowernumber'}=$input->param('borrowernumber');
- $template->{VARS}->{'barcode'}=$input->param('barcode');
- $template->{VARS}->{'stickyduedate'}=$input->param('stickduedate');
- $template->{VARS}->{'duedatespec'}=$input->param('duedatespec');
-}
+ # fast cataloguing datas
+ $template->param(
+ 'circborrowernumber' => $fa_circborrowernumber,
+ 'barcode' => $fa_barcode,
+ 'branch' => $fa_branch,
+ 'stickyduedate' => $fa_stickyduedate,
+ 'duedatespec' => $fa_duedatespec,
+ );
+}
foreach my $error (@errors) {
$template->param($error => 1);
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
index fcd4b8c0c2..38ba32b74a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
@@ -905,15 +905,18 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
[% END %]
[% END %]
-[% END %]
-
-
+[% END %]
+
+
+
+[%# Fields for fast cataloguing %]
-
+[%# End of fields for fast cataloguing %]
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
index 7b45a9f295..519c9462ba 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
@@ -272,10 +272,12 @@ $(document).ready(function() {
[% END %]
-
+ [%# Fields for fast cataloguing %]
+
+ [%# End fields for fast cataloguing %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index dd89f2eff0..f900074ad5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -306,7 +306,7 @@ function refocus(calendar) {
[% END %]
-
+
[% IF ( DEBT ) %][% END %]
@@ -360,10 +360,10 @@ function refocus(calendar) {
[% END %]
[% IF ( UNKNOWN_BARCODE ) %]
-
The barcode was not found [% barcode %]
+
The barcode was not found [% barcode |html %]
[% IF ( fast_cataloging ) %]
[% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
- Fast cataloging
+ Fast cataloging
[% END %]
[% END %]
[% END %]
--
2.39.5