&ReNewSubscription &GetLateOrMissingIssues
&GetSerialInformation &AddItem2Serial
&PrepareSerialsData &GetNextExpected &ModNextExpected
+ &GetPreviousSerialid
&GetSuppliersWithLateIssues &getsupplierbyserialid
&GetDistributedTo &SetDistributedTo
return \@serials;
}
+=head2 GetPreviousSerialid
+
+$serialid = GetPreviousSerialid($subscriptionid, $nth)
+get the $nth's previous serial for the given subscriptionid
+return :
+the serialid
+
+=cut
+
+sub GetPreviousSerialid {
+ my ( $subscriptionid, $nth ) = @_;
+ $nth ||= 1;
+ my $dbh = C4::Context->dbh;
+ my $return = undef;
+
+ # Status 2: Arrived
+ my $strsth = "SELECT serialid
+ FROM serial
+ WHERE subscriptionid = ?
+ AND status = 2
+ ORDER BY serialid DESC LIMIT $nth,1
+ ";
+ my $sth = $dbh->prepare($strsth);
+ $sth->execute($subscriptionid);
+ my @serials;
+ my $line = $sth->fetchrow_hashref;
+ $return = $line->{'serialid'} if ($line);
+
+ return $return;
+}
+
+
+
=head2 GetDistributedTo
$distributedto=GetDistributedTo($subscriptionid)
$lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
$biblionumber, $callnumber, $notes, $letter, $manualhistory,
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
- $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq
+ $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
+ $itemtype, $previousitemtype
) = @_;
my $dbh = C4::Context->dbh;
callnumber=?, notes=?, letter=?, manualhistory=?,
internalnotes=?, serialsadditems=?, staffdisplaycount=?,
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
- skip_serialseq=?
+ skip_serialseq=?, itemtype=?, previousitemtype=?
WHERE subscriptionid = ?";
my $sth = $dbh->prepare($query);
$letter, ($manualhistory ? $manualhistory : 0),
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
$graceperiod, $location, $enddate, $skip_serialseq,
+ $itemtype, $previousitemtype,
$subscriptionid
);
my $rows = $sth->rows;
$lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
- $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq);
+ $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
+ $skip_serialseq, $itemtype, $previousitemtype);
Create a new subscription with value given on input args.
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
- $location, $enddate, $skip_serialseq
+ $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype
) = @_;
my $dbh = C4::Context->dbh;
lastvalue3, innerloop3, status, notes, letter, firstacquidate,
irregularity, numberpattern, locale, callnumber,
manualhistory, internalnotes, serialsadditems, staffdisplaycount,
- opacdisplaycount, graceperiod, location, enddate, skip_serialseq)
- VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+ opacdisplaycount, graceperiod, location, enddate, skip_serialseq,
+ itemtype, previousitemtype)
+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|;
my $sth = $dbh->prepare($query);
$sth->execute(
$lastvalue3, $innerloop3, $status, $notes, $letter,
$firstacquidate, $irregularity, $numberpattern, $locale, $callnumber,
$manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
- $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq
+ $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq,
+ $itemtype, $previousitemtype
);
my $subscriptionid = $dbh->{'mysql_insertid'};
--- /dev/null
+ALTER TABLE `subscription` ADD `itemtype` VARCHAR( 10 ) NULL AFTER reneweddate, ADD `previousitemtype` VARCHAR( 10 ) NULL AFTER itemtype;
+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');
`enddate` date default NULL, -- subscription end date
`closed` INT(1) NOT NULL DEFAULT 0, -- yes / no if the subscription is closed
`reneweddate` date default NULL, -- date of last renewal for the subscription
+ `itemtype` VARCHAR( 10 ) NULL,
+ `previousitemtype` VARCHAR( 10 ) NULL,
PRIMARY KEY (`subscriptionid`),
CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`)
ON DELETE CASCADE ON UPDATE CASCADE
+<<<<<<< 85adee702147e7112ed41a440ad4f13d2ed9fd36
+=======
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Table structure for table `suggestions`
+--
+
+DROP TABLE IF EXISTS `suggestions`;
+CREATE TABLE `suggestions` ( -- purchase suggestions
+ `suggestionid` int(8) NOT NULL auto_increment, -- unique identifier assigned automatically by Koha
+ `suggestedby` int(11) NOT NULL default 0, -- borrowernumber for the person making the suggestion, foreign key linking to the borrowers table
+ `suggesteddate` date NOT NULL, -- date the suggestion was submitted
+ `managedby` int(11) default NULL, -- borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table
+ `manageddate` date default NULL, -- date the suggestion was updated
+ acceptedby INT(11) default NULL, -- borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table
+ accepteddate date default NULL, -- date the suggestion was marked as accepted
+ rejectedby INT(11) default NULL, -- borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
+ rejecteddate date default NULL, -- date the suggestion was marked as rejected
+ `STATUS` varchar(10) NOT NULL default '', -- suggestion status (ASKED, CHECKED, ACCEPTED, or REJECTED)
+ `note` mediumtext, -- note entered on the suggestion
+ `author` varchar(80) default NULL, -- author of the suggested item
+ `title` varchar(255) default NULL, -- title of the suggested item
+ `copyrightdate` smallint(6) default NULL, -- copyright date of the suggested item
+ `publishercode` varchar(255) default NULL, -- publisher of the suggested item
+ `date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the suggestion was updated
+ `volumedesc` varchar(255) default NULL,
+ `publicationyear` smallint(6) default 0,
+ `place` varchar(255) default NULL, -- publication place of the suggested item
+ `isbn` varchar(30) default NULL, -- isbn of the suggested item
+ `biblionumber` int(11) default NULL, -- foreign key linking the suggestion to the biblio table after the suggestion has been ordered
+ `reason` text, -- reason for accepting or rejecting the suggestion
+ `patronreason` text, -- reason for making the suggestion
+ budgetid INT(11), -- foreign key linking the suggested budget to the aqbudgets table
+ branchcode VARCHAR(10) default NULL, -- foreign key linking the suggested branch to the branches table
+ collectiontitle text default NULL, -- collection name for the suggested item
+ itemtype VARCHAR(30) default NULL, -- suggested item type
+ quantity SMALLINT(6) default NULL, -- suggested quantity to be purchased
+ currency VARCHAR(3) default NULL, -- suggested currency for the suggested price
+ price DECIMAL(28,6) default NULL, -- suggested price
+ total DECIMAL(28,6) default NULL, -- suggested total cost (price*quantity updated for currency)
+ PRIMARY KEY (`suggestionid`),
+ KEY `suggestedby` (`suggestedby`),
+ KEY `managedby` (`managedby`),
+ KEY `status` (`STATUS`),
+ KEY `biblionumber` (`biblionumber`),
+ KEY `branchcode` (`branchcode`),
+ CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE
+>>>>>>> BZ7677: New areas in subscriptions and new functions when receiving.
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
('LocalHoldsPriority', '0', NULL, 'Enables the LocalHoldsPriority feature', 'YesNo'),
('LocalHoldsPriorityItemControl', 'holdingbranch', 'holdingbranch|homebranch', 'decides if the feature operates using the item''s home or holding library.', 'Choice'),
('LocalHoldsPriorityPatronControl', 'PickupLibrary', 'HomeLibrary|PickupLibrary', 'decides if the feature operates using the library set as the patron''s home library, or the library set as the pickup library for the given hold.', 'Choice'),
+('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'),
('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'),
('MARCAuthorityControlField008','|| aca||aabn | a|a d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'),
('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'),
-
- List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)
- pref: SubscriptionDuplicateDroppedInput
+ -
+ - pref: makePreviousSerialAvailable
+ choices:
+ yes: Make
+ no: Do not make
+ - previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.
subfield_div = $(item_div).find("input[name='kohafield'][value='items.enumchron']").parent();
// Setting text field
$(subfield_div).children("input[type='text'][name='field_value']").val($("#serialseq" + serialId).val());
-
}
function HideItems(index,labelindex) {
subfield = document.getElementById(index);
</select>
</li>
<li>
+ <label for="itemtype">Item type:</label>
+ <select name="itemtype" id="itemtype">
+ <option value=""></option>
+ [% FOREACH type IN typeloop %]
+ [% IF ( type.selected ) %]
+ <option value="[% type.code %]" selected="selected">[% type.value %]</option>
+ [% ELSE %]
+ <option value="[% type.code %]">[% type.value %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ [%IF makePreviousSerialAvailable %]
+ <li>
+ <label for="previousitemtype">Previous item type:</label>
+ <select name="previousitemtype" id="previousitemtype">
+ <option value=""></option>
+ [% FOREACH previous IN previoustypeloop %]
+ [% IF ( previous.selected ) %]
+ <option value="[% previous.code %]" selected="selected">[% previous.value %]</option>
+ [% ELSE %]
+ <option value="[% previous.code %]">[% previous.value %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ [% END %]
+ <li>
<label for="graceperiod">Grace period:</label>
<input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod %]" size="5"/> day(s)
</li>
}
my @errors;
my @errseq;
+my $dbh = C4::Context->dbh;
# If user comes from subscription details
unless (@serialids) {
$notes[$i]
);
}
+ my $makePreviousSerialAvailable = C4::Context->preference('makePreviousSerialAvailable');
+ if ($makePreviousSerialAvailable && $serialids[$i] ne "NEW") {
+ # We already have created the new expected serial at this point, so we get the second previous serial
+ my $previous = GetPreviousSerialid($subscriptionids[$i]);
+ if ($previous) {
+
+ # Getting the itemnumber matching the serialid
+ my $query = "SELECT itemnumber FROM serialitems WHERE serialid=?";
+ my $sth = $dbh->prepare($query);
+ $sth->execute($previous);
+ my @row = $sth->fetchrow_array;
+ if ($row[0]) {
+ my $itemnumber = $row[0];
+
+ # Getting the itemtype to set from the database
+ my $subscriptioninfos = GetSubscription($subscriptionids[$i]);
+
+ # Changing the status to "available" and the itemtype according to the previousitemtype db field
+ ModItem({notforloan => 0, itype => $subscriptioninfos->{'previousitemtype'} }, undef, $itemnumber);
+ }
+ }
+ }
+
}
my @moditems = $query->multi_param('moditem');
if ( scalar(@moditems) ) {
}
$template->param( additional_fields_for_subscription => $additional_fields );
+my $typeloop = GetItemTypes();
+
+my @typearg =
+ map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{itemtype} and $_ eq $subs->{itemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
+my @previoustypearg =
+ map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{previousitemtype} and $_ eq $subs->{previousitemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
+
+$template->param(
+ branchloop => $branchloop,
+ typeloop => \@typearg,
+ previoustypeloop => \@previoustypearg,
+ locations_loop=>$locations_loop,
+);
+
# prepare template variables common to all $op conditions:
+$template->param('makePreviousSerialAvailable' => 1) if (C4::Context->preference('makePreviousSerialAvailable'));
+
if ($op!~/^mod/) {
my $letters = get_letter_loop();
$template->param( letterloop => $letters );
my $staffdisplaycount = $query->param('staffdisplaycount');
my $opacdisplaycount = $query->param('opacdisplaycount');
my $location = $query->param('location');
+ my $itemtype = $query->param('itemtype');
+ my $previousitemtype = $query->param('previousitemtype');
my $skip_serialseq = $query->param('skip_serialseq');
my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
my $opacdisplaycount = $query->param('opacdisplaycount');
my $graceperiod = $query->param('graceperiod') || 0;
my $location = $query->param('location');
+ my $itemtype = $query->param('itemtype');
+ my $previousitemtype = $query->param('previousitemtype');
my $skip_serialseq = $query->param('skip_serialseq');
# Guess end date
$status, $biblionumber, $callnumber, $notes, $letter,
$manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
$opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
- $skip_serialseq
+ $skip_serialseq, $itemtype, $previousitemtype
);
my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } );