|
Lines 134-139
sub fetch_values {
Link Here
|
| 134 |
} |
134 |
} |
| 135 |
} |
135 |
} |
| 136 |
|
136 |
|
|
|
137 |
sub delete_values { |
| 138 |
my ($self, $args) = @_; |
| 139 |
|
| 140 |
my $record_id = $args->{record_id}; |
| 141 |
|
| 142 |
my $dbh = C4::Context->dbh; |
| 143 |
|
| 144 |
my @where_strs = ('field_id = ?'); |
| 145 |
my @where_args = ($self->{id}); |
| 146 |
|
| 147 |
if ($record_id) { |
| 148 |
push @where_strs, 'record_id = ?'; |
| 149 |
push @where_args, $record_id; |
| 150 |
} |
| 151 |
|
| 152 |
my $query = q{ |
| 153 |
DELETE FROM additional_field_values |
| 154 |
WHERE |
| 155 |
} . join (' AND ', @where_strs); |
| 156 |
|
| 157 |
$dbh->do($query, undef, @where_args); |
| 158 |
} |
| 159 |
|
| 137 |
sub all { |
160 |
sub all { |
| 138 |
my ( $class, $args ) = @_; |
161 |
my ( $class, $args ) = @_; |
| 139 |
die "BAD CALL: Don't use fetch_all_values as an instance method" |
162 |
die "BAD CALL: Don't use fetch_all_values as an instance method" |
|
Lines 331-336
The record_id argument is optional.
Link Here
|
| 331 |
} |
354 |
} |
| 332 |
} |
355 |
} |
| 333 |
|
356 |
|
|
|
357 |
=head2 delete_values |
| 358 |
|
| 359 |
Delete values from the database for a given record_id. |
| 360 |
The record_id argument is optional. |
| 361 |
|
| 362 |
my $af = Koha::AdditionalField({ id => $id })->fetch; |
| 363 |
$af->delete_values({record_id => $record_id}); |
| 364 |
|
| 334 |
=head2 all |
365 |
=head2 all |
| 335 |
|
366 |
|
| 336 |
Retrieve all additional fields in the database given some parameters. |
367 |
Retrieve all additional fields in the database given some parameters. |