From da49fc77df905ca616999cda08e9cde37d56242e Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 29 Oct 2009 15:29:04 +0100 Subject: [PATCH] 3736 enh : Adding syspref RoutingListAddReserves Adding syspref RoutingListAddReserves Using it in routing-preview --- admin/systempreferences.pl | 1 + .../data/mysql/en/mandatory/sysprefs.sql | 1 + .../unimarc_standard_systemprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 125 ++---------------- serials/routing-preview.pl | 55 ++++---- 5 files changed, 40 insertions(+), 143 deletions(-) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index fa7c749549..b7e1df46e2 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -354,6 +354,7 @@ $tabsysprefs{XSLTResultsDisplay} = "OPAC"; $tabsysprefs{OPACShowCheckoutName} = "OPAC"; # Serials +$tabsysprefs{RoutingListAddReserves} = "Serials"; $tabsysprefs{OPACSerialIssueDisplayCount} = "Serials"; $tabsysprefs{StaffSerialIssueDisplayCount} = "Serials"; $tabsysprefs{OPACDisplayExtendedSubInfo} = "Serials"; diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index c2c28b21ca..d6e5e7ef6a 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -269,3 +269,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('S INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnableOpacSearchHistory', '1', 'Enable or disable opac search history', 'YesNo','') INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACPatronDetails','1','If OFF the patron details tab in the OPAC is disabled.','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFinesTab','1','If OFF the patron fines tab in the OPAC is disabled.','','YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingListAddReserves','1','If ON the patrons on routing lists are automatically added to holds on the issue.','','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 749d0e04a1..588e365548 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -269,3 +269,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'Si activé, affiche la photo de l''adhérent lors de l''utilisation de la console de prêt auto-contrôlé', '', 'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnableOpacSearchHistory', '1', 'Enable or disable opac search history', 'YesNo','') INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacSerialDefaultTab', 'serialcollection', 'Ce paramètre définit l''onglet par défaut pour l''affichage des périodiques dans l''OPAC.', 'holdings|serialcollection|subscriptions', 'Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingListAddReserves','1','Si activé, des reservations sont automatiquement créées pour chaque lecteur de la liste de circulation d''un numéro de périodique','','YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e8b2b6929b..3da9499f3e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3105,126 +3105,19 @@ $dbh->do(" $DBversion = "3.01.00.120"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { -$dbh->do(<<'ISBDUPDATE'); -UPDATE `koha`.`systempreferences` SET `value` = '#200|

|{200a}{. 200c}{ = 200d}{ : 200e}{. 200h}{. 200i}{ / 200f}{ ; 200g }| -#205|. - |{205a}{ / 205f}| -#210|. - |{ 210a }{ : 210c }{, 210d}| - -#461|. - Extrait de : | chercher{461t}{, 461x }{ ; 461v}{, 461h}{, 461p}| - -#461||{ 461c}| - -#215|. - |{215a}{ : 215c}{ ; 215d}{ + 215e}| - -#225| - | ( recherche cat{225a}{ = 225d}{ : 225e}{. 225h}{. 225i}{ / 225f}{, 225x}{ ; 225v}) | - -#200|||

- -#010|

|ISBN {010a}{ (010b)}. - |

- -#300|

|{300a}|

- -#320|

|{ 320a}|

- -#327|

|{ 327a}|

- -#328|

|{ 328a}|

- -#454|

Traduit de : |{ "454t"}{. 454e}{. 454c}{, 454d}|

- - - -#200|
|

Auteurs : | - -#700|| recherche cat{700c}{ 700b}{ 700a}{ 700d}{ (700f)}{. 7004} --| - -#701|| recherche cat{701c}{ 701b}{ 701a}{ 701d}{ (701f)}{. 7014} --| - -#702|| recherche cat{702c}{ 702b}{ 702a}{ 702d}{ (702f)}{. 7024} --|

- - - -#710|

Collectivités : | recherche cat{710a}{ (710c)}{. 710b} ({710d ;}{ 710f ; }{710e}) --| - -#711| Collectivités : | recherche cat{711a}{ (711c)}{. 711b} ({711d ;}{ 711f ; }{711e}) --|

- -#712|

Collectivités : | recherche cat{712a}{ (712c)}{. 712b} ({712d ;}{ 712f ; }{712e}){. 7124} --|

- -#500|

|{[500a}{ (500m)}{. 500k}] --|

- -#503|

|{[503a}{. 503b}{. 503m}{, 503n}{. 503j}{. 503e}{, 503f}] --|

- -#312|

|{312a} --|

- - - -#200||
| - -#856|

URL : |{856u} {(856e)}|

- -#200|
|

| - -#600||recherche cat { 600c}{ 600b }{600a}{ 600d}{ (600f)} {. 6004} --
| - -#601||{601a}{ (601c)}{. 601b}{ : 601d} { ; 601f}{ ; 601e}{ -- 601x }{-- 601z }{-- 601y}
| - -#605||{605a}{. 605i}{. 605h}{. 605k}{. 605m}{. 605q} {-- 605x }{-- 605z }{-- 605y }{-- 605l}
| - - - -#630|

