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

(-)a/cataloguing/addbiblio.pl (-9 / +12 lines)
Lines 36-41 use C4::ClassSource; Link Here
36
use C4::ImportBatch;
36
use C4::ImportBatch;
37
use C4::Charset;
37
use C4::Charset;
38
use Koha::BiblioFrameworks;
38
use Koha::BiblioFrameworks;
39
use Koha::DateUtils;
39
40
40
use Date::Calc qw(Today);
41
use Date::Calc qw(Today);
41
use MARC::File::USMARC;
42
use MARC::File::USMARC;
Lines 294-308 sub create_input { Link Here
294
    if ( $value eq '' ) {
295
    if ( $value eq '' ) {
295
        $value = $tagslib->{$tag}->{$subfield}->{defaultvalue};
296
        $value = $tagslib->{$tag}->{$subfield}->{defaultvalue};
296
297
297
        # get today date & replace YYYY, MM, DD if provided in the default value
298
        # get today date & replace <<YYYY>>, <<MM>>, <<DD>> if provided in the default value
298
        my ( $year, $month, $day ) = Today();
299
        my $today_dt = dt_from_string;
299
        $month = sprintf( "%02d", $month );
300
        my $year = $today_dt->year;
300
        $day   = sprintf( "%02d", $day );
301
        my $month = $today_dt->month;
301
        $value =~ s/YYYY/$year/g;
302
        my $day = $today_dt->day;
302
        $value =~ s/MM/$month/g;
303
        $value =~ s/<<YYYY>>/$year/g;
303
        $value =~ s/DD/$day/g;
304
        $value =~ s/<<MM>>/$month/g;
304
        my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian");    
305
        $value =~ s/<<DD>>/$day/g;
305
        $value=~s/user/$username/g;
306
        # And <<USER>> with surname (?)
307
        my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian");
308
        $value=~s/<<USER>>/$username/g;
306
    
309
    
307
    }
310
    }
308
    my $dbh = C4::Context->dbh;
311
    my $dbh = C4::Context->dbh;
(-)a/cataloguing/additem.pl (-7 / +11 lines)
Lines 128-139 sub generate_subfield_form { Link Here
128
        $value =~ s/"/&quot;/g;
128
        $value =~ s/"/&quot;/g;
129
        if ( ! defined( $value ) || $value eq '')  {
129
        if ( ! defined( $value ) || $value eq '')  {
130
            $value = $subfieldlib->{defaultvalue};
130
            $value = $subfieldlib->{defaultvalue};
131
            # get today date & replace YYYY, MM, DD if provided in the default value
131
            # get today date & replace <<YYYY>>, <<MM>>, <<DD>> if provided in the default value
132
            my $today_iso = output_pref( { dt=>dt_from_string, dateonly => 1, dateformat => 'iso' } );
132
            my $today_dt = dt_from_string;
133
            my ( $year, $month, $day ) = split ('-', $today_iso);
133
            my $year = $today_dt->year;
134
            $value =~ s/YYYY/$year/g;
134
            my $month = $today_dt->month;
135
            $value =~ s/MM/$month/g;
135
            my $day = $today_dt->day;
136
            $value =~ s/DD/$day/g;
136
            $value =~ s/<<YYYY>>/$year/g;
137
            $value =~ s/<<MM></$month/g;
138
            $value =~ s/<<DD>>/$day/g;
139
            # And <<USER>> with surname (?)
140
            my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian");
141
            $value=~s/<<USER>>/$username/g;
137
        }
142
        }
138
        
143
        
139
        $subfield_data{visibility} = "display:none;" if (($subfieldlib->{hidden} > 4) || ($subfieldlib->{hidden} <= -4));
144
        $subfield_data{visibility} = "display:none;" if (($subfieldlib->{hidden} > 4) || ($subfieldlib->{hidden} <= -4));
140
- 

Return to bug 7045