|
Lines 1-4
Link Here
|
| 1 |
package Koha::MarcModificationTemplates; |
1 |
package C4::MarcModificationTemplates; |
| 2 |
|
2 |
|
| 3 |
# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com> |
3 |
# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com> |
| 4 |
# |
4 |
# |
|
Lines 58-64
BEGIN {
Link Here
|
| 58 |
|
58 |
|
| 59 |
=head1 NAME |
59 |
=head1 NAME |
| 60 |
|
60 |
|
| 61 |
Koha::MarcModificationTemplates - Module to manage MARC Modification Templates |
61 |
C4::MarcModificationTemplates - Module to manage MARC Modification Templates |
| 62 |
|
62 |
|
| 63 |
=head1 DESCRIPTION |
63 |
=head1 DESCRIPTION |
| 64 |
|
64 |
|
|
Lines 79-86
files telling Koha what fields to insert data into.
Link Here
|
| 79 |
|
79 |
|
| 80 |
sub GetModificationTemplates { |
80 |
sub GetModificationTemplates { |
| 81 |
my ( $template_id ) = @_; |
81 |
my ( $template_id ) = @_; |
| 82 |
C4::Koha::Log("Koha::MarcModificationTemplates::GetModificationTemplates( $template_id )") if DEBUG; |
82 |
C4::Koha::Log("C4::MarcModificationTemplates::GetModificationTemplates( $template_id )") if DEBUG; |
| 83 |
warn("Koha::MarcModificationTemplates::GetModificationTemplates( $template_id )") if DEBUG; |
83 |
warn("C4::MarcModificationTemplates::GetModificationTemplates( $template_id )") if DEBUG; |
| 84 |
|
84 |
|
| 85 |
my $dbh = C4::Context->dbh; |
85 |
my $dbh = C4::Context->dbh; |
| 86 |
my $sth = $dbh->prepare("SELECT * FROM marc_modification_templates"); |
86 |
my $sth = $dbh->prepare("SELECT * FROM marc_modification_templates"); |
|
Lines 187-194
sub GetModificationTemplateAction {
Link Here
|
| 187 |
sub GetModificationTemplateActions { |
187 |
sub GetModificationTemplateActions { |
| 188 |
my ( $template_id ) = @_; |
188 |
my ( $template_id ) = @_; |
| 189 |
|
189 |
|
| 190 |
C4::Koha::Log( "Koha::MarcModificationTemplates::GetModificationTemplateActions( $template_id )" ) if DEBUG; |
190 |
C4::Koha::Log( "C4::MarcModificationTemplates::GetModificationTemplateActions( $template_id )" ) if DEBUG; |
| 191 |
warn( "Koha::MarcModificationTemplates::GetModificationTemplateActions( $template_id )" ) if DEBUG; |
191 |
warn( "C4::MarcModificationTemplates::GetModificationTemplateActions( $template_id )" ) if DEBUG; |
| 192 |
|
192 |
|
| 193 |
my $dbh = C4::Context->dbh; |
193 |
my $dbh = C4::Context->dbh; |
| 194 |
my $sth = $dbh->prepare("SELECT * FROM marc_modification_template_actions WHERE template_id = ? ORDER BY ordering"); |
194 |
my $sth = $dbh->prepare("SELECT * FROM marc_modification_template_actions WHERE template_id = ? ORDER BY ordering"); |
|
Lines 241-251
sub AddModificationTemplateAction {
Link Here
|
| 241 |
$description |
241 |
$description |
| 242 |
) = @_; |
242 |
) = @_; |
| 243 |
|
243 |
|
| 244 |
C4::Koha::Log( "Koha::MarcModificationTemplates::AddModificationTemplateAction( $template_id, $action, |
244 |
C4::Koha::Log( "C4::MarcModificationTemplates::AddModificationTemplateAction( $template_id, $action, |
| 245 |
$field_number, $from_field, $from_subfield, $field_value, $to_field, $to_subfield, |
245 |
$field_number, $from_field, $from_subfield, $field_value, $to_field, $to_subfield, |
| 246 |
$to_regex, $conditional, $conditional_field, $conditional_subfield, $conditional_comparison, |
246 |
$to_regex, $conditional, $conditional_field, $conditional_subfield, $conditional_comparison, |
| 247 |
$conditional_value, $conditional_regex, $description )" ) if DEBUG; |
247 |
$conditional_value, $conditional_regex, $description )" ) if DEBUG; |
| 248 |
warn( "Koha::MarcModificationTemplates::AddModificationTemplateAction( $template_id, $action, |
248 |
warn( "C4::MarcModificationTemplates::AddModificationTemplateAction( $template_id, $action, |
| 249 |
$field_number, $from_field, $from_subfield, $field_value, $to_field, $to_subfield, |
249 |
$field_number, $from_field, $from_subfield, $field_value, $to_field, $to_subfield, |
| 250 |
$to_regex, $conditional, $conditional_field, $conditional_subfield, $conditional_comparison, |
250 |
$to_regex, $conditional, $conditional_field, $conditional_subfield, $conditional_comparison, |
| 251 |
$conditional_value, $conditional_regex, $description )" ) if DEBUG; |
251 |
$conditional_value, $conditional_regex, $description )" ) if DEBUG; |
|
Lines 475-482
sub MoveModificationTemplateAction {
Link Here
|
| 475 |
|
475 |
|
| 476 |
sub ModifyRecordsWithTemplate { |
476 |
sub ModifyRecordsWithTemplate { |
| 477 |
my ( $template_id, $batch ) = @_; |
477 |
my ( $template_id, $batch ) = @_; |
| 478 |
C4::Koha::Log( "Koha::MarcModificationTemplates::ModifyRecordsWithTemplate( $template_id, $batch )" ) if DEBUG; |
478 |
C4::Koha::Log( "C4::MarcModificationTemplates::ModifyRecordsWithTemplate( $template_id, $batch )" ) if DEBUG; |
| 479 |
warn( "Koha::MarcModificationTemplates::ModifyRecordsWithTemplate( $template_id, $batch )" ) if DEBUG; |
479 |
warn( "C4::MarcModificationTemplates::ModifyRecordsWithTemplate( $template_id, $batch )" ) if DEBUG; |
| 480 |
|
480 |
|
| 481 |
while ( my $record = $batch->next() ) { |
481 |
while ( my $record = $batch->next() ) { |
| 482 |
ModifyRecordWithTemplate( $template_id, $record ); |
482 |
ModifyRecordWithTemplate( $template_id, $record ); |
|
Lines 494-501
sub ModifyRecordsWithTemplate {
Link Here
|
| 494 |
|
494 |
|
| 495 |
sub ModifyRecordWithTemplate { |
495 |
sub ModifyRecordWithTemplate { |
| 496 |
my ( $template_id, $record ) = @_; |
496 |
my ( $template_id, $record ) = @_; |
| 497 |
C4::Koha::Log( "Koha::MarcModificationTemplates::ModifyRecordWithTemplate( $template_id, $record )" ) if DEBUG; |
497 |
C4::Koha::Log( "C4::MarcModificationTemplates::ModifyRecordWithTemplate( $template_id, $record )" ) if DEBUG; |
| 498 |
warn( "Koha::MarcModificationTemplates::ModifyRecordWithTemplate( $template_id, $record )" ) if DEBUG; |
498 |
warn( "C4::MarcModificationTemplates::ModifyRecordWithTemplate( $template_id, $record )" ) if DEBUG; |
| 499 |
C4::Koha::Log( "Unmodified Record:\n" . $record->as_formatted() ) if DEBUG >= 10; |
499 |
C4::Koha::Log( "Unmodified Record:\n" . $record->as_formatted() ) if DEBUG >= 10; |
| 500 |
warn( "Unmodified Record:\n" . $record->as_formatted() ) if DEBUG >= 10; |
500 |
warn( "Unmodified Record:\n" . $record->as_formatted() ) if DEBUG >= 10; |
| 501 |
|
501 |
|