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 <nengard@bywatersolutions.com>
Tested following the plan and by fast cataloging a non-duplicate.
All works as expected.
Signed-off-by: koha.aixmarseille <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
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');
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';
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
}
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;
}
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);
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;
}
);
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);
</div><!-- tabs -->
-<!-- Fields for fast add cataloguing -->
+[%# Fields for fast cataloguing %]
<input type="hidden" name="barcode" value="[% barcode %]" />
<input type="hidden" name="branch" value="[% branch %]" />
<input type="hidden" name="circborrowernumber" value="[% circborrowernumber %]" />
<input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
-<!-- /End of fast add fields -->
+[%# End of fields for fast cataloguing %]
</form>
<input type="submit" value="Save changes" onclick="return Check(this.form)" />
[% END %]</fieldset>
- <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
+ [%# Fields for fast cataloguing %]
+ <input type="hidden" name="circborrowernumber" value="[% circborrowernumber %]" />
<input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
<input type="hidden" name="barcode" value="[% barcode %]" />
<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
+ [%# End fields for fast cataloguing %]
</form>
</p>
[% END %]
- <input type="hidden" name="barcode" value="[% barcode %]" />
+ <input type="hidden" name="barcode" value="[% barcode |html %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
<input type="hidden" name="issueconfirmed" value="1" />
[% IF ( DEBT ) %]<input type="hidden" name="debt_confirmed" value="1" />[% END %]
[% END %]
[% IF ( UNKNOWN_BARCODE ) %]
- <li>The barcode was not found [% barcode %]</li>
+ <li>The barcode was not found [% barcode |html %]</li>
[% IF ( fast_cataloging ) %]
[% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
- <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA&barcode=[% barcode %]&borrowernumber=[% borrowernumber %]&branch=[% branch %]&duedatespec=[% duedatespec %]&stickyduedate=[% stickyduedate %]">Fast cataloging</a>
+ <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA&barcode=[% barcode |uri %]&circborrowernumber=[% borrowernumber %]&branch=[% branch %]&duedatespec=[% duedatespec %]&stickyduedate=[% stickyduedate %]">Fast cataloging</a>
[% END %]
[% END %]
[% END %]