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

(-)a/C4/Biblio.pm (-1 lines)
Lines 2714-2720 sub TransformMarcToKohaOneField { Link Here
2714
    return $result;
2714
    return $result;
2715
}
2715
}
2716
2716
2717
2718
#"
2717
#"
2719
2718
2720
#
2719
#
(-)a/C4/Items.pm (+9 lines)
Lines 2728-2733 sub PrepareItemrecordDisplay { Link Here
2728
                        while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) {
2728
                        while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) {
2729
                            push @authorised_values, $itemtype;
2729
                            push @authorised_values, $itemtype;
2730
                            $authorised_lib{$itemtype} = $description;
2730
                            $authorised_lib{$itemtype} = $description;
2731
2732
                            # If we have default value named itemtype or itemtypes, we use it
2733
                            $defaultvalue = $itemtype if ($defaultvalues and ($defaultvalues->{'itemtypes'} eq $itemtype or $defaultvalues->{'itemtype'} eq $itemtype));
2731
                        }
2734
                        }
2732
                        #---- class_sources
2735
                        #---- class_sources
2733
                    } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) {
2736
                    } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) {
Lines 2756-2761 sub PrepareItemrecordDisplay { Link Here
2756
                        while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) {
2759
                        while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) {
2757
                            push @authorised_values, $value;
2760
                            push @authorised_values, $value;
2758
                            $authorised_lib{$value} = $lib;
2761
                            $authorised_lib{$value} = $lib;
2762
2763
                            # If we have a default value that has the same name as the authorised value category of the field,
2764
                            # we use it
2765
                            $defaultvalue = $value if ($defaultvalues and $defaultvalues->{$tagslib->{$tag}->{$subfield}->{authorised_value}} and $defaultvalues->{$tagslib->{$tag}->{$subfield}->{authorised_value}} eq $value);
2766
2767
2759
                        }
2768
                        }
2760
                    }
2769
                    }
