View | Details | Raw Unified | Return to bug 41662
Collapse All | Expand All

(-)a/opac/opac-patron-consent.pl (-17 / +19 lines)
Lines 48-71 foreach my $consent_type ( sort keys %$consent_types ) { Link Here
48
    push @consents, $patron->consent($consent_type);
48
    push @consents, $patron->consent($consent_type);
49
}
49
}
50
50
51
# Handle saves here
52
my $needs_redirect;
51
my $needs_redirect;
53
foreach my $consent (@consents) {
54
    my $check = $vars->{ "check_" . $consent->type };
55
    next if !defined($check);    # no choice made
56
    $needs_redirect = 1
57
        if $consent->type eq q/GDPR_PROCESSING/
58
        && !$check
59
        && C4::Context->preference('PrivacyPolicyConsent') eq 'Enforced';
60
    next if $consent->given_on && $check || $consent->refused_on && !$check;
61
52
62
    # No update if no consent change
53
# Handle saves here
63
    $consent->set(
54
if ( $op && $op eq 'cud-save' ) {
64
        {
55
    foreach my $consent (@consents) {
65
            given_on   => $check ? dt_from_string() : undef,
56
        my $check = $vars->{ "check_" . $consent->type };
66
            refused_on => $check ? undef            : dt_from_string(),
57
        next if !defined($check);    # no choice made
67
        }
58
        $needs_redirect = 1
68
    )->store;
59
            if $consent->type eq q/GDPR_PROCESSING/
60
            && !$check
61
            && C4::Context->preference('PrivacyPolicyConsent') eq 'Enforced';
62
        next if $consent->given_on && $check || $consent->refused_on && !$check;
63
64
        # No update if no consent change
65
        $consent->set(
66
            {
67
                given_on   => $check ? dt_from_string() : undef,
68
                refused_on => $check ? undef            : dt_from_string(),
69
            }
70
        )->store;
71
    }
69
}
72
}
70
73
71
# If user refused GDPR consent and we enforce GDPR, logout (when saving)
74
# If user refused GDPR consent and we enforce GDPR, logout (when saving)
72
- 

Return to bug 41662