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

(-)a/C4/Items.pm (-2 / +24 lines)
Lines 2335-2341 The $frameworkcode returns the item for the given frameworkcode, ONLY if bibnum Link Here
2335
sub PrepareItemrecordDisplay {
2335
sub PrepareItemrecordDisplay {
2336
2336
2337
    my ( $bibnum, $itemnum, $defaultvalues, $frameworkcode ) = @_;
2337
    my ( $bibnum, $itemnum, $defaultvalues, $frameworkcode ) = @_;
2338
2339
    my $dbh = C4::Context->dbh;
2338
    my $dbh = C4::Context->dbh;
2340
    $frameworkcode = C4::Biblio::GetFrameworkCode($bibnum) if $bibnum;
2339
    $frameworkcode = C4::Biblio::GetFrameworkCode($bibnum) if $bibnum;
2341
    my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
2340
    my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
Lines 2422-2428 sub PrepareItemrecordDisplay { Link Here
2422
                        $defaultvalue = $defaultvalues->{callnumber};
2421
                        $defaultvalue = $defaultvalues->{callnumber};
2423
                    }
2422
                    }
2424
                }
2423
                }
2425
                if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
2424
2425
                       if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
2426
                    && $defaultvalues
2426
                    && $defaultvalues
2427
                    && $defaultvalues->{'branchcode'} ) {
2427
                    && $defaultvalues->{'branchcode'} ) {
2428
                    if ( $itemrecord and $defaultvalues and not $itemrecord->subfield($tag,$subfield) ) {
2428
                    if ( $itemrecord and $defaultvalues and not $itemrecord->subfield($tag,$subfield) ) {
Lines 2503-2508 sub PrepareItemrecordDisplay { Link Here
2503
2503
2504
                        $defaultvalue = $default_source;
2504
                        $defaultvalue = $default_source;
2505
2505
2506
                        #---- collection code CCODE
2507
                    } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "CCODE") {
2508
                        $authorised_values_sth->execute(
2509
                           $tagslib->{$tag}->{$subfield}->{authorised_value},
2510
                           $branch_limit ? $branch_limit : ()
2511
                        );
2512
                        push @authorised_values, ""
2513
                        unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
2514
                        while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) {
2515
                            push @authorised_values, $value;
2516
                            $authorised_lib{$value} = $lib;
2517
                        }
2518
2519
                        # Set the default CCODE to what was set in subscription.ccode
2520
                        if ($itemrecord and $defaultvalues) {
2521
                            $defaultvalue = $defaultvalues->{'ccode'};
2522
                        } elsif (!$itemrecord and $defaultvalues) {
2523
                            $defaultvalue = $defaultvalues->{'ccode'};
2524
                        }
2525
2506
                        #---- "true" authorised value
2526
                        #---- "true" authorised value
2507
                    } else {
2527
                    } else {
2508
                        $authorised_values_sth->execute(
2528
                        $authorised_values_sth->execute(
Lines 2516-2521 sub PrepareItemrecordDisplay { Link Here
2516
                            $authorised_lib{$value} = $lib;
2536
                            $authorised_lib{$value} = $lib;
2517
                        }
2537
                        }
2518
                    }
2538
                    }
2539
2519
                    $subfield_data{marc_value} = {
2540
                    $subfield_data{marc_value} = {
2520
                        type    => 'select',
2541
                        type    => 'select',
2521
                        values  => \@authorised_values,
2542
                        values  => \@authorised_values,
Lines 2534-2539 sub PrepareItemrecordDisplay { Link Here
2534
                    if ( $itemrecord and my $field = $itemrecord->field($tag) ) {
2555
                    if ( $itemrecord and my $field = $itemrecord->field($tag) ) {
2535
                        $defaultvalue = $field->subfield($subfield);
2556
                        $defaultvalue = $field->subfield($subfield);
2536
                    }
2557
                    }
2558
2537
                    if( !$plugin->errstr ) {
2559
                    if( !$plugin->errstr ) {
2538
                        #TODO Move html to template; see report 12176/13397
2560
                        #TODO Move html to template; see report 12176/13397
2539
                        my $tab= $plugin->noclick? '-1': '';
2561
                        my $tab= $plugin->noclick? '-1': '';
(-)a/C4/Serials.pm (-5 / +6 lines)
Lines 1301-1307 sub ModSubscription { Link Here
1301
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1301
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1302
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1302
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1303
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1303
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1304
    $itemtype, $previousitemtype, $mana_id
1304
    $itemtype, $previousitemtype, $mana_id, $ccode
1305
    ) = @_;
1305
    ) = @_;
1306
1306
1307
    my $dbh   = C4::Context->dbh;
1307
    my $dbh   = C4::Context->dbh;
Lines 1314-1320 sub ModSubscription { Link Here
1314
            callnumber=?, notes=?, letter=?, manualhistory=?,
1314
            callnumber=?, notes=?, letter=?, manualhistory=?,
1315
            internalnotes=?, serialsadditems=?, staffdisplaycount=?,
1315
            internalnotes=?, serialsadditems=?, staffdisplaycount=?,
1316
            opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
1316
            opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
1317
            skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?
1317
            skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?, ccode=?
1318
        WHERE subscriptionid = ?";
1318
        WHERE subscriptionid = ?";
1319
1319
1320
    my $sth = $dbh->prepare($query);
1320
    my $sth = $dbh->prepare($query);
Lines 1328-1334 sub ModSubscription { Link Here
1328
        $letter,          ($manualhistory ? $manualhistory : 0),
1328
        $letter,          ($manualhistory ? $manualhistory : 0),
1329
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1329
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1330
        $graceperiod,     $location,       $enddate,        $skip_serialseq,
1330
        $graceperiod,     $location,       $enddate,        $skip_serialseq,
1331
        $itemtype,        $previousitemtype, $mana_id,
1331
        $itemtype,        $previousitemtype, $mana_id, $ccode,
1332
        $subscriptionid
1332
        $subscriptionid
1333
    );
1333
    );
1334
    my $rows = $sth->rows;
1334
    my $rows = $sth->rows;
Lines 1345-1351 $subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu Link Here
1345
    $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
1345
    $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
1346
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1346
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1347
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1347
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1348
    $skip_serialseq, $itemtype, $previousitemtype);
1348
    $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode);
1349
1349
1350
Create a new subscription with value given on input args.
1350
Create a new subscription with value given on input args.
1351
1351
Lines 1362-1368 sub NewSubscription { Link Here
1362
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1362
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1363
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1363
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1364
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1364
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1365
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id
1365
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
1366
    ) = @_;
1366
    ) = @_;
1367
    my $dbh = C4::Context->dbh;
1367
    my $dbh = C4::Context->dbh;
1368
1368
Lines 1405-1410 sub NewSubscription { Link Here
1405
            itemtype          => $itemtype,
1405
            itemtype          => $itemtype,
1406
            previousitemtype  => $previousitemtype,
1406
            previousitemtype  => $previousitemtype,
1407
            mana_id           => $mana_id,
1407
            mana_id           => $mana_id,
1408
            ccode             => $ccode,
1408
        }
1409
        }
1409
    )->store;
