Lines 44-49
use C4::Members;
Link Here
|
44 |
|
44 |
|
45 |
use MARC::File::XML; |
45 |
use MARC::File::XML; |
46 |
use URI::Escape; |
46 |
use URI::Escape; |
|
|
47 |
use MIME::Base64 qw(decode_base64url encode_base64url); |
47 |
|
48 |
|
48 |
our $dbh = C4::Context->dbh; |
49 |
our $dbh = C4::Context->dbh; |
49 |
|
50 |
|
Lines 467-473
my $cookieitemrecord;
Link Here
|
467 |
if ($prefillitem) { |
468 |
if ($prefillitem) { |
468 |
my $lastitemcookie = $input->cookie('LastCreatedItem'); |
469 |
my $lastitemcookie = $input->cookie('LastCreatedItem'); |
469 |
if ($lastitemcookie) { |
470 |
if ($lastitemcookie) { |
470 |
$lastitemcookie = uri_unescape($lastitemcookie); |
471 |
$lastitemcookie = decode_base64url($lastitemcookie); |
471 |
eval { |
472 |
eval { |
472 |
if ( thaw($lastitemcookie) ) { |
473 |
if ( thaw($lastitemcookie) ) { |
473 |
$cookieitemrecord = thaw($lastitemcookie); |
474 |
$cookieitemrecord = thaw($lastitemcookie); |
Lines 476-482
if ($prefillitem) {
Link Here
|
476 |
}; |
477 |
}; |
477 |
if ($@) { |
478 |
if ($@) { |
478 |
$lastitemcookie = 'undef' unless $lastitemcookie; |
479 |
$lastitemcookie = 'undef' unless $lastitemcookie; |
479 |
warn "Storable::thaw failed to thaw LastCreatedItem-cookie. Cookie value '$lastitemcookie'. Caught error follows: '$@'"; |
480 |
warn "Storable::thaw failed to thaw LastCreatedItem-cookie. Cookie value '".encode_base64url($lastitemcookie)."'. Caught error follows: '$@'"; |
480 |
} |
481 |
} |
481 |
} |
482 |
} |
482 |
} |
483 |
} |
Lines 532-539
if ($op eq "additem") {
Link Here
|
532 |
if ($prefillitem && defined $record) { |
533 |
if ($prefillitem && defined $record) { |
533 |
my $itemcookie = $input->cookie( |
534 |
my $itemcookie = $input->cookie( |
534 |
-name => 'LastCreatedItem', |
535 |
-name => 'LastCreatedItem', |
535 |
# We uri_escape the whole freezed structure so we're sure we won't have any encoding problems |
536 |
# We encode_base64url the whole freezed structure so we're sure we won't have any encoding problems |
536 |
-value => uri_escape_utf8( freeze( $record ) ), |
537 |
-value => encode_base64url( freeze( $record ) ), |
537 |
-HttpOnly => 1, |
538 |
-HttpOnly => 1, |
538 |
-expires => '' |
539 |
-expires => '' |
539 |
); |
540 |
); |
540 |
- |
|
|