2761
                    $subfield_data{marc_value} = CGI::scrolling_list(
2770
                    $subfield_data{marc_value} = CGI::scrolling_list(
(-)a/C4/Serials.pm (-8 / +46 lines)
Lines 47-52 BEGIN { Link Here
47
      &ReNewSubscription  &GetLateIssues      &GetLateOrMissingIssues
47
      &ReNewSubscription  &GetLateIssues      &GetLateOrMissingIssues
48
      &GetSerialInformation                   &AddItem2Serial
48
      &GetSerialInformation                   &AddItem2Serial
49
      &PrepareSerialsData &GetNextExpected    &ModNextExpected
49
      &PrepareSerialsData &GetNextExpected    &ModNextExpected
50
      &GetPreviousSerialid
50
51
51
      &UpdateClaimdateIssues
52
      &UpdateClaimdateIssues
52
      &GetSuppliersWithLateIssues             &getsupplierbyserialid
53
      &GetSuppliersWithLateIssues             &getsupplierbyserialid
Lines 824-829 sub GetLatestSerials { Link Here
824
    return \@serials;
825
    return \@serials;
825
}
826
}
826
827
828
=head2 GetPreviousSerialid
829
830
$serialid = GetPreviousSerialid($subscriptionid, $nth)
831
get the $nth's previous serial for the given subscriptionid
832
return :
833
the serialid
834
835
=cut
836
837
sub GetPreviousSerialid {
838
    my ( $subscriptionid, $nth ) = @_;
839
    $nth ||= 1;
840
    my $dbh = C4::Context->dbh;
841
    my $return = undef;
842
843
    # Status 2: Arrived
844
    my $strsth = "SELECT   serialid
845
                        FROM     serial
846
                        WHERE    subscriptionid = ?
847
                        AND      status = 2
848
                        ORDER BY serialid DESC LIMIT $nth,1 
849
                ";
850
    my $sth = $dbh->prepare($strsth);
851
    $sth->execute($subscriptionid);
852
    my @serials;
853
    my $line = $sth->fetchrow_hashref;
854
    $return = $line->{'serialid'} if ($line);
855
856
    return $return;
857
}
858
859
860
827
=head2 GetDistributedTo
861
=head2 GetDistributedTo
828
862
829
$distributedto=GetDistributedTo($subscriptionid)
863
$distributedto=GetDistributedTo($subscriptionid)
Lines 1225-1231 sub ModSubscription { Link Here
1225
        $whenmorethan1,   $setto1,          $lastvalue1,        $innerloop1,       $add2,          $every2,      $whenmorethan2, $setto2,
1259
        $whenmorethan1,   $setto1,          $lastvalue1,        $innerloop1,       $add2,          $every2,      $whenmorethan2, $setto2,
1226
        $lastvalue2,      $innerloop2,      $add3,              $every3,           $whenmorethan3, $setto3,      $lastvalue3,    $innerloop3,
1260
        $lastvalue2,      $innerloop2,      $add3,              $every3,           $whenmorethan3, $setto3,      $lastvalue3,    $innerloop3,
1227
        $numberingmethod, $status,          $biblionumber,      $callnumber,       $notes,         $letter,      $hemisphere,    $manualhistory,
1261
        $numberingmethod, $status,          $biblionumber,      $callnumber,       $notes,         $letter,      $hemisphere,    $manualhistory,
1228
        $internalnotes,   $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,    $enddate,       $subscriptionid
1262
        $internalnotes,   $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,    $enddate,       $itemtype,
1263
	$ccode,           $origin,          $domain,            $previousitemtype, $subscriptionid
1229
    ) = @_;
1264
    ) = @_;
1230
1265
1231
    #     warn $irregularity;
1266
    #     warn $irregularity;
Lines 1239-1245 sub ModSubscription { Link Here
1239
                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, 
1274
                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, 
1240
						letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,
1275
						letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,
1241
						staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ?
1276
						staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ?
1242
						,enddate=?
1277
						,enddate=?, itemtype=?, ccode=?, origin=?, domain=?, previousitemtype = ?
1243
                    WHERE subscriptionid = ?";
1278
                    WHERE subscriptionid = ?";
1244
1279
1245
    #warn "query :".$query;
1280
    #warn "query :".$query;
Lines 1256-1265 sub ModSubscription { Link Here
1256
        $numberingmethod, $status,         $biblionumber,   $callnumber,
1291
        $numberingmethod, $status,         $biblionumber,   $callnumber,
1257
        $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ),
1292
        $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ),
1258
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1293
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1259
        $graceperiod,   $location,        $enddate,           $subscriptionid
1294
        $graceperiod,   $location,        $enddate,         $itemtype,
1295
	$ccode,         $origin,          $domain,          $previousitemtype,
1296
	$subscriptionid
1260
    );
1297
    );
1261
    my $rows = $sth->rows;
1298
    my $rows = $sth->rows;
1262
1263
    logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");
1299
    logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");
1264
    return $rows;
1300
    return $rows;
1265
}
1301
}
Lines 1287-1293 sub NewSubscription { Link Here
1287
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1323
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1288
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, $status,
1324
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, $status,
1289
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1325
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1290
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate
1326
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate,         $itemtype,
1327
        $ccode,         $origin,          $domain,            $previousitemtype
1291
    ) = @_;
1328
    ) = @_;
1292
    my $dbh = C4::Context->dbh;
1329
    my $dbh = C4::Context->dbh;
1293
1330
Lines 1301-1308 sub NewSubscription { Link Here
1301
            add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
1338
            add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
1302
            numberingmethod, status, notes, letter,firstacquidate,irregularity,
1339
            numberingmethod, status, notes, letter,firstacquidate,irregularity,
1303
            numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,
1340
            numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,
1304
            staffdisplaycount,opacdisplaycount,graceperiod,location,enddate)
1341
            staffdisplaycount,opacdisplaycount,graceperiod,location,enddate, itemtype, ccode, origin, domain, previousitemtype)
1305
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1342
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1306
        |;
1343
        |;
1307
    my $sth = $dbh->prepare($query);
1344
    my $sth = $dbh->prepare($query);