1410
    )->store;
1410
    $subscription->discard_changes;
1411
    $subscription->discard_changes;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (+18 lines)
Lines 319-324 fieldset.rows table { clear: none; margin: 0; } Link Here
319
                                        </select>
319
                                        </select>
320
                                        <span class="required">Required</span>
320
                                        <span class="required">Required</span>
321
                                    </li>
321
                                    </li>
322
                                    <ul>
323
                                        <li>
324
                                            <label for="ccode" class="required">Serial issue Collection code:</label>
325
                                            <select name="ccode" id="ccode">
326
                                                [% FOREACH ccode_value IN ccode_loop %]
327
                                                   [% IF (ccode_value.selected) %]
328
                                                        <option value="[% ccode_value.authorised_value | html %]" selected="selected">
329
                                                    [% ELSE %]
330
                                                        <option value="[% ccode_value.authorised_value | html %]">
331
                                                    [% END %]
332
                                                        [% ccode_value.lib | html %]
333
                                                        </option>
334
                                                [% END %]
335
                                            </select>
336
                                            <span class="required">Required</span>
337
                                        </li>
338
339
                                    </ul>
322
                                    <li>
340
                                    <li>
323
                                        <label for="locale">Locale:</label>
341
                                        <label for="locale">Locale:</label>
