Changeset 12219


Ignore:
Timestamp:
2006-07-13T18:01:10+12:00 (18 years ago)
Author:
mdewsnip
Message:

Tidied up the construction dates, and made a few other minor changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cic-hcap/perllib/plugins/CICPlug.pm

    r12212 r12219  
    496496
    497497    # Prepare SQL statement for getting the Place building styles
    498     my $place_styles_sql_statement = "SELECT Architectural_Classification FROM tblArchTypes,jnxtblArchPlace WHERE tblArchTypes.ArchType_ID=jnxtblArchPlace.ArchType_ID AND Entry_ID=?";
     498    my $place_styles_sql_statement = "SELECT Architectural_Classification FROM tblArchTypes,ArchPlace WHERE tblArchTypes.ArchType_ID=ArchPlace.ArchType_ID AND Entry_ID=?";
    499499    my $place_styles_sql_handle = $dbh->prepare($place_styles_sql_statement);
    500500    $place_styles_sql_handle->{LongReadLen} = 65536;
     
    600600        my $place_construction_date = $place_construction_dates_match_hashref->{"Date"};
    601601        if (!defined($place_construction_date)) {
     602        # Landscape sites are allowed to have no construction information
     603        next if ($place_type eq "Landscape site");
     604
    602605        print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Missing construction date'>\n" if ($self->{'gli'});
    603606        print STDERR "Error: Place $place_id -- Missing construction date.\n";
     
    605608        next;
    606609        }
    607         # Check for multiline values (these are errors)
    608         if ($place_construction_date =~ /\n/) {
    609         print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Multiline construction date'>\n" if ($self->{'gli'});
    610         print STDERR "Error: Place $place_id -- Multiline construction date.\n";
    611         print $fail_log_handle "Error: Place $place_id -- Multiline construction date.\n";
    612         next;
    613         }
    614         my $place_construction_note = $place_construction_dates_match_hashref->{"Note"};
    615         if (!defined($place_construction_note)) {
    616         print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Missing construction note'>\n" if ($self->{'gli'});
    617         print STDERR "Error: Place $place_id -- Missing construction note.\n";
    618         print $fail_log_handle "Error: Place $place_id -- Missing construction note.\n";
    619         next;
    620         }
    621         my $place_construction_date_prefix = $place_construction_dates_match_hashref->{"Prefix"} || "";
    622         $place_construction_dates_table_html .= "<tr><td valign=\"top\"><nobr>$place_construction_date_prefix $place_construction_date</nobr>&nbsp;</td><td valign=\"top\">$place_construction_note</td></tr>";
    623610
    624611        # Convert the construction date to a time period (for searching and browsing)
    625         if ($place_construction_date =~ /^(\d\d\d\d).*$/) {
    626         $place_construction_date =~ s/^(\d\d\d\d).*$/$1/;
     612        if ($place_construction_date =~ /^(\d{1,4}).*$/) {
     613        $place_construction_date = $1;
    627614
    628615        my $place_time_period;
     
    631618        elsif ($place_construction_date < 1900) { $place_time_period = "1850-1900"; }
    632619        elsif ($place_construction_date < 1945) { $place_time_period = "1900-1945"; }
    633         elsif ($place_construction_date < 1995) { $place_time_period = "1945-1995"; }
    634         else { $place_time_period = "post-1995"; }
     620        elsif ($place_construction_date <= 1995) { $place_time_period = "1945-1995"; }
     621        elsif ($place_construction_date > 1995) { $place_time_period = "post-1995"; }
    635622        push(@{$place_date_to_ids_mapping{$place_time_period}}, $place_doc_obj->get_OID());
    636623        &new_metadata_entry($place_doc_obj, "Time_period", $place_time_period);
    637624        }
     625        elsif ($place_construction_date ne "n.d." && $place_construction_date ne "unknown" && $place_construction_date ne "various") {
     626        print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Warning: Unknown construction date: $place_construction_date'>\n" if ($self->{'gli'});
     627        print STDERR "Warning: Place $place_id -- Unknown construction date: $place_construction_date.\n";
     628        print $fail_log_handle "Warning: Place $place_id -- Unknown construction date: $place_construction_date.\n";
     629        }
     630
     631        my $place_construction_note = $place_construction_dates_match_hashref->{"Note"};
     632        if (!defined($place_construction_note)) {
     633        # "No date" entries are allowed to have no construction note
     634        next if ($place_construction_date eq "n.d");
     635 
     636        print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Missing construction note'>\n" if ($self->{'gli'});
     637        print STDERR "Error: Place $place_id -- Missing construction note.\n";
     638        print $fail_log_handle "Error: Place $place_id -- Missing construction note.\n";
     639        next;
     640        }
     641        my $place_construction_date_prefix = $place_construction_dates_match_hashref->{"Prefix"} || "";
     642        $place_construction_dates_table_html .= "<tr><td valign=\"top\"><nobr>$place_construction_date_prefix $place_construction_date</nobr>&nbsp;</td><td valign=\"top\">$place_construction_note</td></tr>";
    638643    }
    639644    &new_metadata_entry($place_doc_obj, "PlaceConstructionDatesTableHTML", "<table cellpadding=\"0\" cellspacing=\"0\">" . $place_construction_dates_table_html . "</table>");
     
    687692        $place_function_to_index =~ s/ \(campus,.*/ \(campus\)/;
    688693        $place_function_to_index =~ s/ \(campus:.*/ \(campus\)/;
     694        $place_function_to_index =~ s/ \(landscape,.*/ \(landscape\)/;
    689695        }
    690696        else {
     
    703709        # Check it is one of the valid function values
    704710        if (!defined($place_functions_mapping->{$place_function_to_index})) {
    705         print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Unknown function: $place_function_to_index'>\n" if ($self->{'gli'});
    706         print STDERR "Error: Place $place_id -- Unknown function: $place_function_to_index.\n";
    707         print $fail_log_handle "Error: Place $place_id -- Unknown function: $place_function_to_index.\n";
     711        # print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Warning: Unknown function: $place_function_to_index'>\n" if ($self->{'gli'});
     712        print STDERR "Warning: Place $place_id -- Unknown function: $place_function_to_index.\n";
     713        print $fail_log_handle "Warning: Place $place_id -- Unknown function: $place_function_to_index.\n";
    708714        next;
    709715        }
Note: See TracChangeset for help on using the changeset viewer.