1308
    $sth->execute(
1345
    $sth->execute(
Lines 1311-1317 sub NewSubscription { Link Here
1311
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1348
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1312
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, "$status",
1349
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, "$status",
1313
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1350
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1314
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate
1351
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate, 	  $itemtype,
1352
	$ccode,         $origin,          $domain, $previousitemtype
1315
    );
1353
    );
1316
1354
1317
    my $subscriptionid = $dbh->{'mysql_insertid'};
1355
    my $subscriptionid = $dbh->{'mysql_insertid'};
(-)a/installer/data/mysql/kohastructure.sql (+5 lines)
Lines 2031-2036 CREATE TABLE `subscription` ( Link Here
2031
  `enddate` date default NULL,
2031
  `enddate` date default NULL,
2032
  `closed` INT(1) NOT NULL DEFAULT 0,
2032
  `closed` INT(1) NOT NULL DEFAULT 0,
2033
  `reneweddate` date default NULL,
2033
  `reneweddate` date default NULL,
2034
  `itemtype` VARCHAR( 10 ) NULL,
2035
  `ccode` VARCHAR( 10 ) NULL,
2036
  `origin` VARCHAR( 80 ) NULL,
2037
  `domain` VARCHAR( 80 ) NULL,
2038
  `previousitemtype` VARCHAR( 10 ) NULL,
2034
  PRIMARY KEY  (`subscriptionid`)
2039
  PRIMARY KEY  (`subscriptionid`)
2035
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2040
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2036
2041
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 168-173 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
168
('LinkerOptions','','','A pipe-separated list of options for the linker.','free'),
168
('LinkerOptions','','','A pipe-separated list of options for the linker.','free'),
169
('LinkerRelink','1',NULL,'If ON the authority linker will relink headings that have previously been linked every time it runs.','YesNo'),
169
('LinkerRelink','1',NULL,'If ON the authority linker will relink headings that have previously been linked every time it runs.','YesNo'),
170
('LocalCoverImages','0','1','Display local cover images on intranet details pages.','YesNo'),
170
('LocalCoverImages','0','1','Display local cover images on intranet details pages.','YesNo'),
171
('makePreviousSerialAvailable','0','','make previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.','YesNo'),
171
('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'),
172
('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'),
172
('MARCAuthorityControlField008','|| aca||aabn           | a|a     d',NULL,NULL,'Textarea'),
173
('MARCAuthorityControlField008','|| aca||aabn           | a|a     d',NULL,NULL,'Textarea'),
173
('MARCOrgCode','OSt','','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','free'),
174
('MARCOrgCode','OSt','','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','free'),
Lines 326-331 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
326
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
327
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
327
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
328
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
328
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
329
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
330
('serialsFieldsToAV','','','There are several fields from serials which can use authorised values. Those are support, origin, and domain. You can configure them like this: support:995$r|origin:995$s|domain:995$t','')
329
('SessionStorage','mysql','mysql|Pg|tmp','Use database or a temporary file for storing session data','Choice'),
331
('SessionStorage','mysql','mysql|Pg|tmp','Use database or a temporary file for storing session data','Choice'),
330
('ShelfBrowserUsesCcode','1','0','Use the item collection code when finding items for the shelf browser.','YesNo'),
332
('ShelfBrowserUsesCcode','1','0','Use the item collection code when finding items for the shelf browser.','YesNo'),
331
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
333
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+36 lines)
Lines 7077-7082 if ( CheckVersion($DBversion) ) { Link Here
7077
    SetVersion($DBversion);
7077
    SetVersion($DBversion);
7078
}
7078
}
7079
7079
7080
7081
7082
7083
7084
7085
7086
$DBversion = "3.13.00.XXX";
7087
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7088
    $dbh->do(q{
7089
        ALTER TABLE `subscription` ADD `itemtype` VARCHAR( 10 ) NULL,
7090
        ADD `ccode` VARCHAR( 10 ) NULL,
7091
        ADD `origin` VARCHAR( 80 ) NULL,
7092
        ADD `domain` VARCHAR( 80 ) NULL,
7093
        ADD `previousitemtype` VARCHAR( 10 ) NULL
7094
    });
7095
    print "Upgrade to $DBversion done (Bug 7677: Adds fields to subscription table)\n";
7096
    SetVersion($DBversion);
7097
}
7098
7099
$DBversion = "3.13.00.XXX";
7100
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7101
    $dbh->do(
7102
        "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('makePreviousSerialAvailable','0','make previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.','','YesNo');"
7103
    );