|{630a} -- |

- -#606|

Sujets : |{606a}{-- 606x }{-- 606z }{606y } -- |

- -#631|

Peuples : |{631a}{-- 631x }{-- 631z }{631y } -- |

- -#632|

Anthrop. : |{632a}{-- 632x }{-- 632z }{632y } -- |

- -#634|

Chrono : |{634a}{-- 634x }{-- 634z }{634y } -- |

- -#637|

Topo : |{637a} -- |

- -#633|

Oeuvres : |{633a}{-- 633x }{-- 633z }{633y } -- |

- -#607|

Lieux : |{607a}{-- 607x }{-- 607z }{607y } -- |

- - - -#200||

Mots libres: | - -#641||{641a} | - -#642||{642a} | - -#644||{646a} -- | - -#610||{ 610a} -- |
- - - -#011|

|{011a }{ (011b)}.|

- - - -#330|

|Résumé : {330a}
|

- -#200|
|

Exemplaires

| - -#200||| - -#995||| - -#200|||
LocalisationCoteStatutFonds
{995c} {995k} {995o} {995s}
' - - WHERE `systempreferences`.`variable` = 'isbd' LIMIT 1 ; -ISBDUPDATE - + if (C4::Context->preference("opaclanguages") eq "fr") { + $dbh->do(qq{ +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingListAddReserves','1','Si activé, des reservations sont automatiquement créées pour chaque lecteur de la liste de circulation d''un numéro de périodique','','YesNo'); + }); + }else{ + $dbh->do(qq{ +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingListAddReserves','1','If ON the patrons on routing lists are automatically added to holds on the issue.','','YesNo'); + }); + } print "Upgrade to $DBversion done (isbd updated)\n"; SetVersion ($DBversion); } - - =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl index 16dd7136c6..2ec03002ef 100755 --- a/serials/routing-preview.pl +++ b/serials/routing-preview.pl @@ -50,34 +50,35 @@ if($ok){ # get biblio information.... my $biblio = $subs->{'biblionumber'}; - # get existing reserves ..... - my ($count,$reserves) = GetReservesFromBiblionumber($biblio); - my $totalcount = $count; - foreach my $res (@$reserves) { - if ($res->{'found'} eq 'W') { - $count--; - } - } - my ($count2,@bibitems) = GetBiblioItemByBiblioNumber($biblio); - my @itemresults = GetItemsInfo($subs->{'biblionumber'}, 'intra'); - my $branch = $itemresults[0]->{'holdingbranch'}; - my $branchname = GetBranchName($branch); - my $const = 'o'; - my $notes; - my $title = $subs->{'bibliotitle'}; - for(my $i=0;$i<$routing;$i++){ - my $sth = $dbh->prepare("SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ?"); - $sth->execute($biblio,$routinglist[$i]->{'borrowernumber'}); - my $data = $sth->fetchrow_hashref; + if (C4::Context->preference('RoutingListAddReserves')){ + # get existing reserves ..... + my ($count,$reserves) = GetReservesFromBiblionumber($biblio); + my $totalcount = $count; + foreach my $res (@$reserves) { + if ($res->{'found'} eq 'W') { + $count--; + } + } + my ($count2,@bibitems) = GetBiblioItemByBiblioNumber($biblio); + my @itemresults = GetItemsInfo($subs->{'biblionumber'}, 'intra'); + my $branch = $itemresults[0]->{'holdingbranch'}; + my $branchname = GetBranchName($branch); + my $const = 'o'; + my $notes; + my $title = $subs->{'bibliotitle'}; + for(my $i=0;$i<$routing;$i++){ + my $sth = $dbh->prepare("SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ?"); + $sth->execute($biblio,$routinglist[$i]->{'borrowernumber'}); + my $data = $sth->fetchrow_hashref; -# warn "$routinglist[$i]->{'borrowernumber'} is the same as $data->{'borrowernumber'}"; - if($routinglist[$i]->{'borrowernumber'} == $data->{'borrowernumber'}){ - ModReserve($routinglist[$i]->{'ranking'},$biblio,$routinglist[$i]->{'borrowernumber'},$branch); - } else { - AddReserve($branch,$routinglist[$i]->{'borrowernumber'},$biblio,$const,\@bibitems,$routinglist[$i]->{'ranking'},'',$notes,$title); + # warn "$routinglist[$i]->{'borrowernumber'} is the same as $data->{'borrowernumber'}"; + if($routinglist[$i]->{'borrowernumber'} == $data->{'borrowernumber'}){ + ModReserve($routinglist[$i]->{'ranking'},$biblio,$routinglist[$i]->{'borrowernumber'},$branch); + } else { + AddReserve($branch,$routinglist[$i]->{'borrowernumber'},$biblio,$const,\@bibitems,$routinglist[$i]->{'ranking'},'',$notes,$title); + } + } } - } - ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "serials/routing-preview-slip.tmpl", @@ -122,4 +123,4 @@ $template->param( routingnotes => $routingnotes, ); - output_html_with_http_headers $query, $cookie, $template->output; +output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5