[Koha-patches] [PATCH 1/1] bug_5787: moved OPACItemHolds to issuingrules
Srdjan Jankovic
srdjan at catalyst.net.nz
Fri Jul 22 09:31:49 CEST 2011
---
C4/Auth.pm | 1 -
C4/Reserves.pm | 55 +++++++++++++++
admin/smart-rules.pl | 9 ++-
admin/systempreferences.pl | 1 -
installer/data/mysql/de-DE/mandatory/sysprefs.sql | 1 -
installer/data/mysql/en/mandatory/sysprefs.sql | 1 -
.../1-Obligatoire/unimarc_standard_systemprefs.sql | 1 -
installer/data/mysql/it-IT/necessari/sysprefs.sql | 1 -
.../data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql | 1 -
installer/data/mysql/pl-PL/mandatory/sysprefs.sql | 1 -
...m_preferences_full_optimal_for_install_only.sql | 1 -
...ystem_preferences_only_translation_updating.sql | 3 -
...m_preferences_full_optimal_for_install_only.sql | 1 -
...ystem_preferences_only_translation_updating.sql | 3 -
installer/data/mysql/updatedatabase.pl | 16 ++++
.../prog/en/modules/admin/preferences/opac.pref | 6 --
.../prog/en/modules/admin/smart-rules.tt | 3 +
.../opac-tmpl/prog/en/modules/opac-reserve.tt | 74 +++++++------------
opac/opac-reserve.pl | 13 +++-
19 files changed, 115 insertions(+), 77 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index f580e53..2133a35 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -421,7 +421,6 @@ sub get_template_and_user {
OPACAmazonReviews => C4::Context->preference("OPACAmazonReviews"),
OPACFRBRizeEditions => C4::Context->preference("OPACFRBRizeEditions"),
OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"),
- OPACItemHolds => C4::Context->preference("OPACItemHolds"),
OPACShelfBrowser => "". C4::Context->preference("OPACShelfBrowser"),
OPACURLOpenInNewWindow => "" . C4::Context->preference("OPACURLOpenInNewWindow"),
OPACUserCSS => "". C4::Context->preference("OPACUserCSS"),
diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index 8373840..ddb69ec 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -117,6 +117,8 @@ BEGIN {
&CancelExpiredReserves
&IsAvailableForItemLevelRequest
+
+ &OPACItemHoldsAllowed
&AlterPriority
&ToggleLowestPriority
@@ -1794,6 +1796,59 @@ sub _ShiftPriorityByDateAndPriority {
return $new_priority; # so the caller knows what priority they wind up receiving
}
+=head2 OPACItemHoldsAllowed
+
+ OPACItemHoldsAllowed($item_record,$borrower_record);
+
+Checks issuingrules, using the borrowers categorycode, the itemtype, and branchcode to see
+if specific item holds are allowed, returns true if so.
+
+=cut
+
+sub OPACItemHoldsAllowed {
+ my ($item,$borrower) = @_;
+
+ my $branchcode = $item->{homebranch} or die "No homebranch";
+ my $itype;
+ my $dbh = C4::Context->dbh;
+ if (C4::Context->preference('item-level_itypes')) {
+ # We cant trust GetItem to honour the syspref, so safest to do it ourselves
+ # When GetItem is fixed, we can remove this
+ $itype = $item->{itype};
+ }
+ else {
+ my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? ";
+ my $sth = $dbh->prepare($query);
+ $sth->execute($item->{biblioitemnumber});
+ if (my $data = $sth->fetchrow_hashref()){
+ $itype = $data->{itemtype};
+ }
+ }
+
+ my $query = "SELECT opacitemholds,categorycode,itemtype,branchcode FROM issuingrules WHERE
+ (issuingrules.categorycode = ? OR issuingrules.categorycode = '*')
+ AND
+ (issuingrules.itemtype = ? OR issuingrules.itemtype = '*')
+ AND
+ (issuingrules.branchcode = ? OR issuingrules.branchcode = '*')
+ ORDER BY
+ issuingrules.categorycode desc,
+ issuingrules.itemtype desc,
+ issuingrules.branchcode desc
+ LIMIT 1";
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare($query);
+ $sth->execute($borrower->{categorycode},$itype,$branchcode);
+ my $data = $sth->fetchrow_hashref;
+ if ($data->{opacitemholds}){
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+
=head1 AUTHOR
Koha Development Team <http://koha-community.org/>
diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl
index f290934..f8ae2c5 100755
--- a/admin/smart-rules.pl
+++ b/admin/smart-rules.pl
@@ -101,8 +101,8 @@ elsif ($op eq 'delete-branch-item') {
# save the values entered
elsif ($op eq 'add') {
my $sth_search = $dbh->prepare("SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?");
- my $sth_insert = $dbh->prepare("INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
- my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, hardduedate=?, hardduedatecompare=?, rentaldiscount=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
+ my $sth_insert = $dbh->prepare("INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod, rentaldiscount, opacitemholds) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+ my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, opacitemholds=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
my $br = $branch; # branch
my $bor = $input->param('categorycode'); # borrower category
@@ -121,14 +121,15 @@ elsif ($op eq 'add') {
$hardduedate = format_date_in_iso($hardduedate);
my $hardduedatecompare = $input->param('hardduedatecompare');
my $rentaldiscount = $input->param('rentaldiscount');
+ my $opacitemholds = $input->param('opacitemholds');
$debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty";
$sth_search->execute($br,$bor,$cat);
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
- $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$hardduedate,$hardduedatecompare,$rentaldiscount, $br,$bor,$cat);
+ $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$hardduedate,$hardduedatecompare,$rentaldiscount, $opacitemholds, $br,$bor,$cat);
} else {
- $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount);
+ $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount, $opacitemholds);
}
}
elsif ($op eq "set-branch-defaults") {
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 87ecac4..58cb214 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -373,7 +373,6 @@ $tabsysprefs{suggestion} = "OPAC";
$tabsysprefs{OpacTopissue} = "OPAC";
$tabsysprefs{OpacBrowser} = "OPAC";
$tabsysprefs{OpacRenewalAllowed} = "OPAC";
-$tabsysprefs{OPACItemHolds} = "OPAC";
$tabsysprefs{OPACGroupResults} = "OPAC";
$tabsysprefs{XSLTDetailsDisplay} = "OPAC";
$tabsysprefs{XSLTResultsDisplay} = "OPAC";
diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
index 6eb67a3..f424616 100755
--- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql
+++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
@@ -184,7 +184,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:ConfFile','','If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.',NULL,'File');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo');
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Use extended patron IDs and attributes',NULL,'YesNo');
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 0abf9d8..af46f3b 100755
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -186,7 +186,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:ConfFile','','If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.',NULL,'File');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo');
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Use extended patron IDs and attributes',NULL,'YesNo');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index 59a258f..acc9589 100755
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -184,7 +184,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesCalendar',"noFinesWhenClosed",'Spécifie l''utilisation du calendrier pour le calcul des dates de retours et les amendes',"ignoreCalendar|noFinesWhenClosed",'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('previousIssuesDefaultSortOrder',"asc",'Ordre d''affichage des prêts en cours sur la page de circulation hors prêts du jour',"asc|desc",'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('todaysIssuesDefaultSortOrder',"desc",'Ordre d''affichage des prêts en cours (prêts du jour)',"asc|desc",'Choice');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Si activé, les adhérents peuvent placer des réservations sur un exemplaire spécifique. Sinon, il ne peuvent que réserver le prochain disponible.','','YesNo');
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Slectionner categorycode ou category_type permet d''afficher la liste des catégories ou des types de catégories à l''ajout d''un lecteur');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Utiliser les attributs étendus pour les adhérents',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RenewSerialAddsSuggestion','0','Si activé, génère une suggestion d''achat à chaque Renouvellement d''abonnement',NULL,'YesNo');
diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql b/installer/data/mysql/it-IT/necessari/sysprefs.sql
index dcdf0ee..9b4231d 100755
--- a/installer/data/mysql/it-IT/necessari/sysprefs.sql
+++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql
@@ -124,7 +124,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('OPACFRBRizeEditions','1','','Se ON, Koha farà delle richieste a uno o più ISBN web services per trovare gli ISBN associabili e li visualizzarà in un tab \'Edizioni\' nella visualizzazione dettagliata','YesNo');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('opacheader','','70|10','Inserire qui HTML da includere come header nell\'OPAC','Textarea');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('OpacHighlightedWords','1','','Se impostato, le parole cercate nell\'OPAC vengono poi evidenziate ','YesNo');
-insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('OPACItemHolds','1','','Consente agli utenti dell\'OPAC di inserire prenotazioni su specifici documenti. Se INATTIVO, gli utenti possono solo richiedere la copia dopo che è tornata ad essere disponibile.','YesNo');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('OPACItemsResultsDisplay','statuses','statuses|itemdetails','statuses : mostra solo lo status dei documenti presenti nella lista del risultato. itemdisplay : mostra tutti i dati della collocazione di tali documenti (sottobiblioteca+collocazione) così come appaiono nell\'interfaccia dello staff','Choice');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('opaclanguages','en,it-IT','','Per impostare la lingua di default dell\'OPAC.','Languages');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('opaclanguagesdisplay','1','','Se su ON, consente di visualizzare nell\'OPAC la funzione Modifica Lingua','YesNo');
diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql
index ca71769..56dd9e3 100644
--- a/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql
+++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql
@@ -202,7 +202,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:ConfFile','','If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.',NULL,'File');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo');
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Use extended patron IDs and attributes',NULL,'YesNo');
diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
index 58ba035..ec435f1 100755
--- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
+++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
@@ -183,7 +183,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH','0','if ON, OAI-PMH server is enabled',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo');
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Use extended patron IDs and attributes',NULL,'YesNo');
diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
index 54c533c..6c5a370 100755
--- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
+++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
@@ -210,7 +210,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH','0','if ON, OAI-PMH server is enabled',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo');
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','1','Use extended patron IDs and attributes',NULL,'YesNo');
diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_only_translation_updating.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_only_translation_updating.sql
index b3bb4e5..150af6d 100644
--- a/installer/data/mysql/ru-RU/mandatory/system_preferences_only_translation_updating.sql
+++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_only_translation_updating.sql
@@ -400,9 +400,6 @@ UPDATE systempreferences SET explanation='ÐÑли ÑÑÑановлено, вÑ
-- UPDATE systempreferences SET explanation='' WHERE variable='OpacHighlightedWords';
-- If Set, then queried words are higlighted in OPAC
--- UPDATE systempreferences SET explanation='' WHERE variable='OPACItemHolds';
--- Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.
-
-- UPDATE systempreferences SET explanation='URL-поÑÐ¸Ð»Ð°Ð½Ð½Ñ ÑаблиÑÑ ÑÑилÑв Ð´Ð»Ñ ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑÐ²Ð°Ð½Ð½Ñ ÑÑоÑÑнок Ð´Ð»Ñ ÐµÐ»ÐµÐºÑÑонÑÑного каÑалогÑ' WHERE variable='opaclayoutstylesheet';
-- Enter the name of the layout CSS stylesheet to use in the OPAC
diff --git a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
index 9f095ab..16d49ee 100755
--- a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
+++ b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
@@ -235,7 +235,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH','0','if ON, OAI-PMH server is enabled',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo');
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','1','Use extended patron IDs and attributes',NULL,'YesNo');
diff --git a/installer/data/mysql/uk-UA/mandatory/system_preferences_only_translation_updating.sql b/installer/data/mysql/uk-UA/mandatory/system_preferences_only_translation_updating.sql
index 5d760a8..b71c109 100644
--- a/installer/data/mysql/uk-UA/mandatory/system_preferences_only_translation_updating.sql
+++ b/installer/data/mysql/uk-UA/mandatory/system_preferences_only_translation_updating.sql
@@ -399,9 +399,6 @@ UPDATE systempreferences SET explanation='ЯкÑо вÑÑановлено, ви
-- UPDATE systempreferences SET explanation='ЯкÑо ÑвÑмкнÑÑо, Ñо ' WHERE variable='OpacHighlightedWords';
-- If Set, then queried words are higlighted in OPAC
--- UPDATE systempreferences SET explanation='' WHERE variable='OPACItemHolds';
--- Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.
-
-- UPDATE systempreferences SET explanation='URL-поÑÐ¸Ð»Ð°Ð½Ð½Ñ ÑаблиÑÑ ÑÑилÑв Ð´Ð»Ñ ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑÐ²Ð°Ð½Ð½Ñ ÑÑоÑÑнок Ð´Ð»Ñ ÐµÐ»ÐµÐºÑÑонÑÑного каÑалогÑ' WHERE variable='opaclayoutstylesheet';
-- Enter the name of the layout CSS stylesheet to use in the OPAC
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 9cbc8db..84ae790 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4370,6 +4370,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion($DBversion);
}
+$DBversion = '3.05.00.XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ print "Upgrade to $DBversion done (Bug 5787 move OPACItemHolds system preference to circulation matrix)\n";
+ # First create the column
+ $dbh->do("ALTER TABLE issuingrules ADD opacitemholds BOOLEAN");
+ # Now update the column
+ if (C4::Context->preference("OPACItemHolds")){
+ # Pref is on, set allow for all rules
+ $dbh->do("UPDATE issuingrules SET opacitemholds=1");
+ }
+ # If the preference is not set, leave off
+ # Remove from the systempreferences table
+ $dbh->do("DELETE FROM systempreferences WHERE variable = 'OPACItemHolds'");
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index f4be568..fa0ab77 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -295,12 +295,6 @@ OPAC:
# choices:
# - If ON, enables subject cloud on OPAC
-
- - pref: OPACItemHolds
- choices:
- yes: Allow
- no: "Don't allow"
- - patrons to place holds on specific items in the OPAC. If this is disabled, users can only put a hold on the next available item.
- -
- pref: OpacRenewalAllowed
choices:
yes: Allow
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
index 0edcece..6d04802 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
@@ -81,6 +81,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
<th>Renewals Allowed (count)</th>
<th>Holds Allowed (count)</th>
<th>Rental Discount (%)</th>
+ <th>Allow OPAC Users to place Holds on Items</th>
<th> </th>
</tr>
[% FOREACH rule IN rules %]
@@ -122,6 +123,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
<td>[% rule.renewalsallowed %]</td>
<td>[% rule.reservesallowed %]</td>
<td>[% rule.rentaldiscount %]</td>
+ <td>[% IF rule.opacitemholds %]Yes[% ELSE %]No[% END %]</td>
<td>
<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]">Delete</a>
</td>
@@ -176,6 +178,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
<td><input name="renewalsallowed" size="2" /></td>
<td><input name="reservesallowed" size="2" /></td>
<td><input name="rentaldiscount" size="2" /></td>
+ <td><input type="checkbox" name="opacitemholds" value="1" /></td>
<td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
</tr>
</table>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
index 25e9a3a..8d41466 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
@@ -242,9 +242,7 @@
<th>Hold Starts on Date</th>
[% END %]
<th>Hold Not Needed After</th>
- [% IF ( OPACItemHolds ) %]
- <th id="place_on_hdr" style="display:none">Place On</th>
- [% END %]
+ <th id="place_on_hdr" style="display:none">Place On</th>
[% UNLESS ( singleBranchMode ) %]
[% IF ( choose_branch ) %]
<th>Pickup Location</th>
@@ -374,50 +372,32 @@
<a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear Date</a></p>
</td>[% END %]
- [% IF ( bibitemloo.holdable ) %]
+ [% IF ( bibitemloo.holdable ) %]
<!-- HOLD ABLE -->
- [% IF ( OPACItemHolds ) %]
+ [% IF ( bibitemloo.opacitemholds ) %]
<!-- ITEM HOLDS -->
- <td class="place_on_type" style="display:none">
- <ul>
- <li>
- [% UNLESS ( bibitemloo.holdable ) %]
- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
- id="reqany_[% bibitemloo.biblionumber %]"
- class="selectany"
- value="Any"
- disabled="disabled"
- />
- [% ELSE %]
- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
- id="reqany_[% bibitemloo.biblionumber %]"
- class="selectany"
- value="Any"
- checked="checked"
- />
- [% END %]
- <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
- </li>
- <li>
- [% UNLESS ( bibitemloo.holdable ) %]
- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
- id="reqspecific_[% bibitemloo.biblionumber %]"
- class="selectspecific"
- disabled="disabled"
- value="Specific"
- />
- [% ELSE %]
- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
- id="reqspecific_[% bibitemloo.biblionumber %]"
- class="selectspecific"
- value="Specific"
- />
- [% END %]
- <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
- </li>
- </ul>
- </td>
- [% END %][% END %]
+ <td class="place_on_type" style="display:none">
+ <ul>
+ <li>
+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
+ id="reqany_[% bibitemloo.biblionumber %]"
+ class="selectany"
+ value="Any"
+ checked="checked"
+ />
+ <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
+ </li>
+ <li>
+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
+ id="reqspecific_[% bibitemloo.biblionumber %]"
+ class="selectspecific"
+ value="Specific"
+ />
+ <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
+ </li>
+ </ul>
+ </td>
+ [% END %][% END %]
[% UNLESS ( singleBranchMode ) %]
[% IF ( bibitemloo.holdable ) %]
@@ -439,7 +419,7 @@
[% END %]
</tr>
- [% IF ( OPACItemHolds ) %]
+ [% IF ( bibitemloo.opacitemholds ) %]
[% IF ( bibitemloo.holdable ) %]
<tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
<td> </td>
@@ -520,7 +500,7 @@
</td>
</tr>
[% END %]<!-- bib_available -->
- [% END %]<!-- OPACItemHolds -->
+ [% END %]<!-- bibitemloo.opacitemholds -->
[% END %]
</table><!-- bibitemloop -->
[% END %] <!-- if message -->
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index a92a976..6e2414d 100755
--- a/opac/opac-reserve.pl
+++ b/opac/opac-reserve.pl
@@ -344,6 +344,7 @@ foreach my $biblioNum (@biblionumbers) {
$biblioLoopIter{itemLoop} = [];
my $numCopiesAvailable = 0;
+ my $numCopiesOPACAvailable = 0;
foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
my $itemNum = $itemInfo->{itemnumber};
my $itemLoopIter = {};
@@ -432,8 +433,13 @@ foreach my $biblioNum (@biblionumbers) {
$policy_holdallowed = 0;
}
+ $itemLoopIter->{opacitemholds} = OPACItemHoldsAllowed( $itemInfo, $borr );
+
if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum)) {
- $itemLoopIter->{available} = 1;
+ if ($itemLoopIter->{opacitemholds}) {
+ $itemLoopIter->{available} = 1;
+ $numCopiesOPACAvailable++;
+ }
$numCopiesAvailable++;
}
@@ -459,10 +465,12 @@ foreach my $biblioNum (@biblionumbers) {
$numBibsAvailable++;
$biblioLoopIter{bib_available} = 1;
$biblioLoopIter{holdable} = 1;
+ $biblioLoopIter{itemholdable} = 1 if $numCopiesOPACAvailable;
$anyholdable = 1;
}
if ($biblioLoopIter{already_reserved}) {
$biblioLoopIter{holdable} = undef;
+ $biblioLoopIter{itemholdable} = undef;
$anyholdable = undef;
}
if(not CanBookBeReserved($borrowernumber,$biblioNum)){
@@ -478,9 +486,6 @@ if ( $numBibsAvailable == 0 || !$anyholdable) {
}
my $itemTableColspan = 7;
-if (! $template->{VARS}->{'OPACItemHolds'}) {
- $itemTableColspan--;
-}
if (! $template->{VARS}->{'singleBranchMode'}) {
$itemTableColspan--;
}
--
1.6.5
More information about the Koha-patches
mailing list