7104
7105
    $dbh->do(
7106
        'INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ("serialsFieldsToAV","","There are several fields from serials which can use authorised values. Those are support, origin, and domain. You can configure them like this: support:995$r|origin:995$s|domain:995$t","","");'
7107
    );
7108
7109
    print "Upgrade to $DBversion done (Add makePreviousSerialAvailable and serialsFieldsToAV sysprefs)\n";
7110
    SetVersion($DBversion);
7111
}
7112
7113
7114
7115
7080
=head1 FUNCTIONS
7116
=head1 FUNCTIONS
7081
7117
7082
=head2 TableExists($table)
7118
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref (+9 lines)
Lines 50-52 Serials: Link Here
50
    -
50
    -
51
        - List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)
51
        - List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)
52
        - pref: SubscriptionDuplicateDroppedInput
52
        - pref: SubscriptionDuplicateDroppedInput
53
    -
54
        - pref: makePreviousSerialAvailable
55
          choices: 
56
            yes: Make
57
            no: Do not make
58
        - previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.
59
    - 
60
        - pref: serialsFieldsToAV
61
        - "There are several fields from serials which can use authorised values. Those are support, origin, and domain. You can configure them like this: support:995$r|origin:995$s|domain:995$t"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (+6 lines)
Lines 59-64 function unHideItems(index,labelindex, serialId) { Link Here
59
    // Setting text field
59
    // Setting text field
60
    $(subfield_div).children("input[type='text'][name='field_value']").val($("#serialseq" + serialId).val());
60
    $(subfield_div).children("input[type='text'][name='field_value']").val($("#serialseq" + serialId).val());
61
61
62
    // Also prefilling 995$l
63
    subfieldid = "subfield" + itemid.substr(4) + "l";
64
    $("#" + subfieldid + " input[type='text']").val($("#serialseq" + serialId).val());
65
    // And prefilling for supplemental issue
66
    $("#subfieldNEWl input[type='text']").val($("#serialseqNEW").val());
67
62
}
68
}
63
function HideItems(index,labelindex) {
69
function HideItems(index,labelindex) {
64
	subfield = document.getElementById(index);
70
	subfield = document.getElementById(index);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (+73 lines)
Lines 1049-1054 $(document).ready(function() { Link Here
1049
                [% FOREACH locations_loo IN locations_loop %][% IF ( locations_loo.selected ) %]<option value="[% locations_loo.authorised_value %]" selected="selected">[% locations_loo.lib %]</option>[% ELSE %]<option value="[% locations_loo.authorised_value %]">[% locations_loo.lib %]</option>[% END %][% END %]
1049
                [% FOREACH locations_loo IN locations_loop %][% IF ( locations_loo.selected ) %]<option value="[% locations_loo.authorised_value %]" selected="selected">[% locations_loo.lib %]</option>[% ELSE %]<option value="[% locations_loo.authorised_value %]">[% locations_loo.lib %]</option>[% END %][% END %]
1050
            </select>
1050
            </select>
1051
        </li>
1051
        </li>
1052
	<li>
1053
	    <label for="itemtype">Item type:</label>
1054
	    <select name="itemtype" id="itemtype">
1055
                <option value=""></option>
1056
                [% FOREACH type IN typeloop %]
1057
                    [% IF ( type.selected ) %]
1058
                        <option value="[% type.code %]" selected="selected">[% type.value %]</option>
1059
                    [% ELSE %]
1060
                        <option value="[% type.code %]">[% type.value %]</option>
1061
                    [% END %]
1062
                [% END %]
1063
	    </select>
1064
	</li>
1065
        [%IF makePreviousSerialAvailable %]
1066
        <li>
1067
	    <label for="previousitemtype">Previous serial Item type:</label>
1068
	    <select name="previousitemtype" id="previousitemtype">
1069
		    <option value=""></option>
1070
                [% FOREACH previous IN previoustypeloop %]
1071
                    [% IF ( previous.selected ) %]
1072
                        <option value="[% previous.code %]" selected="selected">[% previous.value %]</option>
1073
                    [% ELSE %]
1074
                        <option value="[% previous.code %]">[% previous.value %]</option>
1075
                    [% END %]
1076
                [% END %]
1077
	    </select>
1078
	</li>
1079
        [% END %]
1080
        [% IF supportloop %]
1081
	<li>
1082
	    <label for="support">Support:</label>
1083
	    <select name="support" id="support">
1084
                <option value=""></option>
1085
                [% FOREACH support IN supportloop %]
1086
                    [% IF ( support.selected ) %]
1087
                        <option value="[% support.code %]" selected="selected">[% support.value %]</option>
1088
                    [% ELSE %]
1089
                        <option value="[% support.code %]">[% support.value %]</option>
1090
                    [% END %]
1091
                [% END %]
1092
	    </select>
1093
	</li>
1094
        [% END %]
1095
        [% IF originloop %]
1096
	<li>
1097
	    <label for="origin">Origin:</label>
1098
	    <select name="origin" id="origin">
1099
                <option value=""></option>
1100
                [% FOREACH origin IN originloop %]
1101
                    [% IF ( origin.selected ) %]
1102
                        <option value="[% origin.code %]" selected="selected">[% origin.value %]</option>
1103
                    [% ELSE %]
1104
                        <option value="[% origin.code %]">[% origin.value %]</option>
1105
                    [% END %]
1106
                [% END %]
1107
	    </select>
1108
	</li>
1109
        [% END %]
1110
        [% IF domainloop %]
1111
	<li>
1112
	    <label for="domain">Domain:</label>
1113
	    <select name="domain" id="domain">
1114
                <option value=""></option>
1115
                [% FOREACH domain IN domainloop %]
1116
                    [% IF ( domain.selected ) %]
1117
                        <option value="[% domain.code %]" selected="selected">[% domain.value %]</option>
1118
                    [% ELSE %]
1119
                        <option value="[% domain.code %]">[% domain.value %]</option>
1120
                    [% END %]
1121
                [% END %]
1122
	    </select>
1123
	</li>
1124
        [% END %]
1052
         <li>
1125
         <li>
1053
            <label for="callnumber">Call number:</label>
1126
            <label for="callnumber">Call number:</label>
1054
            <input type="text" name="callnumber" id="callnumber" value="[% callnumber %]" size="20" />
1127
            <input type="text" name="callnumber" id="callnumber" value="[% callnumber %]" size="20" />
(-)a/serials/serials-edit.pl (+24 lines)
Lines 90-95 if ( scalar(@subscriptionids) == 1 && index( $subscriptionids[0], q|,| ) > 0 ) { Link Here
90
}
90
}
91
my @errors;
91
my @errors;
92
my @errseq;
92
my @errseq;
93
my $dbh   = C4::Context->dbh;
93
94
94
# If user comes from subscription details
95
# If user comes from subscription details
95
unless (@serialids) {
96
unless (@serialids) {
Lines 242-247 if ( $op and $op eq 'serialchangestatus' ) { Link Here
242
                $notes[$i]
243
                $notes[$i]
243
            );
244
            );
244
        }
245
        }
246
        my $makePreviousSerialAvailable = C4::Context->preference('makePreviousSerialAvailable');
247
        if ($makePreviousSerialAvailable && $serialids[$i] ne "NEW") {
248
            # We already have created the new expected serial at this point, so we get the second previous serial
249
            my $previous = GetPreviousSerialid($subscriptionids[$i]);
250
            if ($previous) {
251
252
                # Getting the itemnumber matching the serialid
253
                my $query = "SELECT itemnumber FROM serialitems WHERE serialid=?";
254
                my $sth = $dbh->prepare($query);
255
                $sth->execute($previous);
256
                my @row = $sth->fetchrow_array;
257
                if ($row[0]) {
258
                    my $itemnumber = $row[0];
259
260
                    # Getting the itemtype to set from the database
261
                    my $subscriptioninfos = GetSubscription($subscriptionids[$i]);
262
263
                    # Changing the status to "available" and the itemtype according to the previousitemtype db field
264
                    ModItem({notforloan => 0, itype => $subscriptioninfos->{'previousitemtype'} }, undef, $itemnumber);
265
                }
266
            }
267
        }
268
245
    }
269
    }
