Lines 54-61
sub store {
Link Here
|
54 |
)->count() |
54 |
)->count() |
55 |
) |
55 |
) |
56 |
{ |
56 |
{ |
57 |
Koha::Exceptions::Patron::Modification::DuplicateVerificationToken |
57 |
Koha::Exceptions::Patron::Modification::DuplicateVerificationToken->throw( |
58 |
->throw( |
|
|
59 |
"Duplicate verification token " . $self->verification_token ); |
58 |
"Duplicate verification token " . $self->verification_token ); |
60 |
} |
59 |
} |
61 |
} |
60 |
} |
Lines 74-80
sub store {
Link Here
|
74 |
return $self->SUPER::store(); |
73 |
return $self->SUPER::store(); |
75 |
} |
74 |
} |
76 |
|
75 |
|
77 |
|
|
|
78 |
=head2 approve |
76 |
=head2 approve |
79 |
|
77 |
|
80 |
$m->approve(); |
78 |
$m->approve(); |
Lines 106-113
sub approve {
Link Here
|
106 |
|
104 |
|
107 |
# Take care of extended attributes |
105 |
# Take care of extended attributes |
108 |
if ( $self->extended_attributes ) { |
106 |
if ( $self->extended_attributes ) { |
109 |
$extended_attributes |
107 |
$extended_attributes = try { decode_json( $self->extended_attributes ) } |
110 |
= try { decode_json( $self->extended_attributes ) } |
|
|
111 |
catch { |
108 |
catch { |
112 |
Koha::Exceptions::Patron::Modification::InvalidData->throw( |
109 |
Koha::Exceptions::Patron::Modification::InvalidData->throw( |
113 |
'The passed extended_attributes is not valid JSON'); |
110 |
'The passed extended_attributes is not valid JSON'); |
Lines 136-148
sub approve {
Link Here
|
136 |
attribute => $attr->{value} |
133 |
attribute => $attr->{value} |
137 |
} |
134 |
} |
138 |
)->store |
135 |
)->store |
139 |
if $attr->{value}; |
136 |
if $attr->{value} # there's a value |
|
|
137 |
or |
138 |
( defined $attr->{value} # there's a value that is 0, and not |
139 |
&& $attr->{value} ne "" # the empty string which means delete |
140 |
&& $attr->{value} == 0 |
141 |
); |
140 |
} |
142 |
} |
141 |
} |
143 |
} |
142 |
catch { |
144 |
catch { |
143 |
if ( $_->isa('DBIx::Class::Exception') ) { |
145 |
if ( $_->isa('DBIx::Class::Exception') ) { |
144 |
Koha::Exceptions::Patron::Modification->throw( |
146 |
Koha::Exceptions::Patron::Modification->throw( $_->{msg} ); |
145 |
$_->{msg} ); |
|
|
146 |
} |
147 |
} |
147 |
else { |
148 |
else { |
148 |
Koha::Exceptions::Patron::Modification->throw($@); |
149 |
Koha::Exceptions::Patron::Modification->throw($@); |
Lines 154-160
sub approve {
Link Here
|
154 |
return $self->delete(); |
155 |
return $self->delete(); |
155 |
} |
156 |
} |
156 |
|
157 |
|
157 |
|
|
|
158 |
=head3 type |
158 |
=head3 type |
159 |
|
159 |
|
160 |
=cut |
160 |
=cut |
161 |
- |
|
|