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

(-)a/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl (-11 / +33 lines)
Lines 133-139 sub updateMarc { Link Here
133
133
134
    # date created field
134
    # date created field
135
    unless ($c_marc_field) {
135
    unless ($c_marc_field) {
136
        $biblio->add_fields( new MARC::Field( $c_field, '', '' ) );
136
        if ( defined $c_subfield ) {
137
            $biblio->add_fields(
138
                new MARC::Field(
139
                    $c_field, ' ', ' ', $c_subfield => $c_db_value
140
                )
141
            );
142
        }
143
        else {
144
            $biblio->add_fields( new MARC::Field( $c_field, $c_db_value ) );
145
        }
137
        $debug and warn "[WARN] $c_field did not exist.";
146
        $debug and warn "[WARN] $c_field did not exist.";
138
        $c_marc_field = $biblio->field($c_field);
147
        $c_marc_field = $biblio->field($c_field);
139
148
Lines 142-165 sub updateMarc { Link Here
142
            $m_marc_field = $c_marc_field;
151
            $m_marc_field = $c_marc_field;
143
        }
152
        }
144
    }
153
    }
145
    if ( defined $c_subfield ) {
146
        $c_marc_field->update( $c_subfield, $c_db_value );
147
    }
148
    else {
154
    else {
149
        $c_marc_field->update($c_db_value);
155
        if ( defined $c_subfield ) {
156
            $c_marc_field->update( $c_subfield, $c_db_value );
157
        }
158
        else {
159
            $c_marc_field->update($c_db_value);
160
        }
150
    }
161
    }
151
162
152
    # date last modified field
163
    # date last modified field
153
    unless ($m_marc_field) {
164
    unless ($m_marc_field) {
154
        $biblio->add_fields( new MARC::Field( $m_field, '', '' ) );
165
        if ( defined $m_subfield ) {
166
            $biblio->add_fields(
167
                new MARC::Field(
168
                    $m_field, ' ', ' ', $m_subfield => $m_db_value
169
                )
170
            );
171
        }
172
        else {
173
            $biblio->add_fields( new MARC::Field( $m_field, $m_db_value ) );
174
        }
175
155
        $debug and warn "[WARN] $m_field did not exist.";
176
        $debug and warn "[WARN] $m_field did not exist.";
156
        $m_marc_field = $biblio->field($m_field);
177
        $m_marc_field = $biblio->field($m_field);
157
    }
178
    }
158
    if ( defined $m_subfield ) {
159
        $m_marc_field->update( $m_subfield, $m_db_value );
160
    }
161
    else {
179
    else {
162
        $m_marc_field->update($m_db_value);
180
        if ( defined $m_subfield ) {
181
            $m_marc_field->update( $m_subfield, $m_db_value );
182
        }
183
        else {
184
            $m_marc_field->update($m_db_value);
185
        }
163
    }
186
    }
164
187
165
    # apply to databse
188
    # apply to databse
166
- 

Return to bug 9192