246
    my @moditems = $query->param('moditem');
270
    my @moditems = $query->param('moditem');
247
    if ( scalar(@moditems) ) {
271
    if ( scalar(@moditems) ) {
(-)a/serials/subscription-add.pl (-2 / +74 lines)
Lines 149-154 $template->param(branchloop => $branchloop, Link Here
149
    locations_loop=>$locations_loop,
149
    locations_loop=>$locations_loop,
150
);
150
);
151
# prepare template variables common to all $op conditions:
151
# prepare template variables common to all $op conditions:
152
my $shelflocations = GetKohaAuthorisedValues( 'items.location', '' );
153
154
my @locationarg =
155
  map { { code => $_, value => $shelflocations->{$_}, selected => ( ( $subs->{location} and $_ eq $subs->{location} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$shelflocations};
156
157
my $typeloop = GetItemTypes();
158
159
# Getting which field is mapped to which authorised value
160
my $mapstring = C4::Context->preference('serialsFieldsToAV');
161
my %hashmap = split(/[:|]/, $mapstring);
162
my $supportloop;
163
my $originloop;
164
my $domainloop;
165
166
if ($hashmap{'support'}) {
167
    my ($field, $subfield) = split('\$', $hashmap{'support'});
168
    $supportloop = GetKohaAuthorisedValuesFromField($field, $subfield, '');
169
}
170
171
if ($hashmap{'origin'}) {
172
    my ($field, $subfield) = split('\$', $hashmap{'origin'});
173
    $originloop = GetKohaAuthorisedValuesFromField($field, $subfield, '');
174
}
175
176
if ($hashmap{'domain'}) {
177
    my ($field, $subfield) = split('\$', $hashmap{'domain'});
178
    $domainloop = GetKohaAuthorisedValuesFromField($field, $subfield, '');
179
}
180
181
182
my @typearg = 
183
    map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{itemtype} and $_ eq $subs->{itemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
184
my @previoustypearg = 
185
    map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{previousitemtype} and $_ eq $subs->{previousitemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
186
my @supportarg = 
187
    map { { code => $_, value => $supportloop->{$_}, selected => ( ( $subs->{ccode} and $_ eq $subs->{ccode} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$supportloop};
188
my @originarg =
189
    map { { code => $_, value => $originloop->{$_}, selected => ( ( $subs->{origin} and $_ eq $subs->{origin} ) ? "selected=\"selected\"" : "" ), } } sort { lc $originloop->{$a} cmp lc $originloop->{$b} } keys %{$originloop};
190
my @domainarg = 
191
    map { { code => $_, value => $domainloop->{$_}, selected => ( ( $subs->{domain} and $_ eq $subs->{domain} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$domainloop};
192
193
194
195
$template->param( shelflocations => \@locationarg );
196
197
$template->param(
198
    branchloop               => $branchloop,
199
    typeloop                 => \@typearg,
200
    previoustypeloop         => \@previoustypearg,
201
    supportloop              => \@supportarg,
202
    originloop               => \@originarg,
203
    domainloop               => \@domainarg,
204
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
205
    locations_loop=>$locations_loop,
206
);
207
# prepare template variables common to all $op conditions:
208
$template->param(  'dateformat_' . C4::Context->preference('dateformat') => 1 );
209
$template->param('makePreviousSerialAvailable' => 1) if (C4::Context->preference('makePreviousSerialAvailable'));
210
152
if ($op!~/^mod/) {
211
if ($op!~/^mod/) {
153
    letter_loop(q{}, $template);
212
    letter_loop(q{}, $template);
154
}
213
}
Lines 254-259 sub redirect_add_subscription { Link Here
254
    my $staffdisplaycount = $query->param('staffdisplaycount');
313
    my $staffdisplaycount = $query->param('staffdisplaycount');
255
    my $opacdisplaycount  = $query->param('opacdisplaycount');
314
    my $opacdisplaycount  = $query->param('opacdisplaycount');
256
    my $location          = $query->param('location');
315
    my $location          = $query->param('location');
316
    my $itemtype          = $query->param('itemtype');
317
    my $support           = $query->param('support');
318
    my $origin            = $query->param('origin');
319
    my $domain            = $query->param('domain');
320
    my $previousitemtype  = $query->param('previousitemtype');
257
    my $startdate = format_date_in_iso( $query->param('startdate') );
321
    my $startdate = format_date_in_iso( $query->param('startdate') );
258
    my $enddate = format_date_in_iso( $query->param('enddate') );
322
    my $enddate = format_date_in_iso( $query->param('enddate') );
259
    my $firstacquidate  = format_date_in_iso($query->param('firstacquidate'));
323
    my $firstacquidate  = format_date_in_iso($query->param('firstacquidate'));
Lines 270-276 sub redirect_add_subscription { Link Here
270
					$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
334
					$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
271
					$numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity),
335
					$numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity),
272
                    $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
336
                    $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
273
                    $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate
337
                    $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate, $itemtype, $support, $origin, $domain, $previousitemtype
274
				);
338
				);
275
    ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
339
    ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
276
340
Lines 326-331 sub redirect_mod_subscription { Link Here
326
    my $letter = $query->param('letter');
390
    my $letter = $query->param('letter');
327
    my $manualhistory = $query->param('manualhist');
391
    my $manualhistory = $query->param('manualhist');
328
    my $serialsadditems = $query->param('serialsadditems');
392
    my $serialsadditems = $query->param('serialsadditems');
393
    my $itemtype = $query->param('itemtype');
394
    my $support = $query->param('support');
395
    my $origin = $query->param('origin');
396
    my $domain = $query->param('domain');
397
    my $previousitemtype = $query->param('previousitemtype');
398
329
    # subscription history
399
    # subscription history
330
    my $histenddate = format_date_in_iso($query->param('histenddate'));
400
    my $histenddate = format_date_in_iso($query->param('histenddate'));
331
    my $histstartdate = format_date_in_iso($query->param('histstartdate'));
401
    my $histstartdate = format_date_in_iso($query->param('histstartdate'));
Lines 356-364 sub redirect_mod_subscription { Link Here
356
            $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
426
            $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
357
            $numberingmethod, $status,       $biblionumber,   $callnumber,
427
            $numberingmethod, $status,       $biblionumber,   $callnumber,
358
            $notes,           $letter,       $hemisphere,     $manualhistory,$internalnotes,
428
            $notes,           $letter,       $hemisphere,     $manualhistory,$internalnotes,
359
            $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid
429
            $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate, $itemtype, $support, $origin, $domain, $previousitemtype, $subscriptionid
360
        );
430
        );
361
        ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
431
        ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
432
433
362
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
434
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
363
    return;
435
    return;
364
}
436
}
(-)a/t/db_dependent/Serials.t (-2 / +3 lines)
Lines 37-43 if ($subscriptioninformation->{periodicity} % 16==0){ Link Here
37
        whenmorethan1,   setto1,          lastvalue1,        innerloop1,       add2,          every2,      whenmorethan2, setto2,
37
        whenmorethan1,   setto1,          lastvalue1,        innerloop1,       add2,          every2,      whenmorethan2, setto2,
38
        lastvalue2,      innerloop2,      add3,              every3,           whenmorethan3, setto3,      lastvalue3,    innerloop3,
38
        lastvalue2,      innerloop2,      add3,              every3,           whenmorethan3, setto3,      lastvalue3,    innerloop3,
39
        numberingmethod, status,          biblionumber,      callnumber,       notes,         letter,      hemisphere,    manualhistory,
39
        numberingmethod, status,          biblionumber,      callnumber,       notes,         letter,      hemisphere,    manualhistory,
40
        internalnotes,   serialsadditems, staffdisplaycount, opacdisplaycount, graceperiod,   location,    enddate,       subscriptionid
40
        internalnotes,   serialsadditems, staffdisplaycount, opacdisplaycount, graceperiod,   location,    enddate,       
41
	itemtype,        support,         origin,            domain,           previousitemtype,
42
	subscriptionid
41
)});
43
)});
42
}
44
}
43
my $expirationdate = GetExpirationDate(1) ;
45
my $expirationdate = GetExpirationDate(1) ;
44
- 

Return to bug 7677