324
                                        <select id="locale" name="locale">
342
                                        <select id="locale" name="locale">
(-)a/serials/subscription-add.pl (-3 / +7 lines)
Lines 139-147 if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { Link Here
139
139
140
my $locations_loop = GetAuthorisedValues("LOC");
140
my $locations_loop = GetAuthorisedValues("LOC");
141
141
142
my $ccode_loop = GetAuthorisedValues("CCODE");
143
142
$template->param(
144
$template->param(
143
    branchcode => $subs->{branchcode},
145
    branchcode => $subs->{branchcode},
144
    locations_loop=>$locations_loop,
146
    locations_loop=>$locations_loop,
147
    ccode_loop => $ccode_loop,
145
);
148
);
146
149
147
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' });
150
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' });
Lines 349-354 sub redirect_add_subscription { Link Here
349
    my $itemtype          = $query->param('itemtype');
352
    my $itemtype          = $query->param('itemtype');
350
    my $previousitemtype  = $query->param('previousitemtype');
353
    my $previousitemtype  = $query->param('previousitemtype');
351
    my $skip_serialseq    = $query->param('skip_serialseq');
354
    my $skip_serialseq    = $query->param('skip_serialseq');
355
    my $ccode             = $query->param('ccode');
352
356
353
    my $mana_id;
357
    my $mana_id;
354
    if ( $query->param('mana_id') ne "" ) {
358
    if ( $query->param('mana_id') ne "" ) {
Lines 375-381 sub redirect_add_subscription { Link Here
375
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
379
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
376
        $manualhistory, $internalnotes, $serialsadditems,
380
        $manualhistory, $internalnotes, $serialsadditems,
377
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
381
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
378
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
382
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
379
    );
383
    );
380
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
384
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
381
        my $result = Koha::SharedContent::send_entity( $query->param('mana_language') || '', $loggedinuser, $subscriptionid, 'subscription');
385
        my $result = Koha::SharedContent::send_entity( $query->param('mana_language') || '', $loggedinuser, $subscriptionid, 'subscription');
Lines 463-468 sub redirect_mod_subscription { Link Here
463
    my $itemtype          = $query->param('itemtype');
467
    my $itemtype          = $query->param('itemtype');
464
    my $previousitemtype  = $query->param('previousitemtype');
468
    my $previousitemtype  = $query->param('previousitemtype');
465
    my $skip_serialseq    = $query->param('skip_serialseq');
469
    my $skip_serialseq    = $query->param('skip_serialseq');
470
    my $ccode             = $query->param('ccode');
466
471
467
    my $mana_id;
472
    my $mana_id;
468
    if ( $query->param('mana_id') ne "" ) {
473
    if ( $query->param('mana_id') ne "" ) {
Lines 498-504 sub redirect_mod_subscription { Link Here
498
        $status, $biblionumber, $callnumber, $notes, $letter,
503
        $status, $biblionumber, $callnumber, $notes, $letter,
499
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
504
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
500
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
505
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
501
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
506
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
502
    );
507
    );
503
508
504
    my @additional_fields;
509
    my @additional_fields;
505
- 

Return to bug 23352