From 67af1025862cb4caf9426f1bb6e236dc2124f1cd 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 --- cataloguing/addbiblio.pl | 34 +++++++++++------- cataloguing/additem.pl | 36 ++++++++++++------- .../prog/en/modules/cataloguing/addbiblio.tt | 4 +-- .../prog/en/modules/cataloguing/additem.tt | 4 ++- .../prog/en/modules/circ/circulation.tt | 6 ++-- 5 files changed, 54 insertions(+), 30 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index caacd9115a..51b3c7a7ec 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'); @@ -725,8 +726,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'; @@ -748,11 +754,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 @@ -865,13 +873,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 1bd19a7f24..a8a8649369 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -314,6 +314,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); @@ -507,13 +513,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; } @@ -815,11 +823,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 7d54142cc9..a5ae0c6cc9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -571,13 +571,13 @@ function Changefwk(FwkList) { - +[%# 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 0222046ae2..3e253445bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -215,10 +215,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 cb5a5488cf..39548f8373 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -391,7 +391,7 @@ function validate1(date) {

[% END %] - + [% IF ( DEBT ) %][% END %] @@ -445,10 +445,10 @@ function validate1(date) { [% 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