From julian.maurice at biblibre.com Fri Mar 2 14:38:16 2012 From: julian.maurice at biblibre.com (julian.maurice at biblibre.com) Date: Fri, 2 Mar 2012 14:38:16 +0100 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 7493 [REVISED] Deleting a record with comments breaks "Recent Comments" Message-ID: <1330695496-25160-1-git-send-email-julian.maurice@biblibre.com> From: Owen Leonard Adding foreign key constraint on biblio and borrowers: - delete reviews when bibliographic records are deleted - set set reviews.borrowernumber to NULL when patron records are deleted. Before these constraints are set the database update script will clean up existing instances of these problems by deleting reviews of deleted biblios and setting to NULL reviews.borrowernumber for deleted patrons. In comments moderation, the list of comments will indicate "(deleted patron") if the review was submitted by a patron who has since been deleted. In the OPAC display of comments will omit the patron name altogether if the patron has since been deleted. To test: 1. CONFIRM THAT THE DATABASE UPDATE RUNS CORRECTLY Before applying the patch: - delete the record for a title which has a review - delete a patron who has submitted a review (on a different title). Viewing /cgi-bin/koha/opac-showreviews.pl should result in an error. Apply the patch and make sure the database update runs. Viewing the recent comments page in the OPAC should no longer result in an error. The title with the comment from a deleted patron should show no patron name on these pages: - Recent comments (opac-showreviews.pl) - Recent comments RSS (opac-showreviews.pl?format=rss) - Detail page (opac-detail.pl) Comments from other patrons should show correctly. 2. CONFIRM THAT NEW DELETIONS PERFORM CORRECTLY After applying the patch: - delete the record for a title which has a review - delete a patron who has submitted a review (on a different title). Viewing /cgi-bin/koha/opac-showreviews.pl should NOT result in an error. The review of the title which you deleted should no longer appear in the list of recent comments. The title with the comment from a deleted patron should show no patron name on these pages: - Recent comments (opac-showreviews.pl) - Recent comments RSS (opac-showreviews.pl?format=rss) - Detail page (opac-detail.pl) Signed-off-by: Julian Maurice --- installer/data/mysql/kohastructure.sql | 4 +++- installer/data/mysql/updatedatabase.pl | 10 ++++++++++ .../prog/en/modules/reviews/reviewswaiting.tt | 2 +- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 8 ++++---- .../prog/en/modules/opac-showreviews-rss.tt | 2 +- .../opac-tmpl/prog/en/modules/opac-showreviews.tt | 2 +- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 67149c9d..7885867 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1598,7 +1598,9 @@ CREATE TABLE `reviews` ( -- patron opac comments `review` text, -- the body of the comment `approved` tinyint(4) default NULL, -- whether this comment has been approved by a librarian (1 for yes, 0 for no) `datereviewed` datetime default NULL, -- the date the comment was left - PRIMARY KEY (`reviewid`) + PRIMARY KEY (`reviewid`), + CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d6b3fe8..abe474b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4719,6 +4719,16 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.07.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("DELETE FROM reviews WHERE biblionumber NOT IN (SELECT biblionumber from biblio)"); + $dbh->do("UPDATE reviews SET borrowernumber = NULL WHERE borrowernumber NOT IN (SELECT borrowernumber FROM borrowers)"); + $dbh->do("ALTER TABLE reviews ADD CONSTRAINT reviews_ibfk_2 FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE"); + $dbh->do("ALTER TABLE reviews ADD CONSTRAINT reviews_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber ) ON UPDATE CASCADE ON DELETE SET NULL"); + print "Upgrade to $DBversion done (Bug 7493 - Add constraint linking OPAC comment biblionumber to biblio, OPAC comment borrowernumber to borrowers.)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt index a1dabbd..1283a78 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt @@ -44,7 +44,7 @@ [% FOREACH review IN reviews %] - [% review.surname %], [% review.firstname %] + [% IF ( review.borrowernumber ) %][% review.surname %], [% review.firstname %][% ELSE %](deleted patron)[% END %] [% review.bibliotitle %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 25480c8..e77652d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -878,10 +878,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% END %]
- Comment by - [% review.title %] - [% review.firstname %] - [% review.surname %] + Comment [% IF ( review.borrowernumber ) %]by + [% review.title %] + [% review.firstname %] + [% review.surname %][% ELSE %][% END %]
[% END %] [% review.datereviewed %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt index 1ed07f6..42e0fc0 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt @@ -26,7 +26,7 @@ [% IF ( review.notes ) %], [% review.notes |html %][% END %] [% IF ( review.size ) %] [% review.size |html %]. [% END %] [% IF ( review.isbn ) %] [% review.isbn |html %][% END %]

-

[% review.firstname %] [% review.surname %] commented on [% review.datereviewed %]: [% review.review |html %]

+

[% IF ( review.borrowernumber && ShowReviewer ) %][% review.firstname %] [% review.surname %] commented[% ELSE %]Comment[% END %] on [% review.datereviewed %]: [% review.review |html %]

]]> [% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% review.biblionumber %]&reviewid=[% review.reviewid %] [% review.timestamp %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt index fdea679..2f75237 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt @@ -54,7 +54,7 @@ $(document).ready(function(){ [% review.review |html %] [% END %] Added [% review.datereviewed %] [% IF ( review.your_comment ) %] by you[% ELSE %] - [% IF ( ShowReviewer ) %] by + [% IF ( review.borrowernumber && ShowReviewer ) %] by [% review.firstname %] [% review.surname %][% END %][% END %]

-- 1.7.9.1 From julian.maurice at biblibre.com Fri Mar 2 14:39:16 2012 From: julian.maurice at biblibre.com (julian.maurice at biblibre.com) Date: Fri, 2 Mar 2012 14:39:16 +0100 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 7631 - Self checkout renewal fails because of reference to non-existent subroutine in sco-main.pl Message-ID: <1330695556-25238-1-git-send-email-julian.maurice@biblibre.com> From: Owen Leonard Changing "CanBookBeIssuedCheckout" to "CanBookBeIssued" To test, try to renew an item which has no renewals left. Before the patch you'll get an error: Undefined subroutine &main::CanBookBeIssuedCheckout called at /opac/sco/sco-main.pl line 135. After the patch you'll get the correct message about having no renewals left. Other tests: checking out a barcode which doesn't exist, checking out an item which is on hold for another patron. Signed-off-by: Julian Maurice --- opac/sco/sco-main.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 7e4f810..f0ca37e 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -132,7 +132,7 @@ elsif ( $op eq "checkout" ) { my $impossible = {}; my $needconfirm = {}; if ( !$confirmed ) { - ( $impossible, $needconfirm ) = CanBookBeIssuedCheckout( + ( $impossible, $needconfirm ) = CanBookBeIssued( $borrower, $barcode, undef, -- 1.7.9.1 From jonathan.druart at biblibre.com Fri Mar 2 14:41:12 2012 From: jonathan.druart at biblibre.com (Jonathan Druart) Date: Fri, 2 Mar 2012 14:41:12 +0100 Subject: [Koha-patches] =?utf-8?q?=5BPATCH_1/1=5D_Bug_7470=3A_Babeltheque_?= =?utf-8?q?integration?= Message-ID: <1330695672-16536-1-git-send-email-jonathan.druart@biblibre.com> 3 features: - adds social network information in search results - adds babeltheque data in opac-detail - adds social network links in opac-detail too (google+, twitter, mail and co.) --- C4/SocialData.pm | 129 +++++++++++++++++ installer/data/mysql/kohastructure.sql | 16 ++ installer/data/mysql/sysprefs.sql | 4 + installer/data/mysql/updatedatabase.pl | 26 ++++ .../admin/preferences/enhanced_content.pref | 6 + .../en/modules/admin/preferences/searching.pref | 7 + koha-tmpl/opac-tmpl/prog/en/css/opac.css | 152 +++++++++++++++++++- .../opac-tmpl/prog/en/includes/opac-bottom.inc | 4 - koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 59 ++++++-- .../opac-tmpl/prog/en/modules/opac-results.tt | 20 +++ koha-tmpl/opac-tmpl/prog/images/Star0.gif | Bin 0 -> 1360 bytes koha-tmpl/opac-tmpl/prog/images/Star1.gif | Bin 0 -> 1395 bytes koha-tmpl/opac-tmpl/prog/images/Star2.gif | Bin 0 -> 1410 bytes koha-tmpl/opac-tmpl/prog/images/Star3.gif | Bin 0 -> 1391 bytes koha-tmpl/opac-tmpl/prog/images/Star4.gif | Bin 0 -> 1380 bytes koha-tmpl/opac-tmpl/prog/images/Star5.gif | Bin 0 -> 1284 bytes koha-tmpl/opac-tmpl/prog/images/bonus.png | Bin 0 -> 1768 bytes .../opac-tmpl/prog/images/socnet/delicious16.gif | Bin 0 -> 89 bytes .../opac-tmpl/prog/images/socnet/facebook16.png | Bin 0 -> 727 bytes .../opac-tmpl/prog/images/socnet/linkedin16.png | Bin 0 -> 751 bytes .../opac-tmpl/prog/images/socnet/mailto16.png | Bin 0 -> 792 bytes .../opac-tmpl/prog/images/socnet/twitter16.png | Bin 0 -> 780 bytes .../cronjobs/social_data/get_report_social_data.pl | 16 ++ misc/cronjobs/social_data/update_social_data.pl | 16 ++ opac/opac-detail.pl | 7 + opac/opac-search.pl | 19 +++- 26 files changed, 463 insertions(+), 18 deletions(-) create mode 100644 C4/SocialData.pm create mode 100644 koha-tmpl/opac-tmpl/prog/images/Star0.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/Star1.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/Star2.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/Star3.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/Star4.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/Star5.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/bonus.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/socnet/delicious16.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/socnet/facebook16.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/socnet/linkedin16.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/socnet/mailto16.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/socnet/twitter16.png create mode 100644 misc/cronjobs/social_data/get_report_social_data.pl create mode 100644 misc/cronjobs/social_data/update_social_data.pl diff --git a/C4/SocialData.pm b/C4/SocialData.pm new file mode 100644 index 0000000..e8bca90 --- /dev/null +++ b/C4/SocialData.pm @@ -0,0 +1,129 @@ +package C4::SocialData; + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use Modern::Perl; +use C4::Context; +use Business::ISBN; +use C4::Koha; + +=head2 get_data + +Get social data from a biblio + +params: + $isbn = isbn of the biblio (it must be the same in your database, isbn given to babelio) + +returns: + this function returns an hashref with keys + + isbn = isbn + num_critics = number of critics + num_critics_pro = number of profesionnal critics + num_quotations = number of quotations + num_videos = number of videos + score_avg = average score + num_scores = number of score +=cut +sub get_data { + my ( $isbn ) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare( qq{SELECT * FROM social_data WHERE isbn = ? LIMIT 1} ); + $sth->execute( $isbn ); + my $results = $sth->fetchrow_hashref; + + return $results; +} + +=head 2 + +Update Social data + +params: + $url = url containing csv file with data + +data separator : ; (semicolon) +data order : isbn ; active ; critics number , critics pro number ; quotations number ; videos number ; average score ; scores number + +=cut +sub update_data { + my ( $output_filepath ) = @_; + + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare( qq{INSERT INTO social_data ( + `isbn`, `num_critics`, `num_critics_pro`, `num_quotations`, `num_videos`, `score_avg`, `num_scores` + ) VALUES ( ?, ?, ?, ?, ?, ?, ? ) + ON DUPLICATE KEY UPDATE `num_critics`=?, `num_critics_pro`=?, `num_quotations`=?, `num_videos`=?, `score_avg`=?, `num_scores`=? + } ); + + open( FILE, $output_filepath ) or die "File $output_filepath can not be read"; + my $sep = qq{;}; + my $i = 0; + my $unknown = 0; + while ( my $line = ) { + my ( $isbn, $active, $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores ) = split $sep, $line; + next if not $active; + eval { + $sth->execute( $isbn, $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores, + $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores + ); + }; + if ( $@ ) { + warn "Can't insert $isbn ($@)"; + } else { + $i++; + } + } + say "$i data insered or updated"; +} + +=head 2 + +Get social data report + +=cut +sub get_report { + my $dbh = C4::Context->dbh; + + my $sth = $dbh->prepare( qq{ + SELECT biblionumber, isbn FROM biblioitems + } ); + $sth->execute; + my %results; + while ( my ( $biblionumber, $isbn ) = $sth->fetchrow() ) { + push @{ $results{no_isbn} }, { biblionumber => $biblionumber } and next if not $isbn; + my $original_isbn = $isbn; + $isbn =~ s/^\s*(\S*)\s*$/$1/; + $isbn = GetNormalizedISBN( $isbn, undef, undef ); + $isbn = Business::ISBN->new( $isbn ); + next if not $isbn; + eval{ + $isbn = $isbn->as_isbn13->as_string; + }; + next if $@; + $isbn =~ s/-//g; + my $social_datas = C4::SocialData::get_data( $isbn ); + if ( $social_datas ) { + push @{ $results{with} }, { biblionumber => $biblionumber, isbn => $isbn, original => $original_isbn }; + } else { + push @{ $results{without} }, { biblionumber => $biblionumber, isbn => $isbn, original => $original_isbn }; + } + } + return \%results; +} + +1; + diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 67149c9d..773473d 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2687,6 +2687,22 @@ CREATE TABLE `bibliocoverimage` ( CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Table structure for table `social_data` +-- + +DROP TABLE IF EXISTS `social_data`; +CREATE TABLE IF NOT EXISTS `social_data` ( + `isbn` VARCHAR(30), + `num_critics` INT, + `num_critics_pro` INT, + `num_quotations` INT, + `num_videos` INT, + `score_avg` DECIMAL(5,2), + `num_scores` INT, + PRIMARY KEY (`isbn`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 20c880c..5075321 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -337,3 +337,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AllowItemsOnHoldCheckout',0,'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacExportOptions','bibtex|dc|marcxml|marc8|utf8|marcstd|mods|ris','Define export options available on OPAC detail page.','','free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('Babeltheque_url_js','','Url for Babeltheque javascript (e.g. http://www.babeltheque.com/bw_XX.js)','','Free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('Babeltheque_url_update', '', 'Url for Babeltheque update (E.G. http://www.babeltheque.com/.../file.csv.bz2)', '', 'Free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo'); + diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d6b3fe8..395a2dd 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4719,6 +4719,32 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.07.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do( qq{INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Babeltheque_url_js','','Url for Babeltheque javascript (e.g. http://www.babeltheque.com/bw_XX.js','','Free')} ); + $dbh->do( qq{CREATE TABLE IF NOT EXISTS `social_data` + ( `isbn` VARCHAR(30), + `num_critics` INT, + `num_critics_pro` INT, + `num_quotations` INT, + `num_videos` INT, + `score_avg` DECIMAL(5,2), + `num_scores` INT, + PRIMARY KEY (`isbn`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 + } ); + $dbh->do( qq{INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('Babeltheque_url_update', '', 'Url for Babeltheque update (E.G. http://www.babeltheque.com/.../file.csv.bz2)', '', 'Free')} ); + print "Upgrade to $DBversion done (added syspref and table for babeltheque (Babeltheque_url_js, babeltheque))\n"; + SetVersion($DBversion); +} + +$DBversion = "3.07.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do( qq{INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SocialNetworks','1','Enable/Disable social networks links in opac detail','','YesNo')} ); + print "Upgrade to $DBversion done (added syspref Social_networks)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref index f5828ae..bb3bc2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref @@ -103,6 +103,12 @@ Enhanced Content: yes: Do no: "Don't" - include information (such as reviews and citations) from Babelth?que in item detail pages on the OPAC. + - + - pref: Babeltheque_url_js + - Defined the url for the Babeltheque javascript file (eg. http://www.babeltheque.com/bw_XX.js) + - + - pref: Babeltheque_url_update + - Defined the url for the Babeltheque update periodically (eq. http://www.babeltheque.com/.../file.csv.bz2). Baker and Taylor: - - pref: BakerTaylorEnabled diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref index 12075ec..6934e63 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -69,6 +69,13 @@ Searching: yes: Include no: "Don't include" - subdivisions for searches generated by clicking on subject tracings. + - + - pref: SocialNetworks + default: 0 + choices: + yes: Enable + no: Disable + - Enable/Disable social network links in opac detail pages Search Form: - - Show checkboxes to search by diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index f2b1467..7ee950c 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -2309,4 +2309,154 @@ a.localimage img { border : 1px solid #8EB3E7; margin : 0 .5em; padding : .3em; -} \ No newline at end of file +} + +/* ## BABELTHEQUE ##?*/ +/* Uncomment if babeltheque configuration no contains these lines */ +/* +#BW_etiquettes { + clear :left; + border: 1px solid #E8E8E8; + margin-top: 10px; + width: 49%; + float: left; + visibility: hidden; + visibility: visible\9; +} +#BW_etiquettes:not(:empty) { + visibility: visible; +} + +#BW_etiquettes h2 { + clear:left; + background-color: #E8E8E8; + margin: 5px 10px; + padding: 0 5px; +} + +#BW_ulEti {max-width:100%;} + +#BW_ulEti ul { + margin:0; + padding:0 15px; + list-style-type: none; +} + +#BW_ulEti a { + text-decoration: none; +} + +#BW_ulEti a.tag_s0 {font-weight: 120;font-size:0.8em;} +#BW_ulEti a.tag_s1 {font-weight: 150;font-size:0.9em;} +#BW_ulEti a.tag_s2 {font-weight: 180;font-size:1.0em;} +#BW_ulEti a.tag_s3 {font-weight: 200;font-size:1.2em;} +#BW_ulEti a.tag_s4 {font-weight: 220;font-size:1.4em;} +#BW_ulEti a.tag_s5 {font-weight: 230;font-size:1.5em;} +#BW_ulEti a.tag_s6 {font-weight: 320;font-size:1.6em;} +#BW_ulEti a.tag_s7 {font-weight: 350;font-size:1.7em;} +#BW_ulEti a.tag_s8 {font-weight: 400;font-size:1.8em;} +#BW_ulEti { padding: 0px; line-height: 2em; text-align: center;} +#BW_ulEti a { padding: 2px; } +#BW_ulEti { margin: 0px; } + +#BW_ulEti ol { + float:left; + display: inline; + margin: 0 10px; +} + +#BW_suggestions { + border: 1px solid #E8E8E8; + margin-top: 10px; + float: right; + width: 49%; + visibility: hidden; + visibility: visible\9; +} +#BW_suggestions:not(:empty) { + visibility: visible; +} +#BW_suggestions h2 { + background-color: #E8E8E8; + margin: 5px 10px; + padding: 0 5px; +} +#BW_suggestions .BW_livres_tag_page { + padding: 0 15px; +} +#BW_suggestions .BW_livres_tag_page:before { + content : '> '; +} +#BW_droite .BW_livres_tag:before { + content : '> '; +} + +#BW_videos { + clear : both; + border: 1px solid #E8E8E8; + padding-bottom: 140px; + margin-top: 10px; + max-width: 100%; + visibility: hidden; + visibility: visible\9; +} + +#BW_videos:not(:empty) { + visibility: visible; +} + +#BW_videos h2 { + background-color: #E8E8E8; + margin: 5px 10px; + padding: 0 5px; +} +#BW_videos .BW_bloc_vid { + clear: both; + padding: 0 15px; +} +.BW_vignette_vid { + border: 1px solid #DFD9CE; + float: left; + height: 141px; + margin: 5px; + min-height: 141px; + padding: 5px; + white-space: nowrap; +} + +#BW_notes {clear :left;} +#BW_notes h2 {font-size:85%;} + +#BW_citations {} +#BW_citations h2 {font-size:85%;} + +#BW_critiques {} +#BW_critiques h2 {font-size:85%;} + +#BW_critiques_pro {} +#BW_critiques_pro h2 {font-size:85%;} + +#BW_citations,#BW_critiques,#BW_critiques_pro { + background: -moz-linear-gradient(center top , #3399FF, #3333FF) repeat scroll 0 0 transparent; + background: -webkit-gradient(linear, center top, center bottom, from(#3399FF), to(#3333FF)); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3399FF', endColorstr='#3333FF'); + border: 1px solid #B7B7B7; + border-radius: 5px 5px 5px 5px; + color: #FFFFCC; + display: inline-block; + float: left; + font-weight: bold; + margin: 15px 20px 15px 0; + min-width: 150px; + padding: 0 15px 8px; + position: relative; + text-align: center; + text-shadow: 1px 1px 1px #777777; + white-space: nowrap; +} + +#BW_citations a,#BW_critiques a,#BW_critiques_pro a { + color: #FFFFCC; +} + +*/ diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc index a264af3..33d3c06 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc @@ -53,9 +53,5 @@ [% END %] -[% IF ( Babeltheque ) %] - -[% END %] - diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 25480c8..4e56a5d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1,6 +1,11 @@ [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog › Details for: [% title |html %][% FOREACH subtitl IN subtitle %], [% subtitl.subfield |html %][% END %] [% INCLUDE 'doc-head-close.inc' %] + + + [% END %] + +[% IF ( Babeltheque ) %] + +[% END %] + [% INCLUDE 'opac-bottom.inc' %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt index 22c9272..a541d95 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -389,6 +389,9 @@ $(document).ready(function(){ [% IF ( SEARCH_RESULT.imageurl ) %] [% SEARCH_RESULT.description %] [% END %] + [% IF ( SEARCH_RESULT.score_avg ) %] + + [% END %] [% END %] [% END %] @@ -477,6 +480,23 @@ $(document).ready(function(){ [% END %] + [% IF ( SEARCH_RESULT.score_avg ) %] + + [% SEARCH_RESULT.score_avg %] / 5 (on [% SEARCH_RESULT.num_scores %] rates) + [% IF ( SEARCH_RESULT.num_critics ) %] + + [% END %] + [% IF ( SEARCH_RESULT.num_critics_pro ) %] + + [% END %] + [% IF ( SEARCH_RESULT.num_videos ) %] + + [% END %] + [% IF ( SEARCH_RESULT.num_quotations ) %] + + [% END %] + + [% END %] [% IF ( LibraryThingForLibrariesID ) %]
[% END %] [% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %] [% IF ( TagsShowOnList ) %] diff --git a/koha-tmpl/opac-tmpl/prog/images/Star0.gif b/koha-tmpl/opac-tmpl/prog/images/Star0.gif new file mode 100644 index 0000000000000000000000000000000000000000..44ffdf488560eebbf1f8a5db485fabe581db9625 GIT binary patch literal 1360 zcmW+#dr*{B6u&wqk14g)nX*VzN^ONQZ;15lbw+Tc?E;3 zLD#52O_$V^9*)WkqwO at QbD?!KQy%MEWCe at R)@7yB at 9zEY%sJ=xI^Q>UUcz+KN;4b9 zyo`~4ibxU(B2L6~r4%ViN|55Dm~Ki%Qj!!TIZ38xg(4wI2ojtG)2mz&m&65ePMiUW zm?9>L31XZW3Sa{oSXjn1(>(e~rG!#kDW+*rNvWhzk}Juy3N(dOLMXwNU|JMrxl~*z z&J}0Sh*ia;VnQ*l7+9eiU=R(JkcA$IfemP2VVP+|y2cYyaw(bi2U=7 at NWrCG+AdU} z$%W)xat8Mhg;~jjWLz at XLmrTcZNvfp5CMl!4KRp?N{m7Wh=C1gU@@JXZllKILNFa9 z{DBq~=Ylij3cFB&reIt!`cdZNvdhFbs!K4KRqtCS*Yeh=C1g zrcb1&(MFBOa4`f4f1pLhnf^F*u7P{&X5fT6=D=0-Y#?ZzdLTQ!8i+$5A>dFW1w`wc z1axTN05m=aTnXX9Q-G?8=x3tui4GARAo`kUD^Vd)5m6~o1(BVoYTywLyPIe~Q9aQ? zqQgW#5H%7xANjTp__q!8mkjtT{9e2N-vZx1h5iQ>5ARvMp3V1ftnqbz)ay3iYhKcI zYM$qK!i|F_eEQ>jLk7Vpi+~2E{|Och(;;DrM`};mf=3#cpFUFOEE*A>RFl~2exuCL zo6`RD!WE{HF>|cl(+#T*MTgAJuV#)L{Gfiv z#B+u5V_VN(9M*QcCZu{=o at dI~clIYgne?k?-Q+(Cymu at Ywne5y<=(!2u5o`u>ZOMC z-}j}oRi(y$`rz#L*UOf!jm;Z+#Z%r^ot at fX^R=XZknE2BuxEVEvlHjfKDx18g{+(F zdewYpXJpz%WvT5v-813crW(uo&fgqM%Cb|IUCneInA>Q5?rNCn?6s45{;KS#oGT{_ zM at D6DPWkJ~_59(ltZ4N0-8?Vbaw}$>_}CM4tDe?)W0oJwasRaOfZMXg*VpxD_^1We z8q0mpe at IGbTHX_AJk=y4Fb}W_ at dnEburQ@{OL^-x+Ua%^A2; lntV8<$5uJ3Y0Qv_xJJWMN*O!Bsoc at XN4jmNeB|01kc zD9#mU(1=yVq+&ubt{7OM8ek9&m5_xVh=C1gU}2eQL%PNjQgSJo_6J&2LP)`-VA?KJ zpvi^gTyh5Y5QSOEgk)SY*h3zWiEYFI{}2I(Pz^AMhDwY=2Z(_UXkam&oNlAW<3cbU zB>aIE73YF8+wFyx4&5dd^y96`e^qC_5$iEYFIO)w0HPz^AM#wKJz2Z(_U zXr at o3r_n}@$8a$O34fqP#hLy%bgsU8>!$C7I%eNh^sFyvow_eOz3PiYAHnBPBl$$@ zoA`8SU>`I-2V4o^!IO{bB+&_?bfRpcT|~J=c|->WpW>4FM1 at 4fL{6epL}!R9iK?Cs zYJEk8*f|QH{=|WyelW^jhX$tq2^Ij;f#YIJ4`0d*7#$w}N9mEO9U~_# zI260rQJK>_dBy&7qa0?dsWE+c;A5<{LgJpd%wxFIj(D5MRiN%=c5x&#z$-zQnUMww2fkg+CzRj_Jmwe@;2j+F}Jr@%5Y)bIr|7e%;B<;{Y&p)=PU*%+Et?8piU zAA2}s?mxvAZ-akb^k83^vA}R))uI_5wRG{!#;i at r7DryiOUI9IUovy;v7<#5;TGpD zgU9LruRF!^tWS=N`q7kSG*=pCm*n|(WR}djY}&f+6wOX~ST<(jJXV8dM#iU|FF|HU`p&DQi4V93E9*BVrXkcNPX+yfk6H;<1nf3=-R6rC{1F zRG`U)zlZAXkZsKJ_lS0;lY!Os*)(n>C7ePA#&yuo%rt!ZdgKef#@<(1yMCo9Z}<((X7`a z$H#_qUcbm6d7A0y+cDao^r9!het(nwcC_Q~xF^kv9UUu%T36Yd=RR*=KTtD$uqn#^ z=UU6P`CX;6t=CNhb;~-7{M!yp#-~4H)ZGn6**s`q`k!D1m^MyZdFAZyW`j>q{EaK; z8uKOvtS(x4)zXyeb7#v*zhM8Uqm$dx3+9}7bmM at -nzi@aFSj(NTAHq!FD)o-&Rh6L zcZ#34f7qD`na*t6k!iIBUf=l7+A(E&dwRJ2S)b9jBqne0%Bg^)m4Yfn at hP0hE zSI37on}dQkez1SkGBf7p-TCpgZ`~{Vs6V>AX7{6pq{x=m;-#s!Wn&)m{E8PJ_Lw|( z!AQuz4_iF?>dl>%)nOUKmfl}lc5e#b=e{uc<%A9IZ|}G?zT};#%A#FK-8DwPkOk9B zZdOBU<-X97p`PE&H%oVYcP**s*Q~AkJBRqTjF;EWC{YAp~EaftyRntDx!{8&TQtia+lOZu^rPRja)&o*uLICl;*Fc=ChCV{=>hn5|>YlCi6 at H#ng&{=n=z1m}W`Pz)!i7DQpw>(ew uoPM<@v!c>H=Rw7CpF8IE7~^&Gq$QrUnUm^lcX!(BUs=nmmbMA*A3^Fe#`ML^ZjPoJ-Cmr;-yj%YTw~M5L5`FXi;%4I1`)-PLv8X85fKRMg=2E6lN(G zlnF`&CD4dfLAW4H5Gn{*p&DQi4V93E9*BVrXkcNPC_}2oW1LgYiSh?pRE%*(IU~w0 zRG>*2r<79y_Yj3yP8cVY6WBu at kcn-?0sjyIhfobLh=xjxLI;R}4QOBym7Hp$#-of8 z6(szD78Rw8666ZIP=O{Rlo8~Jq!9pgVH`ojEuusokcn-?0ZlLrhfobLh{h&lK?jI| z4QQfHq^8kEjYn`X1POnjMMa7FI8?6Yd#k4Tgeqq9Rn)9GXqCD-JGE+#Lmk2FP$8K` ztDBg0C}1-*J_lS0;lUHAUcNXaUmlgRM9MNL&q`S>!} z`yW2-i8S?YH at 16^>3oKN^EY*Ge4>jOZSx%db at iBt80*|Na&`G&%UdHi)<3-!HGFBw zgIX^`!>Y$uH{3n%_IJI{&?Wyn+QnV at cH-cx`1D<;EoZ?fc at r9l`X`7rOxrkz*PXeR zYi;KhbE~er?aTSg-`0lL53J9$`#te^)x3o31R3FduUC} z)ny~rrh6?JMq}UQr1aFV%B1evw3MP$ebYz!KitAMIY*?&G=6UQHqyEI6RYPhZ3CK& z{W*_C>B_MEE-jyqKDyo37!@0sQ|uA_i+2B>hn*IoTfCDTFS3p at n>>pvZ)knf^hdM) zxfyxTPv6jZzvD&P-lq at F=;}A^ZGQhs)}--9-jDyKnjYS+^oY%NY02nmwV059<~g03 z-t|hIqjuE?WIA=IzC1d;%jNR!N8Smtper!@#r@>yqA#Y`EL^&8w$7^KfHBUX^O>lb zwRP~D?Ys1e zA+hm4xSa at EcIa!;myzq_yJc|$JC%Mjxl1$Any at HPJ84KPJMiyxWtn!Yx$v~j5rfV* zH?7;)m1M->-FTkL0B694}JB*n>K literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/Star4.gif b/koha-tmpl/opac-tmpl/prog/images/Star4.gif new file mode 100644 index 0000000000000000000000000000000000000000..473cb32087da78d40ebd8968a542b0bc50b76c55 GIT binary patch literal 1380 zcmW+#dr*{B6u;;yU^Oz at IOQ-9g-8-ibsKQoz!7PYkjJPLBacyos}4kg;ZpWcUW$!^ zNyH at u9Yeqwlu|-eQrbYl%fnD?f<%Eua9bX+kdbox-M#;vIp_Rd=lg;~^eeSn63DaU zA3~&hLP{R) zF|Ywm)QQwI+NkjeE`}iC545N#Q6GoO)pl>yw4G4JY`cn at wFRwGw`HeRZE>h0*c>V( zn`m_tn+^qRgU088D;?r-|5#)XSBoT0`44j?fh!7*z*)VeYbx#b}&j_fd-=f3E}|Lj?Qaq zjyGmGEM5_Nz2<~*pVLe499{cE|F5Zw8^Z=YQk|RkyXd~ij!qdgelW+q$jji<-&(Zr zT0^!&ipg((Z_Sp0N8`PIADLg6(X6m;>nzs0Ex2CfU2fcIy1F;XQ0TU?YGaxH*rxRR zb=8(ut!Vl9L16xSEqS5A5%HHZ9B%5PZghLcX1QD|kL#JX#AV+5xm6Qf=dCkXo=)q^ zT@>S+96B$#tGPO+G4<}%^qzG-N9%WvJ-mNud56ntQKH>F- at D}e$lgjngZZ)6I{cfa zA+adzyD7^R`IDB-WW>CGY>sBTS4MkJa%yQ?RhIoi*Oa05+xoKjCvP?mb<}N;b+aX# z>;LL(3vnImK0Zzg4n}mJdgkx6tjJ3_lcJ&2Fk~9O=9)hHjs5XG=Ee=1W9>%2y_ae4 zc&9Mcdb=Vv(Cl=|#qj94?UA{I$tz3u&D-m_HQjwtP=2oCuF6i|rl{z?&mC)zglA6n z8ao1g`zucdnyuI44(U9shYD_)Jo5t++A6}*-g0w~&<(}pC zRy4jnFETpr>rWyM%r$9vc(bFEY4ybABkekCZ`Q(q|Ewn?j~RyQx0QYQM_xtgXEWT% zKX*av@?!hLInHT2mu`GeGCgk0_n+}R&{;m6aB)XP&eqc}SCqQAcj%ISG`3e(EnS`9 zmiXtZ9uLY+EV-4x>cXcNlFn+TCX)g`tX~ruV0HGPw WB{>D$+-0`Z-OKe#Id5l2bpHd;>%uJn literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/Star5.gif b/koha-tmpl/opac-tmpl/prog/images/Star5.gif new file mode 100644 index 0000000000000000000000000000000000000000..0a61173924a33b422e21e9d649b9f50b36321465 GIT binary patch literal 1284 zcmW+#eN2^A7(XnUkaYoX)3$;IMA*A3^Fe#`ML^ZjPoJ-Cmr;-yj%YTw~M5L5`FXi;%4I1`)-PLv8X85fKRMg=2E z6lN(GlnF`&CD4dfLAW4H5Gn{*p&DQi4V93E9*BVrXkcNPC_}2oW1LgYiSh?pRE%*( zIU~w0RG>*2r<79y_Yj3yP8cVY6WBu at kcn-?0sjyIhfobLh=xjxLI;R}4QOBym7Hp$ z#-of86(szD78Rw8666ZIP=O{Rlo8~Jq!9pgVH`ojEuusokcn-?0ZlLrhfobLh{h&l zK?jI|4QQfHq^8kEjYn`X1POnjMMa7FI8?5#d#k4Fgeqp&Rn)92XqCDvJGJVHLmk28 zP$9WQtDCrVC}0;fJ_lS0;lUHA=10<|`?fl7CC?3~&h!M&UJKK at Ua|ic<-B2;x|Z;7 z-%jVBNmHGM=_ at 9OZQZO$nC*RYvORG0^18{cSEsLTn`rT~HwN6PGmSI`Pqc<>1 zU)WS%)p5i_Z%XN|ueKF=2X6j$Q^T3Aw43ow{aUce_VJYEOWT`=wF4)*Z;6))$27OU&Uo;+4j!Q6FYL^ zjb472^E?`K{a5=}4<6aud}8WB=;WpI$u}!Q%X2Rz{dBV_V`!;0Ir6~d_?RuP#IGYO ze<9QHFns3k&LX{YZt1Qydu&hmI8NOj3>g()tk|A=u(j&ayMs*+R+iPBYCCw^vodiw zBgZk&u;lk0yRFUp2g}oI#;2aodvDmbf8pn69=&}%qh+YMqAWQ#LhJc%drYQp+qAtu zCv~JmSK0RA^o1Vd8{xW?`GIlIi+QP0sgDYrcZPPB|MK6Vg2!tYPH%7=bMB71KhyYH z!4kudRRwncb5(IqTeKICdT%yX$IX0tz#8c|pH^aC5zseM^ z)0OVKpRMZb_BU(wfnL#zqm3mo=K1?+rSZ${fu(WFxOY at kaB=NPgC&38$*0x dSba#BtyLDYQLU!bVzSqMx#OMhH at LYG^Z&S!h!y|< literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/bonus.png b/koha-tmpl/opac-tmpl/prog/images/bonus.png new file mode 100644 index 0000000000000000000000000000000000000000..663a31d6601ceadf7565160923eaa6690de8ed42 GIT binary patch literal 1768 zcmeAS at N?(olHy`uVBq!ia0vp^N+8U^1|+TAxeoy;$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%xRe+5hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR- at vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83 zmzLNn0bL65LT-VtFWlg~VrW1CgG|37u|VHY&pf(~1RD?6IsxA(xEJ)Q4 zN-fSWElLK)N18HBGcfG%TLe-Fbd8mNQ6?}_5_4SglS^|`^GZBjY?XjAdMTMHR)&U7 zF2;@)&L)N~My>{ih8C_a#+F9ru11c=ZU&|<#xOIm>2XL&K>`K=X2e?wH%5XlY89!SKiOR zoD#JB;f21MYdL)@;^qhJzN>!w-_)1&j43a7?2ZSmlxda zfAp>-4P*V`Dfy!#;43Yv2l56%teJC z_Xu!%zL_&;k0(2e!l|UhiT`C}_xiFi6^9&jk(u%Nvv_x-#{3m-J5xC?X0430^*`Hj zNr8{=UU-_&b>L^HAuNr2!5Zeus(ClQl~3CCXOg#NnVH<`xsN2XHCVVAm>7;94{Q^9C15-4 z+ZzW5bMEE_28k8NjgRe-6id1FMX>pIrjfavtPRg#}$V+$=iCriC8iv zMY^n8{mEUBu`SZ_SrU6yVsZfgtc`4M=cqp9jz~6h-tuC?+ZA3PV?LZ=VaZRAZ;0Pu zc|)=Eq1L_GC(0Zc4JS*@XfV*05nQuFN317hS+|_m$32w~8kVg*#daWP&fL8{W^QWQ zF~&P;rl+?>m at RU+AT#r?*7Ubpzr##kZM4{R_ z{1dM*sejJ$seV6IAzjy85}S Ib4q9e0NACF1poj5 literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/socnet/delicious16.gif b/koha-tmpl/opac-tmpl/prog/images/socnet/delicious16.gif new file mode 100644 index 0000000000000000000000000000000000000000..11682e826fc90c534475d4259d6c2ad1e3fb7794 GIT binary patch literal 89 zcmZ?wbhEHb6krfwn8*ME|NsBLd-pDoR{Y5V7SI8aAbAERt)BeFt2 at rzY4ldJ$~kbe j=x?Qj!?Yz0%T{Er(u&@tS#yes_lEh}$F}*}3=Gx)?P(tN literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/socnet/facebook16.png b/koha-tmpl/opac-tmpl/prog/images/socnet/facebook16.png new file mode 100644 index 0000000000000000000000000000000000000000..1176590b3ee947b67fa2f7c6d7fc7b9754a69972 GIT binary patch literal 727 zcmV;|0x127P)003>6 z003>600000003>600000003>600000003>6NBc_+0007VNklsQ?dpl|oN1>3jxT?+!gU##VSVH_7R at _uM|{Mh}= zCti4PAn5Pke0}B8#ru*ZLiM-9e~D*OL8-K6es|a1(Sv7pdKfd=^6C>m>Jf1| zQS}OAbux^wK?nK|Kvq}|?OD&^y?w2{*Kfb^VW>eonc_iC7^W1~Z3n1gMOe4I2EfzT zpLy_XfWa?ynsGrU1zsM(*hIoCarwhR6pSJ8-IgzJ-jDF;`5-0VB}tXEDL6h5MFsUn zOcEaP;6Nu3S9A+-e8)MuGrdK3y-jLS87wfH4LU#rIrP z6*E0RgCR)^e$-=drgTngz6vTJ7HpxYz(h0UsC8yE%P`t6q-KYf$Yu_lgjegRCY z#-AYqVU%I*R5nhFsn%rXg at 6Y>g#{x5e_<3rwB at ZTSWyZqI4FXHx41UjS-r02*qna? zRFxp`0GQWZVeP6KCEumo(a9J8lj9}hAIG+??`?E;b at xVb+}4H_VNSIZfMrX1*s*09 z9pw^%2lob|ukP^hK%-QuxIOcFH=>2HS&~WqYZZBtWm%MsjErZ4LnB!jhPl`zdj9m` zts7S_T$=eh6=2t_ISUqoZSylq1ZyqjvWxHgCJMtzn}v^o;h+1ROLuju17`pL002ov JPDHLkV1hJ+L6-mk literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/socnet/linkedin16.png b/koha-tmpl/opac-tmpl/prog/images/socnet/linkedin16.png new file mode 100644 index 0000000000000000000000000000000000000000..2a195c2b7682bf66b118b08bc019bbb297c550ac GIT binary patch literal 751 zcmV003>6 z003>600000003>600000003>600000003>6NBc_+0007tNkl+ zn_!`i`LJ|m^1d_ke&6SDF_Tusdf>q2;oP(O9RcXR`N31CUtRyC<^3C`fqzQ?JA6Aw zZEWq|-G96H at x>nnE;Khkym;lz>dI!w(g(r+lb at U8_k(2b`qghX{QS9-&vaXUV{m^+ zP$j5Q1!c}VoXCGSSW2hcS)PBqyXiwd=_aF8bgoGql;aB>US2!F_uD%RCpnMmAQ<&H zKH{a$Z8S~^O(QQ$F1)bHyRWaaGl<#V?bGlPBA{wGC&;YPikc!T at BpJEr*1>gz?B!RYUS+7C9d7-@&4tjBzZ|0pw2QJK$Ydh at rZOZq1A{uar7}TWue{V>EnxB{`x1r zxN)0vXHN0#$|A`irWj8^by|QLR+VU$QB_k8vb>-UfnGo1)31Ku^XtC?5Q$+$foVXs z!jl3TFcnZkW+YTqg_>e!AOSbKn<}OXGvFLB4QZI#bVi>|2{e1~X`0iAIaQ={_N`Z1 zr(e8=&_V-8mlinn?j61u1vQdgOn&i8;E_rL0B7#_` zL16Ibkp5mDi5$NT6ATdVNaHcT3=$-AAOhlW&Wp>oZ}!b}D9!eCGLayS2%LbA5FbtF zf9nG*X$`r0CuJEdBY*j}A%i0vj~C%YR$$ hqa;-M7{a%}{$IHtX7n4~n=$|Z002ovPDHLkV1g_(Te<)M literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/socnet/mailto16.png b/koha-tmpl/opac-tmpl/prog/images/socnet/mailto16.png new file mode 100644 index 0000000000000000000000000000000000000000..d8e4a5ad20489ece6a0d152dadb117c7b013bbcd GIT binary patch literal 792 zcmV+z1LypSP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipt{ z4jVOgtWhHX00NjvL_t(I%dM2VN^5NphM!ppIU|B3xD at OxG$|C3fK5b1LA(GPEyTi0 z at E)wR6YR9HH%%mvU}qXpgxDykXw-;Cv$77jGP~IPvh%yy=Yg-B=X>X!myyTE$A_Mt zo}{YsFG at ssetv!o77B%AI-S;`p&@Cv+kXW$41 at FYb3HjZNy^jHlkV*7FflPfCX>N+ zT}0%!fT~I;6rx(KQZAQST3SLZ%TmX2SYKZ!m&-9WHpcHNHw=U0<6{bi0&8n)M59rp z(P*gax~M9_6bgNOCbe2kTdh{dR?Fowr>CbZEG*#r{&%5) zK!ClyJ<{nklarHto2pnWhFn}+Xsgxg7~3!mip3%i4-e#WIe-t}4Z}c0D3wa2QYogU zraGXi`W1Y3cBai{^OK(-6>YkuZw9B&v$45{*U)Hk(a6&qG9LG#U&H3@|!6itqbB zjhl!tGBSdya(Q`4cXv0citqab-`?JET^Gx;Fin$8Cd0SZ{7MZE5A*W!!p+SMi9~{M zI85;N_7=;s7#|;JaBz_O`};pSK&-2LV^Lzo0 WgKAw8mt9H#0000f at - literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/socnet/twitter16.png b/koha-tmpl/opac-tmpl/prog/images/socnet/twitter16.png new file mode 100644 index 0000000000000000000000000000000000000000..ccb1b618963c52a441bd2b059fae90346ffd97ab GIT binary patch literal 780 zcmV+n1M~ceP)003>6 z003>600000003>600000003>600000003>6NBc_+0007~NklK zv}00jLXys8a_`K%|DMOiO@&ZA at GPGnhr>Ar;O550*(>KSd{Pv}t1%@W$#7B%$CN*WbEy>5hHv`t|0@(z#EU`U}@4RRy_4RBM1Sk3j$$?e^uS%9n3{_4S%P_w=*R zjZPD6r5dXk;1t&XZIhgH*vY*KRN7uDoVPM+coM%uF*g#FSX>cDUG`XDWuJ z){NVG504>+%+#&`#5oQ}!+D!h(sJgBj%o|R*$TJ=jUOeG2;7wb}`0~t5C&&4H1TulCDuy z6%`>090ho169gp*ywHOiD_tc0%_Js>0be_aOr0ZV zzpRKNU at ajAEPxLYVTPz6qByCa-dr}EX&y%}f%oogGO8-_EF%{o#z+K0W&Km9R#g-Y&S~(T7`#dG#Ays( zybt1hb??X9pRa%X;Rla)(gD_ret$8q_w>I?IVMadCEkAr?EDKQX`=G4-NZKl0000< KMNUMnLSTZKHeIX$ literal 0 HcmV?d00001 diff --git a/misc/cronjobs/social_data/get_report_social_data.pl b/misc/cronjobs/social_data/get_report_social_data.pl new file mode 100644 index 0000000..7069e24 --- /dev/null +++ b/misc/cronjobs/social_data/get_report_social_data.pl @@ -0,0 +1,16 @@ +#!/bin/perl + +use Modern::Perl; +use C4::SocialData; + +my $results = C4::SocialData::get_report; + +say "==== Social Data report ===="; +say "Matched : (" . scalar( @{ $results->{with} } ) . ")"; +say "biblionumber = $_->{biblionumber},\toriginal = $_->{original},\tisbn = $_->{isbn}" for @{ $results->{with} }; + +say "No Match : (" . scalar( @{ $results->{without} } ) . ")"; +say "biblionumber = $_->{biblionumber},\toriginal = $_->{original},\tisbn = $_->{isbn}" for @{ $results->{without} }; + +say "Without ISBN : (" . scalar( @{ $results->{no_isbn} } ) . ")"; +say "biblionumber = $_->{biblionumber}" for @{ $results->{no_isbn} }; diff --git a/misc/cronjobs/social_data/update_social_data.pl b/misc/cronjobs/social_data/update_social_data.pl new file mode 100644 index 0000000..53058a7 --- /dev/null +++ b/misc/cronjobs/social_data/update_social_data.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use Modern::Perl; +use C4::Context; +use C4::SocialData; + +my $url = C4::Context->preference( "Babeltheque_url_update" ); +my $output_dir = qq{/tmp}; +my $output_filepath = qq{$output_dir/social_data.csv}; +system( qq{/bin/rm -f $output_filepath} ); +system( qq{/bin/rm -f $output_dir/social_data.csv.bz2} ); +system( qq{/usr/bin/wget $url -O $output_dir/social_data.csv.bz2 } ) == 0 or die "Can't get bz2 file from url $url ($?)"; +system( qq{/bin/bunzip2 $output_dir/social_data.csv.bz2 } ) == 0 or die "Can't extract bz2 file ($?)"; + + +C4::SocialData::update_data $output_filepath; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 27684d4..096c6f0 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -836,9 +836,16 @@ $template->param(NovelistSelectView => C4::Context->preference('NovelistSelectVi if ( C4::Context->preference("Babeltheque") ) { $template->param( Babeltheque => 1, + Babeltheque_url_js => C4::Context->preference("Babeltheque_url_js"), ); } +# Social Networks +if ( C4::Context->preference( "SocialNetworks" ) ) { + $template->param( current_url => C4::Context->preference('OPACBaseURL') . "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber" ); + $template->param( SocialNetworks => 1 ); +} + # Shelf Browser Stuff if (C4::Context->preference("OPACShelfBrowser")) { # pick the first itemnumber unless one was selected by the user diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 3e3995d..163f17b 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -36,10 +36,11 @@ use C4::Biblio; # GetBiblioData use C4::Koha; use C4::Tags qw(get_tags); use C4::Branch; # GetBranches +use C4::SocialData; use POSIX qw(ceil floor strftime); use URI::Escape; use Storable qw(thaw freeze); - +use Business::ISBN; my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold"); # create a new CGI object @@ -525,9 +526,23 @@ for (my $i=0;$i<@servers;$i++) { foreach (@newresults) { my $record = GetMarcBiblio($_->{'biblionumber'}); $_->{coins} = GetCOinSBiblio($record); + if ( C4::Context->preference( "Babeltheque" ) and $_->{normalized_isbn} ) { + my $isbn = Business::ISBN->new( $_->{normalized_isbn} ); + next if not $isbn; + $isbn = $isbn->as_isbn13->as_string; + $isbn =~ s/-//g; + my $social_datas = C4::SocialData::get_data( $isbn ); + next if not $social_datas; + for my $key ( keys %$social_datas ) { + $_->{$key} = $$social_datas{$key}; + if ( $key eq 'score_avg' ){ + $_->{score_int} = sprintf("%.0f", $$social_datas{score_avg} ); + } + } + } } } - + if ($results_hashref->{$server}->{"hits"}){ $total = $total + $results_hashref->{$server}->{"hits"}; } -- 1.7.7.3 From julian.maurice at biblibre.com Fri Mar 2 15:39:48 2012 From: julian.maurice at biblibre.com (julian.maurice at biblibre.com) Date: Fri, 2 Mar 2012 15:39:48 +0100 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 7616 - Remove unused template markup for css_libs, css_module, js_libs, etc. Message-ID: <1330699188-6556-1-git-send-email-julian.maurice@biblibre.com> From: Owen Leonard Removing references to unused template variables and markup. Signed-off-by: Julian Maurice --- C4/Auth.pm | 22 ------------ .../prog/en/includes/doc-head-close.inc | 37 -------------------- 2 files changed, 0 insertions(+), 59 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index ccb2c15..38bbd5e 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -147,17 +147,6 @@ sub get_template_and_user { my $insecure = C4::Context->preference('insecure'); if ($user or $insecure) { - # load the template variables for stylesheets and JavaScript - $template->param( css_libs => $in->{'css_libs'} ); - $template->param( css_module => $in->{'css_module'} ); - $template->param( css_page => $in->{'css_page'} ); - $template->param( css_widgets => $in->{'css_widgets'} ); - - $template->param( js_libs => $in->{'js_libs'} ); - $template->param( js_module => $in->{'js_module'} ); - $template->param( js_page => $in->{'js_page'} ); - $template->param( js_widgets => $in->{'js_widgets'} ); - # user info $template->param( loggedinusername => $user ); $template->param( sessionID => $sessionID ); @@ -281,17 +270,6 @@ sub get_template_and_user { } else { # if this is an anonymous session, setup to display public lists... - # load the template variables for stylesheets and JavaScript - $template->param( css_libs => $in->{'css_libs'} ); - $template->param( css_module => $in->{'css_module'} ); - $template->param( css_page => $in->{'css_page'} ); - $template->param( css_widgets => $in->{'css_widgets'} ); - - $template->param( js_libs => $in->{'js_libs'} ); - $template->param( js_module => $in->{'js_module'} ); - $template->param( js_page => $in->{'js_page'} ); - $template->param( js_widgets => $in->{'js_widgets'} ); - $template->param( sessionID => $sessionID ); my ($total, $pubshelves) = C4::Context->get_shelves_userenv(); # an anonymous user has no 'barshelves'... diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc index 53f6843..bc551ac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc @@ -7,49 +7,12 @@ [% ELSE %] [% END %] -[% IF ( css_libs ) %] - [% FOREACH css_lib IN css_libs %] - - [% END %] -[% END %] - -[% IF ( css_module ) %] - -[% END %] -[% IF ( css_page ) %] - -[% END %] - -[% IF ( css_widgets ) %] - [% FOREACH css_widget IN css_widgets %] - - [% END %] -[% END %] [% IF ( IntranetUserCSS ) %][% END %] - - -[% IF ( js_libs ) %] - [% FOREACH js_lib IN js_libs %] - - [% END %] -[% END %] -[% IF ( js_module ) %] - -[% END %] -[% IF ( js_page ) %] - -[% END %] - -[% IF ( js_widgets ) %] - [% FOREACH js_widget IN js_widgets %] - - [% END %] -[% END %] [% IF ( login ) %] [% END %] -- 1.7.9.1 From alex.arnaud at biblibre.com Fri Mar 2 16:21:34 2012 From: alex.arnaud at biblibre.com (alex.arnaud at biblibre.com) Date: Fri, 2 Mar 2012 16:21:34 +0100 Subject: [Koha-patches] [PATCH] Bug 6086 - adding a dynamic filter to pending holds Message-ID: <1330701694-6056-1-git-send-email-alex.arnaud@biblibre.com> From: Alex Arnaud --- circ/pendingreserves.pl | 160 +++----------- .../prog/en/modules/circ/pendingreserves.tt | 238 ++++++++------------ 2 files changed, 130 insertions(+), 268 deletions(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index d723bc2..52a0450 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -34,11 +34,9 @@ use C4::Debug; use Date::Calc qw/Today Add_Delta_YMD/; my $input = new CGI; -my $order = $input->param('order'); my $startdate=$input->param('from'); my $enddate=$input->param('to'); my $run_report=$input->param('run_report'); -my $report_page=$input->param('report_page'); my $theme = $input->param('theme'); # only used if allowthemeoverride is set @@ -69,29 +67,28 @@ my $author; my ( $year, $month, $day ) = Today(); my $todaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day); my $yesterdaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -1)); -#changed from delivered range of 10 years-yesterday to 2 days ago-today +# changed from delivered range of 10 years-yesterday to 2 days ago-today # Find two days ago for the default shelf pull start and end dates my $pastdate = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -2)); -# Predefine the start and end dates if they are not already defined +# Predefine the start and end dates if they are not already defined $startdate =~ s/^\s+//; $startdate =~ s/\s+$//; $enddate =~ s/^\s+//; $enddate =~ s/\s+$//; -# Check if null, should string match, if so set start and end date to yesterday +# Check if null, should string match, if so set start and end date to yesterday if (!defined($startdate) or $startdate eq "") { - $startdate = format_date($pastdate); + $startdate = format_date($pastdate); } if (!defined($enddate) or $enddate eq "") { - $enddate = format_date($todaysdate); + $enddate = format_date($todaysdate); } my @reservedata; -my ($prev_results, $next_results, $next_or_previous) = (0,0,0); if ( $run_report ) { my $dbh = C4::Context->dbh; - my ($sqlorderby, $sqldatewhere, $sqllimitoffset) = ("","",""); + my $sqldatewhere = ""; $debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate); my @query_params = (); if ($startdate) { @@ -103,27 +100,6 @@ if ( $run_report ) { push @query_params, format_date_in_iso($enddate); } - $sqllimitoffset = " LIMIT 251"; - if ($report_page) { - $sqllimitoffset .= " OFFSET=?"; - push @query_params, ($report_page * 250); - } - - if ($order eq "biblio") { - $sqlorderby = " ORDER BY biblio.title "; - } elsif ($order eq "itype") { - $sqlorderby = " ORDER BY l_itype, location, l_itemcallnumber "; - } elsif ($order eq "location") { - $sqlorderby = " ORDER BY location, l_itemcallnumber, holdingbranch "; - } elsif ($order eq "date") { - $sqlorderby = " ORDER BY l_reservedate, location, l_itemcallnumber "; - } elsif ($order eq "library") { - $sqlorderby = " ORDER BY holdingbranch, l_itemcallnumber, location "; - } elsif ($order eq "call") { - $sqlorderby = " ORDER BY l_itemcallnumber, holdingbranch, location "; - } else { - $sqlorderby = " ORDER BY biblio.title "; - } my $strsth = "SELECT min(reservedate) as l_reservedate, reserves.borrowernumber as borrowernumber, @@ -176,110 +152,44 @@ if ( $run_report ) { $strsth .= " AND items.holdingbranch=? "; push @query_params, C4::Context->userenv->{'branch'}; } - $strsth .= " GROUP BY reserves.biblionumber " . $sqlorderby; + $strsth .= " GROUP BY reserves.biblionumber ORDER BY biblio.title "; my $sth = $dbh->prepare($strsth); $sth->execute(@query_params); - my $previous; - my $this; while ( my $data = $sth->fetchrow_hashref ) { - $this=$data->{biblionumber}.":".$data->{borrowernumber}; - my @itemlist; push( @reservedata, { - reservedate => format_date( $data->{l_reservedate} ), - priority => $data->{priority}, - name => $data->{l_patron}, - title => $data->{title}, - author => $data->{author}, - borrowernumber => $data->{borrowernumber}, - itemnum => $data->{itemnumber}, - phone => $data->{phone}, - email => $data->{email}, - biblionumber => $data->{biblionumber}, - statusw => ( $data->{found} eq "W" ), - statusf => ( $data->{found} eq "F" ), - holdingbranch => $data->{l_holdingbranch}, - branch => $data->{l_branch}, - itemcallnumber => $data->{l_itemcallnumber}, - enumchron => $data->{l_enumchron}, - copyno => $data->{l_copynumber}, - notes => $data->{notes}, - notificationdate => $data->{notificationdate}, - reminderdate => $data->{reminderdate}, - count => $data->{icount}, - rcount => $data->{rcount}, - pullcount => $data->{icount} <= $data->{rcount} ? $data->{icount} : $data->{rcount}, - itype => $data->{l_itype}, - location => $data->{l_location} + reservedate => format_date( $data->{l_reservedate} ), + priority => $data->{priority}, + name => $data->{l_patron}, + title => $data->{title}, + author => $data->{author}, + borrowernumber => $data->{borrowernumber}, + itemnum => $data->{itemnumber}, + phone => $data->{phone}, + email => $data->{email}, + biblionumber => $data->{biblionumber}, + statusw => ( $data->{found} eq "W" ), + statusf => ( $data->{found} eq "F" ), + holdingbranch => $data->{l_holdingbranch}, + branch => $data->{l_branch}, + itemcallnumber => $data->{l_itemcallnumber}, + enumchron => $data->{l_enumchron}, + copyno => $data->{l_copynumber}, + notes => $data->{notes}, + notificationdate => $data->{notificationdate}, + reminderdate => $data->{reminderdate}, + count => $data->{icount}, + rcount => $data->{rcount}, + pullcount => $data->{icount} <= $data->{rcount} ? $data->{icount} : $data->{rcount}, + itype => $data->{l_itype}, + location => $data->{l_location} } ); - $previous=$this; } - $sth->finish; - - # Next Page? - if ($report_page > 0) { - $prev_results = $report_page - 1; - } - if ( scalar(@reservedata) > 250 ) { - $next_results = $report_page + 1; - pop(@reservedata); # .. we retrieved 251 results - } - if ($prev_results || $next_results) { - $next_or_previous = 1; - } - - # *** I doubt any of this is needed now with the above fixes *** -d.u. - - #$strsth=~ s/AND reserves.itemnumber is NULL/AND reserves.itemnumber is NOT NULL/; - #$strsth=~ s/LEFT JOIN items ON items.biblionumber=reserves.biblionumber/LEFT JOIN items ON items.biblionumber=reserves.itemnumber/; - #$sth = $dbh->prepare($strsth); - #if (C4::Context->preference('IndependantBranches')){ - # $sth->execute(C4::Context->userenv->{'branch'}); - #} - #else { - # $sth->execute(); - #} - #while ( my $data = $sth->fetchrow_hashref ) { - # $this=$data->{biblionumber}.":".$data->{borrowernumber}; - # my @itemlist; - # push( - # @reservedata, - # { - # reservedate => format_date( $data->{l_reservedate} ), - # priority => $data->{priority}, - # name => $data->{l_patron}, - # title => $data->{title}, - # author => $data->{author}, - # borrowernumber => $data->{borrowernumber}, - # itemnum => $data->{itemnumber}, - # phone => $data->{phone}, - # email => $data->{email}, - # biblionumber => $data->{biblionumber}, - # statusw => ( $data->{found} eq "W" ), - # statusf => ( $data->{found} eq "F" ), - # holdingbranch => $data->{l_holdingbranch}, - # branch => $data->{l_branch}, - # itemcallnumber => $data->{l_itemcallnumber}, - # notes => $data->{notes}, - # notificationdate => $data->{notificationdate}, - # reminderdate => $data->{reminderdate}, - # count => $data->{icount}, - # rcount => $data->{rcount}, - # pullcount => $data->{icount} <= $data->{rcount} ? $data->{icount} : $data->{rcount}, - # itype => $data->{l_itype}, - # location => $data->{l_location}, - # thisitemonly => 1, - # - # } - # ); - # $previous=$this; - #} - #$sth->finish; } $template->param( @@ -287,14 +197,10 @@ $template->param( from => $startdate, to => $enddate, run_report => $run_report, - report_page => $report_page, - prev_results => $prev_results, - next_results => $next_results, - next_or_previous => $next_or_previous, reserveloop => \@reservedata, "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), - dateformat => C4::Context->preference("dateformat"), + dateformat => C4::Context->preference("dateformat"), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt index c965e5c..19260a9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -7,25 +7,42 @@ - - + + + + @@ -49,131 +66,70 @@ $.tablesorter.addParser({
[% IF ( reserveloop ) %] - - - - - - - - - - - - - - - - - [% IF ( next_or_previous ) %] - - - - - - [% END %] - [% FOREACH reserveloo IN reserveloop %] - - [% IF ( reserveloo.borrowernumber ) %] - - - - - [% ELSE %] - - - [% END %] - - - - - - - - - [% END %] - [% IF ( next_or_previous ) %] - - - - - - [% END %] - + + + + + + + + + + + + + + + + + [% FOREACH reserveloo IN reserveloop %] + + [% IF ( reserveloo.borrowernumber ) %] + + + + + [% ELSE %] + + + + + [% END %] + + + + + + + + + [% END %] + + + + + + + + + + + + + + + +
- Pull This Many Items - - Items Available - - Patrons with Holds - Title - Sort - - Libraries - Sort - - Available Call Numbers - Sort - - Available Copy No - - Available Enumeration - - Available Itypes - Sort - - Available Locations - Sort - Earliest Hold Date - Sort -
- [% IF ( prev_results ) %] -
- - - - -
- [% END %] -
- [% IF ( next_results ) %] -
- - - - -
- [% END %] -

[% reserveloo.pullcount %]

[% reserveloo.count %][% reserveloo.rcount %] -

- [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %] - [% reserveloo.title |html %] [% reserveloo.subtitle %] - -

-
-   - "

[% reserveloo.holdingbranch %]

[% reserveloo.itemcallnumber %]

[% reserveloo.copyno %]

[% reserveloo.enumchron %]

[% reserveloo.itype %]

[% reserveloo.location %]

-

[% reserveloo.reservedate %]

-

in [% reserveloo.branch %]

- [% IF ( reserveloo.statusw ) %]

Waiting

[% END %][% IF ( reserveloo.statusf ) %]

Fullfilled

[% END %] -
- [% IF ( prev_results ) %] -
- - - - -
- [% END %] -
- [% IF ( next_results ) %] -
- - - - -
- [% END %] -
Pull This Many ItemsItems AvailablePatrons with HoldsTitleLibrariesAvailable Call NumbersAvailable Copy NoAvailable EnumerationAvailable ItypesAvailable LocationsEarliest Hold Date

[% reserveloo.pullcount %]

[% reserveloo.count %][% reserveloo.rcount %] +

+ [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %] + [% reserveloo.title |html %] [% reserveloo.subtitle %] + +

+
""""[% reserveloo.holdingbranch %]

[% reserveloo.itemcallnumber %]

[% reserveloo.copyno %]

[% reserveloo.enumchron %]

[% reserveloo.itype %][% reserveloo.location %] +

[% reserveloo.reservedate %]

+

in [% reserveloo.branch %]

+ [% IF ( reserveloo.statusw ) %]

Waiting

[% END %][% IF ( reserveloo.statusf ) %]

Fullfilled

[% END %] +
[% ELSE %] No items found. -- 1.7.0.4 From julian.maurice at biblibre.com Fri Mar 2 16:50:44 2012 From: julian.maurice at biblibre.com (julian.maurice at biblibre.com) Date: Fri, 2 Mar 2012 16:50:44 +0100 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 7517: Revised Patch. Patron category types not displaying in dropdown. Message-ID: <1330703444-8455-1-git-send-email-julian.maurice@biblibre.com> From: Garry Collum The patron category drop-down box does not display the general category groups as it once did. This patch fixes the display of the optgroups. To test. Before applying the patch, go to a patron record. Edit the patron. Select the category drop-down in Library Management to see if the general categories appear. After the patch is applied the dropdown will show the categories. 'Child' - child categories, 'Adult' - adult categories, etc. Fixes XHTML errors. 1. Invalid end tag for cardnumber input. 2. Extra quote in textarea. 3. The label for debarredcomment did not have a corresponding id. There are two instances of this id field because of an 'IF' statement, this patch failed QA in the prior patch because only one of these ids was changed. Signed-off-by: Julian Maurice --- .../prog/en/modules/members/memberentrygen.tt | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 51a1ba1..13c4b0f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -176,7 +176,7 @@ [% IF step == 4 || step == 5 || step == 6 || step == 2 || step == 1 %] [%# Only put the cardnumber if we arent showing it in the form later %] [% IF cardnumber %] - + [% END %] [% END %] [% END %] @@ -992,12 +992,12 @@ [% FOREACH typeloo IN typeloop %] [% FOREACH categoryloo IN typeloo.categoryloop %] [% IF ( loop.first ) %] - [% IF ( categoryloo.typename_C ) %][% END %] - [% IF ( categoryloo.typename_A ) %][% END %] - [% IF ( categoryloo.typename_S ) %][% END %] - [% IF ( categoryloo.typename_I ) %][% END %] - [% IF ( categoryloo.typename_P ) %][% END %] - [% IF ( categoryloo.typename_X ) %][% END %] + [% IF ( typeloo.typename_C ) %][% END %] + [% IF ( typeloo.typename_A ) %][% END %] + [% IF ( typeloo.typename_S ) %][% END %] + [% IF ( typeloo.typename_I ) %][% END %] + [% IF ( typeloo.typename_P ) %][% END %] + [% IF ( typeloo.typename_X ) %][% END %] [% END %] [% IF ( categoryloo.categorycodeselected ) %] @@ -1307,9 +1307,9 @@
[% IF opduplicate %] - + [% ELSE %] - + [% END %] Show Calendar + + + @@ -21,7 +38,7 @@
[% IF ( issues ) %]

Checked out [% total %] times

- +
@@ -47,22 +64,26 @@ [% END %] -- 1.6.5 From srdjan at catalyst.net.nz Tue Mar 6 06:57:38 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Tue, 06 Mar 2012 15:57:38 +1000 Subject: [Koha-patches] [PATCH] Bug 5668 - star ratings in the OPAC Message-ID: <4F55A752.5030808@catalyst.net.nz> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Bug-5668-star-ratings-in-the-OPAC.patch Type: text/x-patch Size: 36195 bytes Desc: not available URL: From oleonard at myacpl.org Tue Mar 6 16:06:07 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Tue, 6 Mar 2012 10:06:07 -0500 Subject: [Koha-patches] [PATCH] Bug 7644 - Invalid markup in staff client language chooser Message-ID: <1331046367-28706-1-git-send-email-oleonard@myacpl.org> This patch removes invalid markup from the language chooser in the intranet. It also copies the markup and style of the staff client include to the OPAC so the two are more consistent. I hope that will make future changes and debugging a little easier. I believe this patch also fixes Bug 7366, "Language chooser display problems." --- .../intranet-tmpl/prog/en/css/staff-global.css | 9 ++- .../prog/en/includes/intranet-bottom.inc | 4 +- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 61 ++++++++++++++----- .../opac-tmpl/prog/en/includes/opac-bottom.inc | 64 ++++++++++---------- 4 files changed, 87 insertions(+), 51 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index fec66d6..2ffbc4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -1738,10 +1738,15 @@ ul#i18nMenu { ul#i18nMenu li { border-left : 1px solid #CCC; display : inline; + float: left; list-style : none; padding : 0 10px; - } - +} + +ul#i18nMenu li.yuimenuitem { + float: none; +} + ul#i18nMenu li:first-child { border-left : 0; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc index ebe7f37..7dd5d17 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc @@ -5,7 +5,7 @@
diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index f2b1467..70db2f9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -1476,29 +1476,58 @@ div#changelanguage{ div#changelanguage a { font-weight : normal; - padding : .5em; -} - -div#changelanguage a.more { - background-image:url(../../images/more-up-arrow.gif); - background-position:right center; - background-repeat:no-repeat; - padding-right:13px; + padding : .5em 0; } - + div#changelanguage li.yuimenuitem { - font-size : 120%; - font-weight : normal; - margin : 0; - padding : 0 1em; + font-size: 120%; + font-weight: normal; + margin: 0; + padding: 0 1em; } - div#changelanguage li.yuimenuitem a.yuimenuitemlabel { + padding: 0; +} + +ul#i18nMenu { + margin : 0; + padding : .2em 0; + } + +ul#i18nMenu li { + border-left : 1px solid #CCC; + display : inline; + list-style : none; + padding : 0 .4em; + } + +ul#i18nMenu li:first-child { + border-left : 0; + } + +ul#i18nMenu li ul li { + border : 0; + display : block; padding : 0; + } + + +ul#i18nMenu li.more a { + background-image:url(../../images/more-up-arrow.gif); + background-position:right center; + background-repeat:no-repeat; + padding-right: 1.3em; +} + +ul#i18nMenu li.more ul li a { + background-image : none; + padding: 0 1.3em; } -div.lang{ - float:left; +span.lang{ + float:left; + border-right : 1px solid black; + padding : 0 .5em; } #cartDetails,#cartUpdate,#holdDetails,#listsDetails { diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc index a264af3..46e195d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc @@ -6,43 +6,46 @@ [% IF ( opaclanguagesdisplay || OpacKohaUrl ) %] -
-[% IF ( languages_loop && opaclanguagesdisplay ) %] - [% UNLESS ( one_language_enabled ) %] -
Languages: 
- [% FOREACH languages_loo IN languages_loop %] -
- [% IF ( languages_loo.group_enabled ) %] - [% IF ( languages_loo.plural ) %] - [% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %][% UNLESS ( loop.last ) %] | [% END %] -
-
+ [% ELSE %] - [% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %] + [% IF ( languages_loo.group_enabled ) %] + [% IF ( languages_loo.current ) %] +
  • [% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %]
  • + [% ELSE %] +
  • [% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %]
  • + [% END %] + [% END %] + [% END %] [% END %] - [% END %] + [% END %] - [% END %][% UNLESS ( loop.last || languages_loo.plural ) %] | [% END %] +
    [% END %] [% END %] -[% END %] + [% IF ( OpacKohaUrl ) %] @@ -50,7 +53,6 @@ [% END %] -
    [% END %] [% IF ( Babeltheque ) %] -- 1.7.3 From stephane.delaune at biblibre.com Tue Mar 6 16:21:53 2012 From: stephane.delaune at biblibre.com (=?UTF-8?q?St=C3=A9phane=20Delaune?=) Date: Tue, 6 Mar 2012 16:21:53 +0100 Subject: [Koha-patches] [PATCH] Bug 5749 Fix borrower address display in intranet Message-ID: <1331047313-13000-1-git-send-email-stephane.delaune@biblibre.com> --- .../prog/en/modules/members/moremember-brief.tt | 2 +- .../prog/en/modules/members/moremember.tt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt index 6341705..f7ca5ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt @@ -18,7 +18,7 @@

    [% streetnumber %] [% IF ( roaddetails ) %] - [% roaddetails %], + [% roaddetails %] [% END %] [% address %]
    [% IF ( address2 ) %][% address2 %]
    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index c3d7063..bd19584 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -186,7 +186,7 @@ function validate1(date) {

    [% streetnumber %] [% IF ( roaddetails ) %] - [% roaddetails %], + [% roaddetails %] [% END %] [% address %]
    [% IF ( address2 ) %][% address2 %]
    [% END %] -- 1.7.5.4 From oleonard at myacpl.org Tue Mar 6 16:26:49 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Tue, 6 Mar 2012 10:26:49 -0500 Subject: [Koha-patches] [PATCH] Bug 5596 - add author to holds to pull report Message-ID: <1331047609-31968-1-git-send-email-oleonard@myacpl.org> Adding output of author and, for good measure, subtitle. --- circ/pendingreserves.pl | 6 ++++++ .../prog/en/modules/circ/pendingreserves.tt | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index d723bc2..ae5b58f 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -29,6 +29,7 @@ use C4::Context; use C4::Output; use CGI; use C4::Auth; +use C4::Biblio; use C4::Dates qw/format_date format_date_in_iso/; use C4::Debug; use Date::Calc qw/Today Add_Delta_YMD/; @@ -184,6 +185,10 @@ if ( $run_report ) { my $previous; my $this; while ( my $data = $sth->fetchrow_hashref ) { + my $record = GetMarcBiblio($data->{biblionumber}); + if ($record){ + $data->{subtitle} = GetRecordValue('subtitle',$record,'')->[0]->{subfield}; + } $this=$data->{biblionumber}.":".$data->{borrowernumber}; my @itemlist; push( @@ -193,6 +198,7 @@ if ( $run_report ) { priority => $data->{priority}, name => $data->{l_patron}, title => $data->{title}, + subtitle => $data->{subtitle}, author => $data->{author}, borrowernumber => $data->{borrowernumber}, itemnum => $data->{itemnumber}, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt index c965e5c..c1c977d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -125,8 +125,8 @@ $.tablesorter.addParser({

    [% ELSE %] -- 1.7.3 From oleonard at myacpl.org Tue Mar 6 18:44:51 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Tue, 6 Mar 2012 12:44:51 -0500 Subject: [Koha-patches] [PATCH] Bug 5345 [FOLLOW-UP] DataTables in Koha Message-ID: <1331055891-2960-1-git-send-email-oleonard@myacpl.org> Adding two missing images: The "disabled" version of the next and previous buttons. --- koha-tmpl/intranet-tmpl/prog/img/next-disabled.png | Bin 0 -> 866 bytes koha-tmpl/intranet-tmpl/prog/img/prev-disabled.png | Bin 0 -> 862 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/img/next-disabled.png create mode 100644 koha-tmpl/intranet-tmpl/prog/img/prev-disabled.png diff --git a/koha-tmpl/intranet-tmpl/prog/img/next-disabled.png b/koha-tmpl/intranet-tmpl/prog/img/next-disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..58b03409bfbe94b6eca9d45b3442245664d4b754 GIT binary patch literal 866 zcmV-o1D*VdP)&y?y)kBv8+d+}zwRAUS{l0viC*3^d(P zM at Pp+TwFXtR8&-ro12?~gM)(sY5>ERFJBlQKYo1c)vH%4?%cVv2dMr$&^2EG0*D3b z5)F`Mpv^@}N=iIHn;Cxn`o-||>sPQOD=RC5n3xy?FE6j!- at kv0fSBR_{rlg6QfB}H zh*?-zSPE#X3s7USva+%yNb|F25O0DM{`>cj;p4}T48MQ>X5i!FV-OM&VgtHD66mU@ zhYufq3J^d{K&MDcN=j-0ZBPSg2Ktp@&YU at 5C&R$(*|Wi}dGqEC11BdZgMxyB8qj-M zAiV$q!~_fjQJ{YfKz{!D^C#F=P`J#UI~S}8 zfuaf&+Ax2E0LTCkUbt`}!;c?7z-*8~ixw?n`0(Ka12Bd_Vj4gf at B;)8$O~{=Kr}2` znVFfv1_A>PEDqy?G=peRn1Iv*1Q5szAAz>q067ih3YcP$g5u(0a1?@K;m at Bx3?(Hc z3`|T+48XJiGUNu(o{sl7rh+t=mX?D33*v)p1Q`YjSS~IuhNn-T zg2XO>^a2DBv!|ygDBwhZSOpk3!oX-^FfuX%YX-RngdH6n!J1`cWWbt%(RT}|ehbim zQvdP)=>w?#3((86f$H}G zlk-i000O5(pyC at ZUcBH0h4`L5dm_};)zyHBi-Dh?A8ZKFU{EqPkh!Ia2goHT| zYw_^#7_hOiX at KN^{P=O>^XJbOUc7j5?aiAvCxOau01f&A(gzSgU<06<4Rv*OUBt!3 zBSb|-)wsF288|pNz=nVS{+$760K=0fPj0<>^=if4yLa~h)t?6$0uVqfAO#?sL7IU! z7bz(z at c?aR`2G7g!`H80!3MCfurL4(X5i!FQ~Ue(ZxIkP+`oVSJ5cHjKmaj|h=@o5 zC0&3TlYv;0ot>TGSXo&$K(>PdYudDF zV5k54_mAP%uU}xzFqeS512O<;AvoNChVlah5XcK)#ULA)n3x#2xVXRyL41&NK`sLY zB1jE1z`+KCya{3h1Q5szAA!!i0Sa-TOBj-qlNo?%0BiurJDHi8U_QujkOolHzI*o$ zWHu>I4WNW=~H~ zkdsA#rmF}D2nYkC37lvQ3=F^;VE)(B(_ at g9mS%YR^eMyP!-sDH^=tu(p8^OV=55=y zeLi&P(0`y4f4_eH+87kiz$k?WB*-hEKm!`i at a)+$hV9$8e*p&eY at qsmz?66sAb?n) zdE&k literal 0 HcmV?d00001 -- 1.7.3 From srdjan at catalyst.net.nz Wed Mar 7 05:03:16 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Wed, 7 Mar 2012 17:03:16 +1300 Subject: [Koha-patches] [PATCH] bug_6488: dispaly OPAC search result count conditional to OpacHiddenItems syspref In-Reply-To: References: Message-ID: <1331092996-15998-1-git-send-email-srdjan@catalyst.net.nz> --- .../opac-tmpl/prog/en/modules/opac-results.tt | 1 + opac/opac-search.pl | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt index 22c9272..4d1f609 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -381,6 +381,7 @@ $(document).ready(function(){ + [% UNLESS ( item_level_itypes ) %] [% UNLESS ( noItemTypeImages ) %] diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 3e3995d..26d1a59 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -625,8 +625,12 @@ for (my $i=0;$i<@servers;$i++) { } $template->param(stopwords_removed => "@$stopwords_removed") if $stopwords_removed; $template->param(results_per_page => $results_per_page); - $template->param(SEARCH_RESULTS => \@newresults, - OPACItemsResultsDisplay => (C4::Context->preference("OPACItemsResultsDisplay") eq "itemdetails"?1:0), + my $hide = C4::Context->preference('OpacHiddenItems'); + $hide = ($hide =~ m/\S/) if $hide; # Just in case it has some spaces/new lines + $template->param( + SEARCH_RESULTS => \@newresults, + OPACItemsResultsDisplay => (C4::Context->preference("OPACItemsResultsDisplay") eq "itemdetails"?1:0), + supress_result_number => $hide, ); if (C4::Context->preference("OPACLocalCoverImages")){ $template->param(OPACLocalCoverImages => 1); -- 1.6.5 From srdjan at catalyst.net.nz Wed Mar 7 05:39:20 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Wed, 7 Mar 2012 17:39:20 +1300 Subject: [Koha-patches] [PATCH] bug_7458: correct next call number allocation in case multiple items have same call number In-Reply-To: References: Message-ID: <1331095160-20642-1-git-send-email-srdjan@catalyst.net.nz> --- cataloguing/value_builder/callnumber-KU.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cataloguing/value_builder/callnumber-KU.pl b/cataloguing/value_builder/callnumber-KU.pl index e0fa444..9fdc6b7 100755 --- a/cataloguing/value_builder/callnumber-KU.pl +++ b/cataloguing/value_builder/callnumber-KU.pl @@ -116,7 +116,7 @@ sub plugin { if ($num1 > $next) { # a hole in numbering found, stop last; } - $next++; + $next = $num1 + 1; } $ret = "$alpha $num_alpha" . sprintf("%0${len}d", $next) if length($next) <= $len; # no overflow } -- 1.6.5 From srdjan at catalyst.net.nz Wed Mar 7 05:45:44 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Wed, 7 Mar 2012 17:45:44 +1300 Subject: [Koha-patches] [PATCH] bug_7458: Correct existing existing call numbers retrieval In-Reply-To: References: Message-ID: <1331095544-20992-1-git-send-email-srdjan@catalyst.net.nz> --- cataloguing/value_builder/callnumber-KU.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cataloguing/value_builder/callnumber-KU.pl b/cataloguing/value_builder/callnumber-KU.pl index e0fa444..201f9c8 100755 --- a/cataloguing/value_builder/callnumber-KU.pl +++ b/cataloguing/value_builder/callnumber-KU.pl @@ -104,7 +104,7 @@ sub plugin { if ( my $first = $dbh->selectrow_array("SELECT itemcallnumber FROM items WHERE itemcallnumber = ?", undef, $padded) ) { - my $icn = $dbh->selectcol_arrayref("SELECT itemcallnumber + my $icn = $dbh->selectcol_arrayref("SELECT DISTINCT itemcallnumber FROM items WHERE itemcallnumber LIKE ? AND itemcallnumber > ? -- 1.6.5 From srdjan at catalyst.net.nz Wed Mar 7 08:03:36 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Wed, 7 Mar 2012 20:03:36 +1300 Subject: [Koha-patches] [PATCH] bug_3966: Update items on receive In-Reply-To: References: Message-ID: <1331103816-31997-1-git-send-email-srdjan@catalyst.net.nz> Changed AddItem() and ModItem() interface so now they return item record. AddItemFromMarc() looks for itemnumber, and calls ModItem() if one is found. --- C4/Acquisition.pm | 51 +++------- C4/Biblio.pm | 2 - C4/ImportBatch.pm | 4 +- C4/Items.pm | 25 +++-- acqui/addorder.pl | 5 +- acqui/addorderiso2709.pl | 4 +- acqui/booksellers.pl | 11 +-- acqui/finishreceive.pl | 103 ++++++++++++-------- acqui/orderreceive.pl | 63 ++++++------- cataloguing/additem.pl | 8 +- .../prog/en/modules/acqui/orderreceive.tt | 36 +++---- t/db_dependent/lib/KohaTest.pm | 16 +-- .../lib/KohaTest/Acquisition/GetParcel.pm | 17 +--- .../lib/KohaTest/Acquisition/GetParcels.pm | 18 +--- t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm | 6 +- 15 files changed, 174 insertions(+), 195 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 0a96a02..bef6625 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1083,16 +1083,14 @@ sub GetCancelledOrders { =head3 ModReceiveOrder - &ModReceiveOrder($biblionumber, $ordernumber, $quantityreceived, $user, - $unitprice, $booksellerinvoicenumber, $biblioitemnumber, - $freight, $bookfund, $rrp); + &ModReceiveOrder($biblionumber, $ordernumber, $quantityreceived, $receiveditems); Updates an order, to reflect the fact that it was received, at least -in part. All arguments not mentioned below update the fields with the -same name in the aqorders table of the Koha database. +in part. If a partial order is received, splits the order into two. The received -portion must have a booksellerinvoicenumber. +portion must have a booksellerinvoicenumber. If $receiveditems are supplied, +the rest of the items will be moved to the new order. Updates the order with bibilionumber C<$biblionumber> and ordernumber C<$ordernumber>. @@ -1101,13 +1099,9 @@ C<$ordernumber>. sub ModReceiveOrder { - my ( - $biblionumber, $ordernumber, $quantrec, $user, $cost, - $invoiceno, $freight, $rrp, $budget_id, $datereceived - ) - = @_; + my ( $biblionumber, $ordernumber, $quantrec, $receiveditems ) = @_; my $dbh = C4::Context->dbh; - $datereceived = C4::Dates->output('iso') unless $datereceived; + my $suggestionid = GetSuggestionFromBiblionumber( $dbh, $biblionumber ); if ($suggestionid) { ModSuggestion( {suggestionid=>$suggestionid, @@ -1125,36 +1119,23 @@ sub ModReceiveOrder { $sth->finish(); if ( $order->{quantity} > $quantrec ) { - $sth=$dbh->prepare(" - UPDATE aqorders - SET quantityreceived=? - , datereceived=? - , booksellerinvoicenumber=? - , unitprice=? - , freight=? - , rrp=? - , quantity=? - WHERE biblionumber=? AND ordernumber=?"); - - $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber); - $sth->finish; - # create a new order for the remaining items, and set its bookfund. foreach my $orderkey ( "linenumber", "allocation" ) { delete($order->{'$orderkey'}); } $order->{'quantity'} -= $quantrec; $order->{'quantityreceived'} = 0; - my $newOrder = NewOrder($order); -} else { - $sth=$dbh->prepare("update aqorders - set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?, - unitprice=?,freight=?,rrp=? - where biblionumber=? and ordernumber=?"); - $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber); - $sth->finish; + my (undef, $newOrder) = NewOrder($order); + + if ($receiveditems && @$receiveditems) { + my $sql = " + UPDATE aqorders_items + SET ordernumber = ? + WHERE ordernumber = ? + AND itemnumber NOT IN (".join(",", map "?", @$receiveditems).")"; + $dbh->do($sql, undef, $newOrder, $ordernumber, @$receiveditems); + } } - return $datereceived; } #------------------------------------------------------------# diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 50830ec..e4ce5a1 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2470,8 +2470,6 @@ sub TransformMarcToKohaOneField { } -#" - # # true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates # at the same time diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 63cc60b..cc054ad 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -547,10 +547,10 @@ sub BatchCommitItems { $updsth->execute(); $num_items_errored++; } else { - my ($item_biblionumber, $biblioitemnumber, $itemnumber) = AddItemFromMarc($item_marc, $biblionumber); + my $item = AddItemFromMarc($item_marc, $biblionumber); my $updsth = $dbh->prepare("UPDATE import_items SET status = ?, itemnumber = ? WHERE import_items_id = ?"); $updsth->bind_param(1, 'imported'); - $updsth->bind_param(2, $itemnumber); + $updsth->bind_param(2, $item->{itemnumber}); $updsth->bind_param(3, $row->{'import_items_id'}); $updsth->execute(); $updsth->finish(); diff --git a/C4/Items.pm b/C4/Items.pm index 8025529..96904e5 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -194,11 +194,11 @@ sub CartToShelf { =head2 AddItemFromMarc - my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItemFromMarc($source_item_marc, $biblionumber); + my $item = AddItemFromMarc($source_item_marc, $biblionumber); Given a MARC::Record object containing an embedded item -record and a biblionumber, create a new item record. +record and a biblionumber, create a new item record or update +existing one. =cut @@ -214,13 +214,15 @@ sub AddItemFromMarc { $localitemmarc->append_fields($source_item_marc->field($itemtag)); my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode ,'items'); my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode); + if (my $itemnumber = $item->{itemnumber}) { + return ModItem($item, $biblionumber, $itemnumber, $dbh, $frameworkcode, $unlinked_item_subfields); + } return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields); } =head2 AddItem - my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]); + my $item = AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]); Given a hash containing item column names as keys, create a new Koha item record. @@ -272,7 +274,7 @@ sub AddItem { logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); - return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber); + return $item; } =head2 AddItemBatchFromMarc @@ -451,6 +453,7 @@ sub ModItemFromMarc { $item->{$item_field} = $default_values_for_mod_from_marc{$item_field} unless (exists $item->{$item_field}); } my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); + $itemnumber ||= $item->{itemnumber}; ModItem($item, $biblionumber, $itemnumber, $dbh, $frameworkcode, $unlinked_item_subfields); return $item; @@ -458,7 +461,7 @@ sub ModItemFromMarc { =head2 ModItem - ModItem({ column => $newvalue }, $biblionumber, $itemnumber); + my $item = ModItem({ column => $newvalue }, $biblionumber, $itemnumber); Change one or more columns in an item record and update the MARC representation of the item. @@ -521,6 +524,8 @@ sub ModItem { ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef ); logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog"); + + return $item; } =head2 ModItemTransfer @@ -2533,7 +2538,7 @@ sub _find_value { =head2 PrepareItemrecordDisplay - PrepareItemrecordDisplay($itemrecord,$bibnum,$itemumber,$frameworkcode); + PrepareItemrecordDisplay(bibnum,$itemumber,$itemrecord,$$frameworkcode); Returns a hash with all the fields for Display a given item data in a template @@ -2712,14 +2717,14 @@ sub PrepareItemrecordDisplay { $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? my $index_subfield = int(rand(1000000)); $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; - $subfield_data{marc_value} = qq[ ... $javascript]; } else { warn "Plugin Failed: $plugin"; - $subfield_data{marc_value} = qq(); # supply default input form + $subfield_data{marc_value} = qq(); # supply default input form } } elsif ( $tag eq '' ) { # it's an hidden field diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 279084b..e977c23 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -262,9 +262,8 @@ if ( $orderinfo->{quantity} ne '0' ) { $itemhash{$item}->{'indicator'}, 'ITEM'); my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); - my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$$orderinfo{biblionumber}); - NewOrderItem($itemnumber, $$orderinfo{ordernumber}); - + my $item = AddItemFromMarc($record,$$orderinfo{biblionumber}); + NewOrderItem($item->{itemnumber}, $$orderinfo{ordernumber}); } } diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index bbfd3b7..3bc82f2 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -260,8 +260,8 @@ if ($op eq ""){ my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator ); my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); for (my $qtyloop=1;$qtyloop <=$quantity;$qtyloop++) { - my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); - NewOrderItem( $itemnumber, $ordernumber ); + my $item = AddItemFromMarc( $record, $biblionumber ); + NewOrderItem( $item->{itemnumber}, $ordernumber ); } } else { SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index d7c64db..8815905 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -111,17 +111,14 @@ for my $vendor (@suppliers) { for my $basket ( @{$baskets} ) { my $authorisedby = $basket->{authorisedby}; - my $basketbranch = ''; # set a blank branch to start with - if ( GetMember( borrowernumber => $authorisedby ) ) { - # authorisedby may not be a valid borrowernumber; it's not foreign-key constrained! - $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode}; - } + my $basketbranch = ''; + $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode} if $authorisedby; if ($userenv->{'flags'} & 1 || #user is superlibrarian (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and ($viewbaskets eq 'all' || #user is allowed to see all baskets - ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq $basketbranch) || #basket belongs to user's branch - ($basket->{authorisedby} && $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket + ($viewbaskets eq 'branch' && $userbranch eq $basketbranch) || #basket belongs to user's branch + ($basket->{authorisedby} && $viewbaskets == 'user' && $authorisedby eq $loggedinuser) #user created this basket ) ) ) { diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 90a85fe..db57446 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -26,10 +26,10 @@ use CGI; use C4::Auth; use C4::Output; use C4::Context; +use C4::Dates; use C4::Acquisition; use C4::Biblio; use C4::Items; -use C4::Search; use List::MoreUtils qw/any/; my $input=new CGI; @@ -44,57 +44,79 @@ my $quantityrec=$input->param('quantityrec'); my $quantity=$input->param('quantity'); my $unitprice=$input->param('cost'); my $invoiceno=$input->param('invoice'); -my $datereceived=$input->param('datereceived'); +my $datereceived=$input->param('datereceived') || C4::Dates->output('iso'); my $replacement=$input->param('rrp'); my $gst=$input->param('gst'); my $freight=$input->param('freight'); my $booksellerid = $input->param('booksellerid'); my $cnt=0; -my $error_url_str; +my $error_url_str = ''; my $ecost = $input->param('ecost'); my $note = $input->param("note"); +my $order = GetOrder($ordernumber); +$order->{booksellerinvoicenumber} = $invoiceno; +$order->{datereceived} = $datereceived; +$order->{freight} = $freight; +$order->{quantity} = $quantity; +$order->{quantityreceived} = $quantityrec; +$order->{notes} = $note; +$order->{rrp} = $replacement; +$order->{ecost} = $ecost; +$order->{unitprice} = $unitprice; +ModOrder($order); + #need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME -if ($quantityrec > $origquantityrec ) { - # now, add items if applicable - if (C4::Context->preference('AcqCreateItem') eq 'receiving') { - my @tags = $input->param('tag'); - my @subfields = $input->param('subfield'); - my @field_values = $input->param('field_value'); - my @serials = $input->param('serial'); - my @itemid = $input->param('itemid'); - my @ind_tag = $input->param('ind_tag'); - my @indicator = $input->param('indicator'); - #Rebuilding ALL the data for items into a hash - # parting them on $itemid. - my %itemhash; - my $countdistinct; - my $range=scalar(@itemid); - for (my $i=0; $i<$range; $i++){ - unless ($itemhash{$itemid[$i]}){ - $countdistinct++; - } - push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i]; - push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i]; - push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i]; - push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i]; - push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; - } - foreach my $item (keys %itemhash){ - my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'}, - $itemhash{$item}->{'subfields'}, - $itemhash{$item}->{'field_values'}, - $itemhash{$item}->{'ind_tag'}, - $itemhash{$item}->{'indicator'},'ITEM'); - my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); - my (undef,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$biblionumber); - NewOrderItem($itemnumber, $ordernumber); - } +# now, add or update items if applicable +my @tags = $input->param('tag'); +my @subfields = $input->param('subfield'); +my @field_values = $input->param('field_value'); +my @serials = $input->param('serial'); +my @itemid = $input->param('itemid'); +my @ind_tag = $input->param('ind_tag'); +my @indicator = $input->param('indicator'); +#Rebuilding ALL the data for items into a hash +# parting them on $itemid. +my %itemhash; +my $countdistinct; +my $range=scalar(@itemid); +for (my $i=0; $i<$range; $i++){ + unless ($itemhash{$itemid[$i]}){ + $countdistinct++; + } + push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i]; + push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i]; + push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i]; + push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i]; + push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; +} +my $error; +my %itemnumbers = map { $_ => 1 } GetItemnumbersFromOrder($ordernumber); +my @received; +foreach my $id (keys %itemhash){ + my $xml = TransformHtmlToXml( $itemhash{$id}->{'tags'}, + $itemhash{$id}->{'subfields'}, + $itemhash{$id}->{'field_values'}, + $itemhash{$id}->{'ind_tag'}, + $itemhash{$id}->{'indicator'},'ITEM'); + my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); + my $item = AddItemFromMarc($record,$biblionumber); + my $itemnumber = $item ? $item->{itemnumber} : undef; + if ($itemnumber) { + push @received, $itemnumber; + NewOrderItem($itemnumber, $ordernumber) unless $itemnumbers{$itemnumber}; + } else { + $error++; } - +} + +if ($error) { + $error_url_str = "&error=Datbase+write+error"; +} +else { # save the quantity received. - $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoiceno,$freight,$replacement,undef,$datereceived); + ModReceiveOrder($biblionumber,$ordernumber, $quantityrec, \@received); } update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber ); @@ -114,3 +136,4 @@ sub update_item { replacementpricedate => $datereceived, }, $biblionumber, $itemnumber ); } + diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 659c103..3f2995d 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -87,21 +87,13 @@ my $search = $input->param('receive'); my $invoice = $input->param('invoice'); my $freight = $input->param('freight'); my $datereceived = $input->param('datereceived'); - - $datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new(); my $bookseller = GetBookSellerFromId($booksellerid); my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; my $results = SearchOrder($ordernumber,$search); - - my $count = scalar @$results; -my $order = GetOrder($ordernumber); - - -my $date = @$results[0]->{'entrydate'}; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -116,24 +108,27 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( # prepare the form for receiving if ( $count == 1 ) { - if (C4::Context->preference('AcqCreateItem') eq 'receiving') { + my $order = GetOrder($results->[0]->{ordernumber}); + my $biblionumber = $order->{biblionumber}; + + my @itemloop; + if ( my @itemnumbers = GetItemnumbersFromOrder($ordernumber) ) { + @itemloop = map PrepareItemrecordDisplay($biblionumber,$_), @itemnumbers; + } + elsif (C4::Context->preference('AcqCreateItem') eq 'receiving') { # prepare empty item form my $cell = PrepareItemrecordDisplay('','','','ACQ'); unless ($cell) { $cell = PrepareItemrecordDisplay('','','',''); $template->param('NoACQframework' => 1); } - my @itemloop; push @itemloop,$cell; - - $template->param(items => \@itemloop); } + + $template->param(items => \@itemloop) if @itemloop; - if ( @$results[0]->{'quantityreceived'} == 0 ) { - @$results[0]->{'quantityreceived'} = ''; - } - if ( @$results[0]->{'unitprice'} == 0 ) { - @$results[0]->{'unitprice'} = ''; + if ( $order->{'unitprice'} == 0 ) { + $order->{'unitprice'} = ''; } my $suggestion = GetSuggestionInfoFromBiblionumber(@$results[0]->{'biblionumber'}); @@ -145,26 +140,26 @@ if ( $count == 1 ) { $template->param( count => 1, - biblionumber => @$results[0]->{'biblionumber'}, - ordernumber => @$results[0]->{'ordernumber'}, - biblioitemnumber => @$results[0]->{'biblioitemnumber'}, - booksellerid => @$results[0]->{'booksellerid'}, + biblionumber => $biblionumber, + ordernumber => $order->{'ordernumber'}, + biblioitemnumber => $order->{'biblioitemnumber'}, + booksellerid => $booksellerid, freight => $freight, gst => $gst, name => $bookseller->{'name'}, - date => format_date($date), - title => @$results[0]->{'title'}, - author => @$results[0]->{'author'}, - copyrightdate => @$results[0]->{'copyrightdate'}, - isbn => @$results[0]->{'isbn'}, - seriestitle => @$results[0]->{'seriestitle'}, - bookfund => $budget->{budget_name}, - quantity => @$results[0]->{'quantity'}, - quantityreceivedplus1 => @$results[0]->{'quantityreceived'} + 1, - quantityreceived => @$results[0]->{'quantityreceived'}, - rrp => @$results[0]->{'rrp'}, - ecost => @$results[0]->{'ecost'}, - unitprice => @$results[0]->{'unitprice'}, + date => format_date($order->{'entrydate'}), + title => $order->{'title'}, + author => $order->{'author'}, + copyrightdate => $order->{'copyrightdate'}, + isbn => $order->{'isbn'}, + seriestitle => $order->{'seriestitle'}, + bookfund => $order->{'bookfundid'}, + quantity => $order->{'quantity'}, + quantityreceived => scalar(@itemloop) || 1, + origquantityrec => $order->{'quantityreceived'}, + rrp => $order->{'rrp'}, + ecost => $order->{'ecost'}, + unitprice => $order->{'unitprice'}, memberfirstname => $member->{firstname} || "", membersurname => $member->{surname} || "", invoice => $invoice, diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 4bf06b5..8e2f81b 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -348,8 +348,8 @@ if ($op eq "additem") { push @errors,"barcode_not_unique" if($exist_itemnumber); # if barcode exists, don't create, but report The problem. unless ($exist_itemnumber) { - my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); - set_item_default_location($oldbibitemnum); + my $item = AddItemFromMarc($record,$biblionumber); + set_item_default_location($item->{biblioitemnumber}); } $nextop = "additem"; if ($exist_itemnumber) { @@ -416,8 +416,8 @@ if ($op eq "additem") { # Adding the item if (!$exist_itemnumber) { - my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); - set_item_default_location($oldbibitemnum); + my $item = AddItemFromMarc($record,$biblionumber); + set_item_default_location($item->{biblioitemnumber}); # We count the item only if it was really added # That way, all items are added, even if there was some already existing barcodes diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index e238278..46b5f22 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -55,15 +55,15 @@

    No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used

    [% END %] + [% itemid = 1 %] [% FOREACH item IN items %] -
    -
    +
      [% FOREACH iteminformatio IN item.iteminformation %]
    1. [% iteminformatio.marc_value %] - + @@ -75,18 +75,18 @@
    2. [% END %]
    - Add - + +  + - + + + + + + + +
    -
    - - - - - - - - + [% itemid = itemid + 1 %] [% END %] [% END %] @@ -116,14 +116,12 @@ [% IF ( quantityreceived ) %] [% IF ( edit ) %] - [% ELSE %] [% IF ( items ) %] - + [% ELSE %] - + [% END %] - [% END %] [% ELSE %] [% IF ( items ) %] @@ -131,8 +129,8 @@ [% ELSE %] [% END %] - [% END %] +
  • diff --git a/t/db_dependent/lib/KohaTest.pm b/t/db_dependent/lib/KohaTest.pm index d8cf495..c632740 100644 --- a/t/db_dependent/lib/KohaTest.pm +++ b/t/db_dependent/lib/KohaTest.pm @@ -572,16 +572,12 @@ sub add_biblios { ok( $biblionumber, "the biblionumber is $biblionumber" ); ok( $biblioitemnumber, "the biblioitemnumber is $biblioitemnumber" ); if ( $param{'add_items'} ) { - # my @iteminfo = AddItem( {}, $biblionumber ); - my @iteminfo = AddItemFromMarc( $marcrecord, $biblionumber ); - is( $iteminfo[0], $biblionumber, "biblionumber is $biblionumber" ); - is( $iteminfo[1], $biblioitemnumber, "biblioitemnumber is $biblioitemnumber" ); - ok( $iteminfo[2], "itemnumber is $iteminfo[2]" ); - push @{ $self->{'items'} }, - { biblionumber => $iteminfo[0], - biblioitemnumber => $iteminfo[1], - itemnumber => $iteminfo[2], - }; + # my $item = AddItem( {}, $biblionumber ); + my $item = AddItemFromMarc( $marcrecord, $biblionumber ); + is( $item->{biblionumber}, "biblionumber is $biblionumber" ); + is( $item->{biblioitemnumber}, "biblioitemnumber is $biblioitemnumber" ); + ok( $item->{itemnumber}, "itemnumber is $item->{itemnumber}" ); + push @{ $self->{'items'} }, $item; } push @{$self->{'biblios'}}, $biblionumber; } diff --git a/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm b/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm index c26e5f2..b42ea9c 100644 --- a/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm +++ b/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm @@ -43,18 +43,11 @@ sub one_parcel : Test( 17 ) { ok( $basketno, "my basket number is $basketno" ); ok( $ordernumber, "my order number is $ordernumber" ); - my $datereceived = ModReceiveOrder( $self->{'biblios'}[0], # biblionumber - $ordernumber, # $ordernumber, - undef, # $quantrec, - undef, # $user, - undef, # $cost, - $invoice, # $invoiceno, - undef, # $freight, - undef, # $rrp, - $self->{'bookfundid'}, # $bookfund, - $today, # $datereceived - ); - is( $datereceived, $today, "the parcel was received on $datereceived" ); + ModReceiveOrder( $self->{'biblios'}[0], # biblionumber + $ordernumber, # $ordernumber, + 1, # $quantrec, + ); + pass( "the parcel was received" ); my @parcel = GetParcel( $self->{'booksellerid'}, $invoice, $today ); is( scalar @parcel, 1, 'we found one (1) parcel.' ) diff --git a/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm b/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm index fd3ad0f..b14095f 100644 --- a/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm +++ b/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm @@ -271,18 +271,12 @@ sub create_order { my ( $basketno, $ordernumber ) = $self->create_new_basket( %param ); - my $datereceived = ModReceiveOrder( $self->{'biblios'}[0], # biblionumber - $ordernumber, # $ordernumber, - undef, # $quantrec, - undef, # $user, - undef, # $cost, - $param{'invoice'}, # $invoiceno, - undef, # $freight, - undef, # $rrp, - $self->{'bookfundid'}, # $bookfund, - $param{'date'}, # $datereceived - ); - is( $datereceived, $param{'date'}, "the parcel was received on $datereceived" ); + ModReceiveOrder( $self->{'biblios'}[0], # biblionumber + $ordernumber, # $ordernumber, + 1, # $quantrec, + ); + # XXX Needs proper tests for partial receiving + pass( "the parcel was received" ); } diff --git a/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm b/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm index 5b29ea8..8a83268 100644 --- a/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm +++ b/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm @@ -31,10 +31,10 @@ sub add_bib_to_modify : Test( startup => 3 ) { $self->{'bib_to_modify'} = $bibnum; # add an item - my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); + my $item = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); - cmp_ok($item_bibnum, '==', $bibnum, "new item is linked to correct biblionumber"); - cmp_ok($item_bibitemnum, '==', $bibitemnum, "new item is linked to correct biblioitemnumber"); + cmp_ok($item->{biblionumber}, '==', $bibnum, "new item is linked to correct biblionumber"); + cmp_ok($item->{biblioitemnumber}, '==', $bibitemnum, "new item is linked to correct biblioitemnumber"); $self->reindex_marc(); -- 1.6.5 From srdjan at catalyst.net.nz Wed Mar 7 08:37:30 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Wed, 7 Mar 2012 20:37:30 +1300 Subject: [Koha-patches] [PATCH] Bug 4222 - allow nonpublicnote to be a mapped DB column In-Reply-To: References: Message-ID: <1331105850-32713-1-git-send-email-srdjan@catalyst.net.nz> This means that it's possible (and easy) to put non-public notes (usually 952$x) on a template, same as public notes. It creates a mapping between the 952$x field and the new database column. Note that when this is applied, it will only work on newly saved records. It is possible this will need to be altered to allow for UNIMARC etc. if they use 952 differently. --- catalogue/detail.pl | 11 ++++++++++- catalogue/moredetail.pl | 1 + circ/returns.pl | 1 + installer/data/mysql/kohastructure.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../prog/en/modules/catalogue/detail.tt | 2 ++ .../prog/en/modules/catalogue/moredetail.tt | 1 + .../prog/en/modules/circ/circulation.tt | 8 ++++---- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 1 + 9 files changed, 30 insertions(+), 5 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index db38551..9735a2e 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -243,6 +243,13 @@ foreach my $item (@items) { $item->{waitingdate} = format_date($wait_hashref->{waitingdate}); } + foreach my $f (qw( itemnotes nonpublicnote )) { + if ($item->{$f}) { + $item->{$f} =~ s|\n|
    |g; + $itemfields{$f} = 1; + } + } + # item has a host number if its biblio number does not match the current bib if ($item->{biblionumber} ne $biblionumber){ $item->{hostbiblionumber} = $item->{biblionumber}; @@ -258,6 +265,7 @@ foreach my $item (@items) { if ($item->{'materials'} ne ''){ $materials_flag = 1; } + push @itemloop, $item; } @@ -276,7 +284,8 @@ $template->param( itemdata_uri => $itemfields{uri}, itemdata_copynumber => $itemfields{copynumber}, volinfo => $itemfields{enumchron}, - itemdata_itemnotes => $itemfields{itemnotes}, + itemdata_itemnotes => $itemfields{itemnotes}, + itemdata_nonpublicnote => $itemfields{nonpublicnote}, z3950_search_params => C4::Search::z3950_search_args($dat), holdcount => $holdcount, hostrecords => $hostrecords, diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index f5bb904..0f24732 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -168,6 +168,7 @@ foreach my $item (@items){ } else { $item->{'issue'}= 0; } + $item->{nonpublicnote} =~ s|\n|
    |g if $item->{nonpublicnote}; } $template->param(count => $data->{'count'}, subscriptionsnumber => $subscriptionsnumber, diff --git a/circ/returns.pl b/circ/returns.pl index e142117..ad36878 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -586,6 +586,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $ri{itemcallnumber} = $biblio->{'itemcallnumber'}; $ri{itemtype} = $biblio->{'itemtype'}; $ri{itemnote} = $biblio->{'itemnotes'}; + $ri{nonpublicnote} = $biblio->{'nonpublicnote'}; $ri{ccode} = $biblio->{'ccode'}; $ri{itemnumber} = $biblio->{'itemnumber'}; $ri{barcode} = $bar_code; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 597a8be..995322f 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -756,6 +756,7 @@ CREATE TABLE `deleteditems` ( `reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved `restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5) `itemnotes` mediumtext, -- public notes on this item (MARC21 952$x) + `nonpublicnote` mediumtext default NULL, `holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that is currently in possession item (MARC21 952$b) `paidfor` mediumtext, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered @@ -1022,6 +1023,7 @@ CREATE TABLE `items` ( -- holdings/item information `reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved `restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5) `itemnotes` mediumtext, -- public notes on this item (MARC21 952$x) + `nonpublicnote` mediumtext default NULL, `holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that is currently in possession item (MARC21 952$b) `paidfor` mediumtext, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e540874..fdeb04b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4734,6 +4734,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = '3.07.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE items ADD COLUMN nonpublicnote MEDIUMTEXT AFTER itemnotes"); + $dbh->do("ALTER TABLE deleteditems ADD COLUMN nonpublicnote MEDIUMTEXT AFTER itemnotes"); + $dbh->do("UPDATE marc_subfield_structure SET kohafield='items.nonpublicnote' WHERE (kohafield IS NULL OR kohafield = '') AND tagfield='952' AND tagsubfield='x'"); + print "Upgrade to $DBversion done (Make nonpublicnote easier to use. If you have mapped your items to a MARC field other than 952 (system default), please check your Koha to MARC mapping for items.nonpublicnote)\n"; +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 858c2d6..c73bf74 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -281,6 +281,7 @@ function verify_images() { [% IF ( itemdata_copynumber ) %]
    [% END %] [% IF materials %][% END %] [% IF ( itemdata_itemnotes ) %][% END %] + [% IF itemdata_nonpublicnote %][% END %] [% IF ( SpineLabelShowPrintOnBibDetails ) %][% END %] [% IF ( hostrecords ) %][% END %] [% IF ( analyze ) %][% END %] @@ -409,6 +410,7 @@ function verify_images() { [% END %] [% IF ( itemdata_itemnotes ) %][% END %] + [% IF itemdata_nonpublicnote %][% END %] [% IF ( SpineLabelShowPrintOnBibDetails ) %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 1a9536b..56e0594 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -176,6 +176,7 @@ [% IF ( ITEM_DAT.card2 ) %]
  • Previous Borrower: [% ITEM_DAT.card2 %] 
  • [% END %]
  • Paid for?: [% ITEM_DAT.paidfor %] 
  • Serial enumeration: [% ITEM_DAT.enumchron %] 
  • + [% IF ITEM_DAT.nonpublicnote %]
  • Non-public Note: [% ITEM_DAT.nonpublicnote %] 
  • [% END %]
  • Public Note: [% IF ( CAN_user_editcatalogue_edit_items ) %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 1d0e07a..4b49784 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -716,7 +716,7 @@ No patron matched [% message %] [% IF ( todayissue.od ) %]
  • - + [% IF ( todayissue.multiple_borrowers ) %][% END %] @@ -789,7 +789,7 @@ No patron matched [% message %] [% IF ( previssue.od ) %] - + @@ -897,7 +897,7 @@ No patron matched [% message %] [% END %] [% IF ( relissue.overdue ) %] - + @@ -918,7 +918,7 @@ No patron matched [% message %] [% IF ( relprevissue.overdue ) %] - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 004a44e..6656d25 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -451,6 +451,7 @@ function Dopop(link) { [% ELSE %]Not checked out[% END %] [% END %] -- 1.6.5 From wizzyrea at gmail.com Wed Mar 7 21:15:15 2012 From: wizzyrea at gmail.com (Liz Rea) Date: Wed, 7 Mar 2012 14:15:15 -0600 Subject: [Koha-patches] [PATCH] Bug 7665 - Bibs with no ISBN's show broken images for covers when using Syndetics cover images Message-ID: <1331151315-22635-1-git-send-email-wizzyrea@gmail.com> Patch fixes problem for syndetics + bibs with no ISBN. Also adds "no image found" capability to Syndetics results. To test (first, contact me and I will let you use my syndetics credentials *for testing this bug only*): * replicate bug - have a bib with an ISBN, and one without. The one with the ISBN should show a cover, the one without will show a broken image. * apply patch * search for the same bib - you should now see "no image available" for the one with no ISBN, and a cover image for your bib with an ISBN. --- .../opac-tmpl/prog/en/modules/opac-results.tt | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt index 22c9272..9e6951a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -534,10 +534,19 @@ $(document).ready(function(){ [% IF ( OPACLocalCoverImages ) %][% END %] [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %][% ELSE %]No cover image available[% END %][% END %][% END %] - [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %] - - [% ELSE %] - [% END %][% END %][% END %] + [% IF ( SyndeticsEnabled ) %] + [% IF ( SyndeticsCoverImages ) %] + [% IF SEARCH_RESULT.normalized_isbn %] + [% IF ( using_https ) %] + + [% ELSE %] + + [% END %] + [% ELSE %] + No cover image available + [% END %] + [% END %] + [% END %] [% IF ( GoogleJackets ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]
    [% ELSE %]No cover image available[% END %][% END %] [% IF OpenLibraryCovers %][% IF SEARCH_RESULT.normalized_isbn %]
    [% ELSE %]No cover image available[% END %][% END %] -- 1.7.2.5 From oleonard at myacpl.org Wed Mar 7 21:48:20 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Wed, 7 Mar 2012 15:48:20 -0500 Subject: [Koha-patches] [PATCH] Bug 7668 - Improve navigation and toolbar options in guided reports Message-ID: <1331153300-22705-1-git-send-email-oleonard@myacpl.org> Creating new include, reports-toolbar.inc for presenting "action" options to the user, in contrast with "view" options in the left- hand navigation menu. In the toolbar: New (guided report, SQL report), Edit, Run. The presence of the toolbar allows the user to access functions more flexibly: Getting directly to 'edit' or 'run' from the 'view' page for instance. Modifications to guided_reports.pl pass report id and name to the template for clarity and for the purpose of enabling the edit/run buttons. To test: Apply the patch and go through the process of creating a new saved SQL report. Note that the toolbar is present and the buttons are functional at appropriate times. New and Edit options should only be displayed if the user has permission to create reports. Test with a user who does not have create permission to confirm. --- .../intranet-tmpl/prog/en/css/staff-global.css | 11 ++++- .../prog/en/includes/guided-reports-view.inc | 6 +-- .../prog/en/includes/reports-toolbar.inc | 44 ++++++++++++++++++++ .../en/modules/reports/guided_reports_start.tt | 21 +++++++--- reports/guided_reports.pl | 10 ++++- 5 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index fec66d6..eb0aae9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -886,7 +886,16 @@ fieldset.rows .inputnote { background-repeat : no-repeat; } -#editpatron a, #editmenuc .first-child, #editshelf a, #edit a, #editsupplier a, #managelabel a, #managetemplate a, #managelabelbatch a, #manageprofile a { +#editpatron a, +#editreport a, +#editmenuc .first-child, +#editshelf a, +#edit a, +#editsupplier a, +#managelabel a, +#managetemplate a, +#managelabelbatch a, +#manageprofile a { padding-left : 34px; background-image: url("../../img/toolbar-edit.gif"); background-position : center left; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/guided-reports-view.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/guided-reports-view.inc index d354170..aa03be8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/guided-reports-view.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/guided-reports-view.inc @@ -1,8 +1,6 @@ -
    Build and Run Reports
    +
    Run Reports
      - [% IF ( CAN_user_reports_create_reports ) %]
    • Build New
    • [% END %] - [% IF ( CAN_user_reports_execute_reports ) %]
    • Use Saved
    • [% END %] - [% IF ( CAN_user_reports_create_reports ) %]
    • Create from SQL
    • [% END %] + [% IF ( CAN_user_reports_execute_reports ) %]
    • Saved reports
    • [% END %]
    Reports Dictionary
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc new file mode 100644 index 0000000..a4e4226 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc @@ -0,0 +1,44 @@ +[% UNLESS ( no_add ) %] +
      + + +
        + [% IF ( CAN_user_reports_create_reports ) %]
      • New guided report
      • [% END %] +
      • New SQL report
      • + [% IF ( showsql || execute || editsql || save_successful ) %] + [% UNLESS ( errors ) %][%# Unless there are errors saving a report %] + [% UNLESS ( editsql ) %][%# Do not show edit button on edit page %] + [% IF ( CAN_user_reports_create_reports ) %]
      • Edit
      • [% END %] + [% END %] +
      • Run report
      • + [% END %] + [% END %] +
      +
      +[% END %] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index caf27f1..4ccb0ac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -87,6 +87,7 @@ $(document).ready(function(){
      + [% INCLUDE "reports-toolbar.inc" %] [% IF ( start ) %]

      Guided Reports

      @@ -548,7 +549,8 @@ canned reports and writing custom SQL reports.

      -
      + Cancel + [% END %] @@ -589,7 +591,13 @@ Sub report: +
      + [% reportname %] +
        + [% IF ( notes ) %]
      1. Notes: [% notes %]
      2. [% ELSE %][% END %] +
      3. +
      +
      [% END %] [% IF ( editsql ) %] @@ -597,16 +605,17 @@ Sub report:
      -Edit SQL +Edit SQL report
        -
      1. +
      -
      + Cancel + @@ -615,7 +624,7 @@ Sub report: @@ -246,7 +249,7 @@ function set_to_today(id, force) { [% IF ( ite.repeatable ) %] + [% END %] - + [% IF ( ite.mandatory ) %] Required[% END %]
      [% END %] -- 1.7.3 From oleonard at myacpl.org Thu Mar 8 18:34:26 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Thu, 8 Mar 2012 12:34:26 -0500 Subject: [Koha-patches] [PATCH] Bug 7680 - PatronDefaultView preference to control whether patron links go to circ or patron details Message-ID: <1331228066-14491-1-git-send-email-oleonard@myacpl.org> The new include, patron-default-view.inc, outputs the *opening* half of the so that individual templates can control whether to show full name, barcode, both, etc. Individual templates must often pass the "local" borrowernumber variable via the INCLUDE if the variable is not called "borrowernumber": [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrowernumber %] --- C4/Auth.pm | 1 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 9 +++++++++ .../prog/en/modules/admin/aqbudgets.tt | 4 ++-- .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ .../prog/en/modules/catalogue/detail.tt | 4 ++-- .../prog/en/modules/catalogue/issuehistory.tt | 2 +- .../prog/en/modules/catalogue/moredetail.tt | 8 ++++---- .../prog/en/modules/circ/branchoverdues.tt | 4 ++-- .../prog/en/modules/circ/branchtransfers.tt | 6 +++--- .../prog/en/modules/circ/circulation.tt | 10 +++++----- .../intranet-tmpl/prog/en/modules/circ/overdue.tt | 2 +- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 14 +++++++------- .../prog/en/modules/circ/transferstoreceive.tt | 2 +- .../prog/en/modules/circ/view_holdsqueue.tt | 2 +- .../prog/en/modules/circ/waitingreserves.tt | 4 ++-- .../prog/en/modules/members/member-password.tt | 10 ++++++++-- .../prog/en/modules/members/member.tt | 2 +- .../prog/en/modules/members/memberentrygen.tt | 11 ++++++++--- .../prog/en/modules/members/moremember-print.tt | 2 +- .../prog/en/modules/members/moremember-receipt.tt | 9 ++------- .../prog/en/modules/members/moremember.tt | 6 +++--- .../prog/en/modules/members/update-child.tt | 3 ++- .../prog/en/modules/offline_circ/list.tt | 4 ++-- .../prog/en/modules/offline_circ/process_koc.tt | 8 ++++---- .../prog/en/modules/patroncards/members-search.tt | 2 +- .../prog/en/modules/reports/bor_issues_top.tt | 2 +- .../prog/en/modules/reserve/request.tt | 16 ++++++++-------- .../prog/en/modules/reviews/reviewswaiting.tt | 2 +- .../prog/en/modules/serials/viewalerts.tt | 2 +- .../prog/en/modules/suggestion/suggestion.tt | 6 +++--- .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 15 +++++++-------- .../prog/en/modules/virtualshelves/shelves.tt | 2 +- 33 files changed, 102 insertions(+), 79 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index ccb2c15..4dbdd0f 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -374,6 +374,7 @@ sub get_template_and_user { IntranetUserCSS => C4::Context->preference("IntranetUserCSS"), intranetuserjs => C4::Context->preference("intranetuserjs"), intranetbookbag => C4::Context->preference("intranetbookbag"), + PatronDefaultView => C4::Context->preference("PatronDefaultView"), suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index bda97f5..1be4d5e 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -69,6 +69,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('memberofinstitution',0,'If ON, patrons can be linked to institutions',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('noissuescharge',5,'Define maximum amount withstanding before check outs are blocked','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NotifyBorrowerDeparture',30,'Define number of days before expiry where circulation is warned about patron account expiry',NULL,'Integer'); +INSERT INTO `systempreferences` (variable, value, options, explanation, type) VALUES ( 'PatronDefaultView', 'normal', 'circ|detail', 'Choose the default destination for links to patron records: checkout or patron details', 'Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacAuthorities',1,'If ON, enables the search authorities link on OPAC',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacbookbag',1,'If ON, enables display of Cart feature','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('intranetbookbag','1','If ON, enables display of Cart feature in the intranet','','YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ccca83a..88392b9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4765,6 +4765,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.07.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO koha.systempreferences (variable, value, options, explanation, type) VALUES ( +'PatronDefaultView', 'normal', 'circ|detail', 'Choose the default destination for links to patron records: checkout or patron details', 'Choice');"); + print "Upgrade to $DBversion done (Bug 7680 - Create a PatronDefaultView preference for the staff client)\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt index 7fa91f7..fed38a4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt @@ -211,7 +211,7 @@ [% END %] [% budge.budget_remaining %] -
    [% FOREACH issue IN issues %] [% UNLESS ( loop.odd ) %][% ELSE %][% END %] - + @@ -126,7 +126,7 @@

    - - + - +
    Patron Barcode [% IF ( issue.renewals ) %] Yes[% IF ( issue.lastreneweddate ) %], last on: [% issue.lastreneweddate %] + [% END %] [% ELSE %] No [% END %] [% IF ( issue.issuedate ) %] [% issue.issuedate %] + [% ELSE %]   [% END %] [% IF ( issue.date_due ) %] [% issue.date_due %] + [% ELSE %]   [% END %] [% IF ( issue.returndate ) %] [% issue.returndate %] + [% ELSE %]   [% END %]

    [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %] - [% reserveloo.title |html %] [% reserveloo.subtitle %] - + [% reserveloo.title |html %] [% IF ( reserveloo.subtitle ) %][% reserveloo.subtitle %][% END %] + [% IF ( reserveloo.author ) %]

    by [% reserveloo.author %]

    [% ELSE %][% END %]

    [% IF ( opacbookbag ) %] [% ELSE %] [% IF ( virtualshelves ) %] [% ELSE %] [% IF ( RequestOnOpac ) %][% UNLESS ( SEARCH_RESULT.norequests ) %][% IF ( opacuserlogin ) %] [% END %][% END %][% END %][% END %][% END %][% UNLESS supress_result_number %][% SEARCH_RESULT.result_number %].[% END %]Copy No.Materials SpecifiedPublic notesNon-public NoteSpine LabelHost RecordsUsed in [% itemloo.materials %]
    [% itemloo.itemnotes %]
    [% itemloo.nonpublicnote %]Print Label [% ELSE %][% END %] [% todayissue.dd %] [% todayissue.title |html %][% IF ( todayissue.author ) %], by [% todayissue.author %][% END %][% IF ( todayissue.itemnotes ) %]- [% todayissue.itemnotes %][% END %] [% todayissue.barcode %][% todayissue.title |html %][% IF ( todayissue.author ) %], by [% todayissue.author %][% END %][% IF ( todayissue.itemnotes ) %]- [% todayissue.itemnotes %][% END %][% IF ( todayissue.nonpublicnote ) %]- [% todayissue.nonpublicnote %][% END %] [% todayissue.barcode %] [% UNLESS ( noItemTypeImages ) %] [% IF ( todayissue.itemtype_image ) %][% END %][% END %][% todayissue.itemtype %] [% todayissue.checkoutdate %][% todayissue.firstname %] [% todayissue.surname %][% ELSE %][% END %] [% previssue.dd %] [% previssue.title |html %][% IF ( previssue.author ) %], by [% previssue.author %][% END %] [% IF ( previssue.itemnotes ) %]- [% previssue.itemnotes %][% END %] [% previssue.barcode %][% previssue.title |html %][% IF ( previssue.author ) %], by [% previssue.author %][% END %] [% IF ( previssue.itemnotes ) %]- [% previssue.itemnotes %][% END %][% IF ( previssue.nonpublicnote ) %]- [% previssue.nonpublicnote %][% END %] [% previssue.barcode %] [% previssue.itemtype %] [% ELSE %][% END %] [% relissue.dd %][% relissue.title |html %][% IF ( relissue.author ) %], by [% relissue.author %][% END %][% IF ( relissue.itemnotes ) %]- [% relissue.itemnotes %][% END %] [% relissue.barcode %][% relissue.title |html %][% IF ( relissue.author ) %], by [% relissue.author %][% END %][% IF ( relissue.itemnotes ) %]- [% relissue.itemnotes %][% END %][% IF ( relissue.nonpublicnote ) %]- [% relissue.nonpublicnote %][% END %] [% relissue.barcode %] [% UNLESS ( noItemTypeImages ) %] [% IF ( relissue.itemtype_image ) %][% END %][% END %][% relissue.itemtype %] [% relissue.displaydate %] [% relissue.issuingbranchname %][% ELSE %][% END %] [% relprevissue.dd %] [% relprevissue.title |html %][% IF ( relprevissue.author ) %], by [% relprevissue.author %][% END %] [% IF ( relprevissue.itemnotes ) %]- [% relprevissue.itemnotes %][% END %] [% relprevissue.barcode %][% relprevissue.title |html %][% IF ( relprevissue.author ) %], by [% relprevissue.author %][% END %] [% IF ( relprevissue.itemnotes ) %]- [% relprevissue.itemnotes %][% END %][% IF ( relprevissue.nonpublicnote ) %] - [% relprevissue.nonpublicnote %][% END %] [% relprevissue.barcode %] [% UNLESS noItemTypeImages %][% IF relprevissue.itemtype_image %][% END %][% END %][% relprevissue.itemtype %] [% relprevissue.displaydate %] [% relprevissue.issuingbranchname %] [% IF ( riloo.bornote ) %][% riloo.bornote %]
    [% END %] [% IF ( riloo.itemnote ) %][% riloo.itemnote %][% END %] + [% IF ( riloo.nonpublicnote ) %][% riloo.nonpublicnote %][% END %]
    [% IF ( budge.budget_owner_id ) %]Owner: [% budge.budget_owner_name %][% END %] + [% IF ( budge.budget_owner_id ) %]Owner: [% INCLUDE 'patron-default-view.inc' borrowernumber = budge.budget_owner_id %][% budge.budget_owner_name %][% END %] [% IF ( budge.budget_branchcode ) %]
    Library: [% budge.budget_branchcode %][% END %] [% IF ( budge.budget_notes ) %]
    Notes: [% budge.budget_notes %][% END %] [% IF ( budge.budget_hierarchy ) %] @@ -294,7 +294,7 @@
  • Owner: - [% budget_owner_name %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = budget_owner_id %][% budget_owner_name %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 3d88883..2490305 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -94,6 +94,12 @@ Patrons: class: integer - days beforehand. - + - Links to patron records point to + - pref: PatronDefaultView + choices: + circ: checkout + detail: "patron details" + - - pref: patronimages choices: yes: Allow diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 858c2d6..51a4b33 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -308,7 +308,7 @@ function verify_images() { [% IF ( itemloo.datedue ) %] Checked out [% UNLESS ( itemloo.NOTSAMEBRANCH ) %] - to + to [% INCLUDE 'patron-default-view.inc' borrowernumber = itemloo.borrowernumber %] [% IF ( itemloo.hidepatronname ) %] [% itemloo.cardnumber %] [% ELSE %] @@ -366,7 +366,7 @@ function verify_images() { [% ELSE %] Item-level hold [% END %] - [% IF ( canreservefromotherbranches ) %]for + [% IF ( canreservefromotherbranches ) %]for [% INCLUDE 'patron-default-view.inc' borrowernumber = itemloo.ReservedForBorrowernumber %] [% IF ( itemloo.hidepatronname ) %] [% itemloo.Reservedcardnumber %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt index de5db0e..807b0ee 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt @@ -34,7 +34,7 @@
  • [% IF HidePatronName %][% issue.cardnumber %][% ELSE %][% issue.surname %][% IF ( issue.firstname ) %], [% issue.firstname %][% END %][% END %][% INCLUDE 'patron-default-view.inc' borrowernumber = issue.borrowernumber %][% IF HidePatronName %][% issue.cardnumber %][% ELSE %][% issue.surname %][% IF ( issue.firstname ) %], [% issue.firstname %][% END %][% END %] [% IF ( issue.barcode ) %] [% issue.barcode %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 1a9536b..13b26b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -69,7 +69,7 @@
    1. Current Location: [% ITEM_DAT.holdingbranchname %] 
    2. -
    3. Checkout Status: [% IF ( ITEM_DAT.issue ) %]Checked out to [% ITEM_DAT.cardnumber %][% IF ( ITEM_DAT.lastreneweddate ) %], Last renewed [% ITEM_DAT.lastreneweddate %][% END %], Due back on [% ITEM_DAT.datedue %][% ELSE %]Not Checked out [% END %]
    4. +
    5. Checkout Status: [% IF ( ITEM_DAT.issue ) %]Checked out to [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrowernumber %][% ITEM_DAT.cardnumber %][% IF ( ITEM_DAT.lastreneweddate ) %], Last renewed [% ITEM_DAT.lastreneweddate %][% END %], Due back on [% ITEM_DAT.datedue %][% ELSE %]Not Checked out [% END %]
    6. Current Renewals: [% ITEM_DAT.renewals %] 
    7. [% IF ( ITEM_DAT.itemlostloop ) %]
    8. Lost Status: @@ -171,9 +171,9 @@
    9. Last seen: [% ITEM_DAT.datelastseen %] 
    10. Last borrowed: [% ITEM_DAT.datelastborrowed %] 
    11. - [% IF ( ITEM_DAT.card0 ) %]
    12. Last Borrower: [% ITEM_DAT.card0 %] 
    13. [% END %] - [% IF ( ITEM_DAT.card1 ) %]
    14. Previous Borrower: [% ITEM_DAT.card1 %] 
    15. [% END %] - [% IF ( ITEM_DAT.card2 ) %]
    16. Previous Borrower: [% ITEM_DAT.card2 %] 
    17. [% END %] + [% IF ( ITEM_DAT.card0 ) %]
    18. Last Borrower: [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrower0 %][% ITEM_DAT.card0 %] 
    19. [% END %] + [% IF ( ITEM_DAT.card1 ) %]
    20. Previous Borrower: [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrower1 %][% ITEM_DAT.card1 %] 
    21. [% END %] + [% IF ( ITEM_DAT.card2 ) %]
    22. Previous Borrower: [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrower2 %][% ITEM_DAT.card2 %] 
    23. [% END %]
    24. Paid for?: [% ITEM_DAT.paidfor %] 
    25. Serial enumeration: [% ITEM_DAT.enumchron %] 
    26. Public Note: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt index a8a8912..a296536 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt @@ -48,7 +48,7 @@
      Barcode : [% overduesloo.barcode %]
    - [% overduesloo.borrowersurname %], [% overduesloo.borrowerfirstname %]
    [% overduesloo.borrowerphone %]
    + [% INCLUDE 'patron-default-view.inc' borrowernumber = overduesloo.borrowernumber %][% overduesloo.borrowersurname %], [% overduesloo.borrowerfirstname %]
    [% overduesloo.borrowerphone %]
    [% IF ( overduesloo.borroweremail ) %] [% overduesloo.borroweremail %][% END %]
    -

    [% todayoverduesloo.borrowersurname %]   [% todayoverduesloo.borrowerfirstname %]
    [% todayoverduesloo.borrowerphone %]
    +

    [% INCLUDE 'patron-default-view.inc' borrowernumber = todayoverduesloo.borrowernumber %][% todayoverduesloo.borrowersurname %]   [% todayoverduesloo.borrowerfirstname %]
    [% todayoverduesloo.borrowerphone %]
    [% IF ( todayoverduesloo.borroweremail ) %] [% todayoverduesloo.borroweremail %][% END %]

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt index 097089a..1d21abe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt @@ -16,10 +16,10 @@ @@ -116,7 +116,7 @@
  • Item is already at destination library.
  • [% END %] [% IF ( errmsgloo.errwasreturned ) %] -
  • Item was on loan to +
  • Item was on loan to [% INCLUDE 'patron-default-view.inc' borrowernumber = errmsgloo.borrowernumber %] [% errmsgloo.firstname %] [% errmsgloo.surname %] ([% errmsgloo.cardnumber %]) and has been returned.
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 1d0e07a..4a54ecc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -249,15 +249,15 @@ function refocus(calendar) { [% END %] [% IF ( RESERVE_WAITING ) %] -
  • Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been waiting for [% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate %]
  • +
  • Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been waiting for [% INCLUDE 'patron-default-view.inc' borrowernumber = resborrowernumber %][% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate %]
  • [% END %] [% IF ( RESERVED ) %] -
  • Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been on hold for [% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate %]
  • +
  • Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been on hold for [% INCLUDE 'patron-default-view.inc' borrowernumber = resborrowernumber %][% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate %]
  • [% END %] [% IF ( ISSUED_TO_ANOTHER ) %] -
  • Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) is checked out to [% issued_firstname %] [% issued_surname %] ([% issued_cardnumber %]). Check in and check out?
  • +
  • Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) is checked out to [% INCLUDE 'patron-default-view.inc' borrowernumber = issued_borrowernumber %][% issued_firstname %] [% issued_surname %] ([% issued_cardnumber %]). Check in and check out?
  • [% END %] [% IF ( TOO_MANY ) %] @@ -903,7 +903,7 @@ No patron matched [% message %] - + [% END %] [% END %] @@ -926,7 +926,7 @@ No patron matched [% message %] [% IF ( relprevissue.multiple_borrowers ) %][% END %] - + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt index e196399..66edb67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt @@ -116,7 +116,7 @@ [% FOREACH overdueloo IN overdueloop %] - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 004a44e..b5b53b7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -88,7 +88,7 @@ function Dopop(link) { [% IF ( WrongTransfer ) %]

    Please return [% title |html %] to [% TransferWaitingAt %]

    Print Slip or Cancel Transfer

    [% IF ( wborcnum ) %]
    Hold for:
    -
    • +
      • [% INCLUDE 'patron-default-view.inc' %] [% borsurname %], [% borfirstname %] ([% borcnum %])
      • [% wboraddress %][% IF ( wboraddress2 ) %]
        [% wboraddress2 %]
        [% END %] @@ -122,7 +122,7 @@ function Dopop(link) { [% IF ( reservenotes ) %]

        Notes: [% reservenotes %]

        [% END %]

        Hold for:

          -
        • [% borsurname %], [% borfirstname %] ([% borcnum %])
        • +
        • [% INCLUDE 'patron-default-view.inc' %][% borsurname %], [% borfirstname %] ([% borcnum %])
        • [% boraddress %]
          [% IF ( boraddress2 ) %][% boraddress2 %]
          [% END %] [% borcity %] [% borzip %]
        • @@ -163,7 +163,7 @@ function Dopop(link) {

          Hold needing transfer found: [% title |html %]

          Hold for:

            -
          • [% borsurname %], [% borfirstname %] ([% borcnum %])
          • +
          • [% INCLUDE 'patron-default-view.inc' %][% borsurname %], [% borfirstname %] ([% borcnum %])
          • [% boraddress %]
            [% IF ( boraddress2 ) %][% boraddress2 %]
            [% END %] [% borcity %] [% borzip %]
          • @@ -269,7 +269,7 @@ function Dopop(link) { [% IF ( reservenotes ) %]

            Notes: [% reservenotes %]

            [% END %]
            Hold for:
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt index 2c84d5d..ef624c4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt @@ -65,7 +65,7 @@ $(document).ready(function() {
    Barcode: [% reser.barcode %] - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt index 3ec2707..6e082c7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt @@ -93,7 +93,7 @@ $.tablesorter.addParser({   ([% reserveloo.itemtype %])
    Barcode: [% reserveloo.barcode %] - @@ -152,7 +152,7 @@ $.tablesorter.addParser({ [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %]  ([% overloo.itemtype %])[% END %][% END %]
    Barcode: [% overloo.barcode %] - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt index 1269270..00e39a1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt @@ -40,7 +40,7 @@ [% ELSE %] - + [% IF ( errormsg ) %] @@ -85,7 +85,13 @@ -
    Cancel
    +
    + [% IF ( destination == 'circ' ) %] + + [% ELSE %] + + [% END %] + Cancel
    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index c3f3909..b2c919d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -60,7 +60,7 @@ [% END %] [% END %] - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 51a1ba1..0264d98 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -74,7 +74,7 @@ Add[% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %] [% surname %] [% firstname %] [% ELSE %] -[% firstname %] [% surname %][% IF ( opduplicate ) %]Duplicate[% ELSE %]Modify[% END %][% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %] +[% INCLUDE 'patron-default-view.inc' %][% firstname %] [% surname %] › [% IF ( opduplicate ) %]Duplicate[% ELSE %]Modify[% END %][% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %] [% END %] [% IF ( opadd ) %]
    [% ELSE %]
    [% END %] @@ -1326,7 +1326,7 @@ [% IF ( opduplicate ) %] [% ELSE %] - + [% END %] @@ -1464,7 +1464,12 @@ [% IF ( opadd ) %] Cancel [% ELSE %] - Cancel + [% IF ( destination == 'circ' ) %] + + [% ELSE %] + + [% END %] + Cancel [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt index f84052b..ed2cf60 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt @@ -16,7 +16,7 @@
    -

    Account Summary: [% firstname %] [% surname %] ([% cardnumber %])

    +

    [% INCLUDE 'patron-default-view.inc' %]Account Summary: [% firstname %] [% surname %] ([% cardnumber %])

    • [% address %]
      [% address2 %]
    • [% city %], [% zipcode %]
    • [% IF ( phone ) %][% phone %][% ELSE %](no phone number on file)[% END %]
    • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt index 4a85ccb..d3a352c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt @@ -4,12 +4,7 @@ - + @@ -18,7 +13,7 @@

      [% LibraryName %]

      [% IF ( branchname ) %][% branchname %]
      [% END %] Checked out to [% firstname %] [% surname %]
      -([% cardnumber %])
      +([% INCLUDE 'patron-default-view.inc' %][% cardnumber %])
      [% todaysdate %]
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index c3d7063..d770d67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -226,11 +226,11 @@ function validate1(date) { [% END %] [% IF ( isguarantee ) %] [% IF ( guaranteeloop ) %] -
    • Guarantees:
    • +
    • Guarantees:
        [% FOREACH guaranteeloo IN guaranteeloop %]
      • [% INCLUDE 'patron-default-view.inc' borrowernumber = guaranteeloo.borrowernumber %][% guaranteeloo.name %]
      • [% END %]
    • [% END %] [% ELSE %] [% IF ( guarantorborrowernumber ) %] -
    • Guarantor:[% guarantorsurname %], [% guarantorfirstname %]
    • +
    • Guarantor:[% INCLUDE 'patron-default-view.inc' borrowernumber = guarantorborrowernumber %][% guarantorsurname %], [% guarantorfirstname %]
    • [% END %] [% END %] @@ -572,7 +572,7 @@ function validate1(date) {
    - + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt index 81fa3b6..4b9c994 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt @@ -36,7 +36,8 @@ confirm_updatechild([% borrowernumber %]); [% IF ( SUCCESS ) %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt index e286cc8..c2cfac0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt @@ -78,7 +78,7 @@ - + @@ -97,7 +97,7 @@ - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt index b309d94..4548f7c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt @@ -51,7 +51,7 @@ function Dopop(link) { [% loopro.rowtitle %] [% FOREACH loopcel IN loopro.loopcell %] [% IF ( loopcel.hilighted ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index fa45e26..99b79ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -204,10 +204,10 @@ function checkMultiHold() {

    Cannot Place Hold

      [% IF ( maxreserves ) %] -
    • Too Many Holds: [% borrowerfirstname %] [% borrowersurname %] has too many holds.
    • +
    • Too Many Holds: [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %] has too many holds.
    • [% END %] [% IF ( alreadyreserved ) %] -
    • [% borrowerfirstname %] [% borrowersurname %] already has a hold on this item
    • +
    • [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %] already has a hold on this item
    • [% END %] [% IF ( none_available ) %]
    • No copies are available to be placed on hold
    • @@ -223,11 +223,11 @@ function checkMultiHold() { [% IF ( messages ) %]
        [% IF ( expiry ) %] -
      • [% borrowerfirstname %] [% borrowersurname %]'s account has expired
      • +
      • [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %]'s account has expired
      • [% END %] [% IF ( diffbranch ) %] -
      • Pickup library is different than [% borrowerfirstname %] [% borrowersurname %]'s home library ([% borrower_branchname %] / [% borrower_branchcode %] )
      • +
      • Pickup library is different than [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %]'s home library ([% borrower_branchname %] / [% borrower_branchcode %] )
      • [% END %]
      @@ -265,7 +265,7 @@ function checkMultiHold() {
      1. Patron: [% IF ( borrowernumber ) %] - [% borrowerfirstname %] [% borrowersurname %] ([% cardnumber %]) + [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %] ([% cardnumber %]) [% ELSE %] Not defined yet [% END %] @@ -460,7 +460,7 @@ function checkMultiHold() { Can't be cancelled when item is in transit [% ELSE %] [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %] - [% IF ( itemloo.canreservefromotherbranches ) %]for [% itemloo.ReservedForFirstname %] [% itemloo.ReservedForSurname %][% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemloo.ExpectedAtLibrary %] + [% IF ( itemloo.canreservefromotherbranches ) %]for [% INCLUDE 'patron-default-view.inc' borrowernumber = itemloo.ReservedForBorrowernumber %][% itemloo.ReservedForFirstname %] [% itemloo.ReservedForSurname %][% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemloo.ExpectedAtLibrary %] since [% IF ( itemloo.waitingdate ) %][% itemloo.waitingdate %][% ELSE %][% IF ( itemloo.reservedate ) %][% itemloo.reservedate %][% END %][% END %]. Cancel hold @@ -526,7 +526,7 @@ function checkMultiHold() { [% END %] [% IF ( biblioloo.alreadyres ) %] -
      2. [% borrowerfirstname %] [% borrowersurname %] already has a hold on this item
      3. +
      4. [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %] already has a hold on this item
      5. [% END %] [% IF ( biblioloo.none_avail ) %]
      6. No copies are available to be placed on hold
      7. @@ -639,7 +639,7 @@ function checkMultiHold() { [% END %]
    [% FOREACH review IN reviews %] - + [% END %]
    [% IF ( reserved ) %] - Reserve found for [% name %] ([% borrowernumber %]). + Reserve found for [% name %] ([% INCLUDE 'patron-default-view.inc' %][% borrowernumber %]). [% END %] [% IF ( waiting ) %] - Item is marked waiting at [% branchname %] for [% name %] ([% borrowernumber %]). + Item is marked waiting at [% branchname %] for [% name %] ([% INCLUDE 'patron-default-view.inc' %][% borrowernumber %]). [% END %]
    [% relissue.issuingbranchname %] [% relissue.itemcallnumber %] [% relissue.charge %][% relissue.replacementprice %][% relissue.firstname %] [% relissue.surname %] ([% relissue.cardnumber %])[% relissue.replacementprice %][% INCLUDE 'patron-default-view.inc' borrowernumber = relissue.borrowernumber %][% relissue.firstname %] [% relissue.surname %] ([% relissue.cardnumber %])
    [% relprevissue.firstname %] [% relprevissue.surname %][% relprevissue.charge %] [% relprevissue.replacementprice %][% relprevissue.firstname %] [% relprevissue.surname %] ([% relprevissue.cardnumber %])[% INCLUDE 'patron-default-view.inc' borrowernumber = relprevissue.borrowernumber %][% relprevissue.firstname %] [% relprevissue.surname %] ([% relprevissue.cardnumber %])
    [% overdueloo.duedate %][% overdueloo.surname %] [% overdueloo.firstname %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = overdueloo.borrowernumber %][% overdueloo.surname %] [% overdueloo.firstname %] [% IF ( overdueloo.email ) %][email][% END %] [% IF ( overdueloo.phone ) %]([% overdueloo.phone %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro %])[% END %] [% overdueloo.branchcode %][% title |html %] - [% riborsurname %], [% ribortitle %] [% riborfirstname %] ([% riborcnum %]) + [% INCLUDE 'patron-default-view.inc' borrowernumber = riborrowernumber %][% riborsurname %], [% ribortitle %] [% riborfirstname %] ([% riborcnum %]) [% IF ( flagset ) %] ([% FOREACH flagloo IN flagloop %] [% flagloo.flag %] @@ -445,7 +445,7 @@ function Dopop(link) { [% riloo.itemcallnumber %] [% riloo.itemtype %] [% riloo.ccode %] [% IF ( riloo.duedate ) %] - + [% INCLUDE 'patron-default-view.inc' borrowernumber = riloo.borrowernumber %] [% riloo.borsurname %], [% riloo.borfirstname %] ([% riloo.borcategorycode %]) [% ELSE %]Not checked out[% END %] [% IF ( reser.borrowername ) %] - + [% INCLUDE 'patron-default-view.inc' borrowernumber = reser.borrowernum %] [% reser.borrowername %]   [% reser.borrowerfirstname %]
    [% reser.borrowerphone %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt index d9ba8fc..cb12736 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt @@ -77,7 +77,7 @@ $(document).ready(function() { [% itemsloo.barcode %] or any available [% END %]

    [% itemsloo.surname %], [% itemsloo.firstname %] ([% itemsloo.cardnumber %])

    [% itemsloo.phone %]

    [% INCLUDE 'patron-default-view.inc' borrowernumber = itemsloo.borrowernumber %][% itemsloo.surname %], [% itemsloo.firstname %] ([% itemsloo.cardnumber %])

    [% itemsloo.phone %]

    [% itemsloo.pickbranch %] [% itemsloo.reservedate %] [% itemsloo.notes %][% reserveloo.borrowername %], [% reserveloo.borrowerfirstname %]
    [% reserveloo.borrowerphone %]
    +
    [% INCLUDE 'patron-default-view.inc' borrowernumber = reserveloo.borrowernum %][% reserveloo.borrowername %], [% reserveloo.borrowerfirstname %]
    [% reserveloo.borrowerphone %]
    [% IF ( reserveloo.borrowermail ) %] [% reserveloo.borrowermail %][% END %]
    [% overloo.borrowername %], [% overloo.borrowerfirstname %]
    [% overloo.borrowerphone %]
    +
    [% INCLUDE 'patron-default-view.inc' borrowernumber = overloo.borrowernum %][% overloo.borrowername %], [% overloo.borrowerfirstname %]
    [% overloo.borrowerphone %]
    [% IF ( overloo.borrowermail ) %] [% overloo.borrowermail %][% END %]
    [% resultsloo.cardnumber %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = resultsloo.borrowernumber %] [% INCLUDE 'patron-title.inc' category_type = resultsloo.category_type firstname = resultsloo.firstname surname = resultsloo.surname othernames = resultsloo.othernames cardnumber = resultsloo.cardnumber %]
    [% IF ( resultsloo.streetnumber ) %][% resultsloo.streetnumber %] [% END %][% resultsloo.address %][% IF ( resultsloo.address2 ) %]
    [% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]
    [% resultsloo.city %][% IF ( resultsloo.state ) %],[% END %][% END %][% IF ( resultsloo.state ) %] [% resultsloo.state %][% END %] [% IF ( resultsloo.zipcode ) %] [% resultsloo.zipcode %][% END %][% IF ( resultsloo.country ) %], [% resultsloo.country %][% END %]
    [% resultsloo.category_description %] ([% resultsloo.category_type %])[% relissueloo.itemcallnumber %] [% relissueloo.charge %] [% relissueloo.replacementprice %][% relissueloo.firstname %] [% relissueloo.surname %] ([% relissueloo.cardnumber %])[% INCLUDE 'patron-default-view.inc' borrowernumber = relissueloo.borrowernumber %][% relissueloo.firstname %] [% relissueloo.surname %] ([% relissueloo.cardnumber %])
    Date Action BarcodeCardnumberPatron
    [% IF ( operation.actionissue ) %] [% IF ( operation.borrowernumber ) %] - [% operation.cardnumber %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = operation.borrowernumber %][% operation.borrower %] ([% operation.cardnumber %]) [% ELSE %] [% operation.cardnumber %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt index 6a66b6a..c65540d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt @@ -54,10 +54,10 @@ function CheckForm(f) { [% END %] [% IF ( message.ERROR_no_borrower_from_item ) %]

    Warning: Unable to determine patron from item barcode ([% message.badbarcode %]). Cannot check in.

    [% END %] - [% IF ( message.issue ) %]

    Checked out [% message.title |html %] ([% message.barcode %]) to [% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

    [% END %] - [% IF ( message.renew ) %]

    Renewed [% message.title |html %] ([% message.barcode %]) for [% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

    [% END %] - [% IF ( message.return ) %]

    Checked in [% message.title |html %] ([% message.barcode %]) from [% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

    [% END %] - [% IF ( message.payment ) %]

    Accepted payment ([% message.amount %]) from [% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

    [% END %] + [% IF ( message.issue ) %]

    Checked out [% message.title |html %] ([% message.barcode %]) to [% INCLUDE 'patron-default-view.inc' borrowernumber = message.borrowernumber %][% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

    [% END %] + [% IF ( message.renew ) %]

    Renewed [% message.title |html %] ([% message.barcode %]) for [% INCLUDE 'patron-default-view.inc' borrowernumber = message.borrowernumber %][% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

    [% END %] + [% IF ( message.return ) %]

    Checked in [% message.title |html %] ([% message.barcode %]) from [% INCLUDE 'patron-default-view.inc' borrowernumber = message.borrowernumber %][% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

    [% END %] + [% IF ( message.payment ) %]

    Accepted payment ([% message.amount %]) from [% INCLUDE 'patron-default-view.inc' borrowernumber = message.borrowernumber %][% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

    [% END %] [% END %] [% ELSE %]

    Upload Offline Circulation Data

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt index cbd1db5..9a859a5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt @@ -113,7 +113,7 @@ function add_item(borrowernum,batch_id,type_id){ [% END %]
    [% resultsloo.cardnumber %][% resultsloo.surname %], [% resultsloo.firstname %]
    [% resultsloo.address %][% IF ( resultsloo.address2 ) %]
    [% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]
    [% resultsloo.city %][% END %]
    [% INCLUDE 'patron-default-view.inc' borrowernumber = resultsloo.borrowernumber %][% resultsloo.surname %], [% resultsloo.firstname %]
    [% resultsloo.address %][% IF ( resultsloo.address2 ) %]
    [% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]
    [% resultsloo.city %][% END %]
    [% resultsloo.category_description %] ([% resultsloo.categorycode %]) [% resultsloo.branchcode %] [% resultsloo.dateexpiry %][% ELSE %][% END %] - [% IF ( loopcel.reference ) %][% END %] + [% IF ( loopcel.reference ) %][% INCLUDE 'patron-default-view.inc' borrowernumber = loopcel.reference %][% END %] [% IF ( loopcel.value ) %][% loopcel.value %][% END %] [% IF ( loopcel.reference ) %][% END %] - + [% INCLUDE 'patron-default-view.inc' borrowernumber = reserveloo.borrowernumber %] [% IF ( reserveloo.hidename ) %] [% reserveloo.cardnumber (reserveloo.borrowernumber) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt index a1dabbd..76cb9971 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt @@ -44,7 +44,7 @@
    - [% review.surname %], [% review.firstname %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = review.borrowernumber %][% review.surname %], [% review.firstname %] [% review.bibliotitle %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt index 9c3f83f..f1559dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt @@ -26,7 +26,7 @@ [% FOREACH alertloo IN alertloop %]
    [% alertloo.name %]View[% INCLUDE 'patron-default-view.inc' borrowernumber = alertloo.borrowernumber %]View
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 47ee96a..1b81d67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -145,18 +145,18 @@ $(document).ready(function() { calcNewsuggTotal(); });
    [% IF ( suggestedby_borrowernumber ) %][% suggestedby_surname %], [% suggestedby_firstname %] [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %] + [% IF ( suggestedby_borrowernumber ) %][% INCLUDE 'patron-default-view.inc' borrowernumber = suggestedby_borrowernumber %][% suggestedby_surname %], [% suggestedby_firstname %] [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %]
    [% IF ( managedby_borrowernumber ) %][% managedby_surname %], [% managedby_firstname %] [% managedby_branchcode %] ([% managedby_description %])[% END %][% IF ( managedby_borrowernumber ) %][% INCLUDE 'patron-default-view.inc' borrowernumber = managedby_borrowernumber %][% managedby_surname %], [% managedby_firstname %] [% managedby_branchcode %] ([% managedby_description %])[% END %]
    [% IF ( acceptedby_borrowernumber ) %][% acceptedby_surname %], [% acceptedby_firstname %] [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %][% IF ( acceptedby_borrowernumber ) %][% INCLUDE 'patron-default-view.inc' borrowernumber = acceptedby_borrowernumber %][% acceptedby_surname %], [% acceptedby_firstname %] [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index b2ab90f..d4b4575 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -153,27 +153,26 @@ [% loopro.timestamp %] [% IF ( module == 'CIRCULATION' ) %] - [% loopro.user %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = loopro.user %] [% loopro.user %] [% ELSE %] - [% loopro.user %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = loopro.user %] [% loopro.user %] [% END %] [% loopro.module %] [% loopro.action %] [% IF ( module == 'MEMBERS' ) %] - member [% loopro.object %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = loopro.object %] patron [% loopro.object %] [% ELSE %] [% IF ( module == 'CIRCULATION' ) %] - - [% IF ( loopro.object ) %] - member [% loopro.object %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = loopro.object %] [% IF ( loopro.object ) %] + patron [% loopro.object %] [% END %] [% ELSE %] [% IF ( module == 'CATALOGUING' ) %] [% IF ( info == 'item' ) %] - Item [% loopro.object %] + Item [% loopro.object %] [% ELSE %] biblio [% loopro.object %] [% END %] @@ -208,7 +207,7 @@ for Bibliographic Record [% object %] [% END %] [% IF ( MEMBERS ) %] - for [% INCLUDE 'patron-title.inc' %] + for [% INCLUDE 'patron-default-view.inc' borrowernumber = object %][% INCLUDE 'patron-title.inc' %] [% END %] .
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index b054e09..ebc9a54 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -403,7 +403,7 @@ function placeHold () { [% FOREACH shelvesloo IN shelvesloop %] [% IF ( shelvesloo.toggle ) %][% ELSE %][% END %] [% shelvesloo.shelfname |html %] - [% shelvesloo.ownername %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = shelvesloo.owner %][% shelvesloo.ownername %] [% shelvesloo.count %] item(s) [% IF ( shelvesloo.authorsort ) %]Author[% ELSIF ( shelvesloo.yearsort ) %]Year[% ELSE %]Title[% END %] [% IF ( shelvesloo.viewcategory1 ) %]Private[% END %] -- 1.7.3 From oleonard at myacpl.org Thu Mar 8 18:38:42 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Thu, 8 Mar 2012 12:38:42 -0500 Subject: [Koha-patches] [PATCH] Bug 7680 [REVISED] PatronDefaultView preference to control whether patron links go to circ or patron details Message-ID: <1331228322-14895-1-git-send-email-oleonard@myacpl.org> The new include, patron-default-view.inc, outputs the *opening* half of the so that individual templates can control whether to show full name, barcode, both, etc. Individual templates must often pass the "local" borrowernumber variable via the INCLUDE if the variable is not called "borrowernumber": [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrowernumber %] Revision: First patch didn't have the new include file. --- C4/Auth.pm | 1 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 9 +++++++++ .../prog/en/includes/patron-default-view.inc | 5 +++++ .../prog/en/modules/admin/aqbudgets.tt | 4 ++-- .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ .../prog/en/modules/catalogue/detail.tt | 4 ++-- .../prog/en/modules/catalogue/issuehistory.tt | 2 +- .../prog/en/modules/catalogue/moredetail.tt | 8 ++++---- .../prog/en/modules/circ/branchoverdues.tt | 4 ++-- .../prog/en/modules/circ/branchtransfers.tt | 6 +++--- .../prog/en/modules/circ/circulation.tt | 10 +++++----- .../intranet-tmpl/prog/en/modules/circ/overdue.tt | 2 +- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 14 +++++++------- .../prog/en/modules/circ/transferstoreceive.tt | 2 +- .../prog/en/modules/circ/view_holdsqueue.tt | 2 +- .../prog/en/modules/circ/waitingreserves.tt | 4 ++-- .../prog/en/modules/members/member-password.tt | 10 ++++++++-- .../prog/en/modules/members/member.tt | 2 +- .../prog/en/modules/members/memberentrygen.tt | 11 ++++++++--- .../prog/en/modules/members/moremember-print.tt | 2 +- .../prog/en/modules/members/moremember-receipt.tt | 9 ++------- .../prog/en/modules/members/moremember.tt | 6 +++--- .../prog/en/modules/members/update-child.tt | 3 ++- .../prog/en/modules/offline_circ/list.tt | 4 ++-- .../prog/en/modules/offline_circ/process_koc.tt | 8 ++++---- .../prog/en/modules/patroncards/members-search.tt | 2 +- .../prog/en/modules/reports/bor_issues_top.tt | 2 +- .../prog/en/modules/reserve/request.tt | 16 ++++++++-------- .../prog/en/modules/reviews/reviewswaiting.tt | 2 +- .../prog/en/modules/serials/viewalerts.tt | 2 +- .../prog/en/modules/suggestion/suggestion.tt | 6 +++--- .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 15 +++++++-------- .../prog/en/modules/virtualshelves/shelves.tt | 2 +- 34 files changed, 107 insertions(+), 79 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-default-view.inc diff --git a/C4/Auth.pm b/C4/Auth.pm index ccb2c15..4dbdd0f 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -374,6 +374,7 @@ sub get_template_and_user { IntranetUserCSS => C4::Context->preference("IntranetUserCSS"), intranetuserjs => C4::Context->preference("intranetuserjs"), intranetbookbag => C4::Context->preference("intranetbookbag"), + PatronDefaultView => C4::Context->preference("PatronDefaultView"), suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index bda97f5..1be4d5e 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -69,6 +69,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('memberofinstitution',0,'If ON, patrons can be linked to institutions',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('noissuescharge',5,'Define maximum amount withstanding before check outs are blocked','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NotifyBorrowerDeparture',30,'Define number of days before expiry where circulation is warned about patron account expiry',NULL,'Integer'); +INSERT INTO `systempreferences` (variable, value, options, explanation, type) VALUES ( 'PatronDefaultView', 'normal', 'circ|detail', 'Choose the default destination for links to patron records: checkout or patron details', 'Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacAuthorities',1,'If ON, enables the search authorities link on OPAC',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacbookbag',1,'If ON, enables display of Cart feature','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('intranetbookbag','1','If ON, enables display of Cart feature in the intranet','','YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ccca83a..88392b9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4765,6 +4765,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.07.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO koha.systempreferences (variable, value, options, explanation, type) VALUES ( +'PatronDefaultView', 'normal', 'circ|detail', 'Choose the default destination for links to patron records: checkout or patron details', 'Choice');"); + print "Upgrade to $DBversion done (Bug 7680 - Create a PatronDefaultView preference for the staff client)\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-default-view.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-default-view.inc new file mode 100644 index 0000000..1d1e19e --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-default-view.inc @@ -0,0 +1,5 @@ +[% IF ( PatronDefaultView == 'circ' ) %] + +[% ELSE %] + +[% END %] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt index 7fa91f7..fed38a4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt @@ -211,7 +211,7 @@ [% END %] [% budge.budget_remaining %] - [% IF ( budge.budget_owner_id ) %]Owner: [% budge.budget_owner_name %][% END %] + [% IF ( budge.budget_owner_id ) %]Owner: [% INCLUDE 'patron-default-view.inc' borrowernumber = budge.budget_owner_id %][% budge.budget_owner_name %][% END %] [% IF ( budge.budget_branchcode ) %]
    Library: [% budge.budget_branchcode %][% END %] [% IF ( budge.budget_notes ) %]
    Notes: [% budge.budget_notes %][% END %] [% IF ( budge.budget_hierarchy ) %] @@ -294,7 +294,7 @@
  • Owner: - [% budget_owner_name %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = budget_owner_id %][% budget_owner_name %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 3d88883..2490305 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -94,6 +94,12 @@ Patrons: class: integer - days beforehand. - + - Links to patron records point to + - pref: PatronDefaultView + choices: + circ: checkout + detail: "patron details" + - - pref: patronimages choices: yes: Allow diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 858c2d6..51a4b33 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -308,7 +308,7 @@ function verify_images() { [% IF ( itemloo.datedue ) %] Checked out [% UNLESS ( itemloo.NOTSAMEBRANCH ) %] - to + to [% INCLUDE 'patron-default-view.inc' borrowernumber = itemloo.borrowernumber %] [% IF ( itemloo.hidepatronname ) %] [% itemloo.cardnumber %] [% ELSE %] @@ -366,7 +366,7 @@ function verify_images() { [% ELSE %] Item-level hold [% END %] - [% IF ( canreservefromotherbranches ) %]for + [% IF ( canreservefromotherbranches ) %]for [% INCLUDE 'patron-default-view.inc' borrowernumber = itemloo.ReservedForBorrowernumber %] [% IF ( itemloo.hidepatronname ) %] [% itemloo.Reservedcardnumber %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt index de5db0e..807b0ee 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt @@ -34,7 +34,7 @@ [% FOREACH issue IN issues %] [% UNLESS ( loop.odd ) %][% ELSE %][% END %] - [% IF HidePatronName %][% issue.cardnumber %][% ELSE %][% issue.surname %][% IF ( issue.firstname ) %], [% issue.firstname %][% END %][% END %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = issue.borrowernumber %][% IF HidePatronName %][% issue.cardnumber %][% ELSE %][% issue.surname %][% IF ( issue.firstname ) %], [% issue.firstname %][% END %][% END %] [% IF ( issue.barcode ) %] [% issue.barcode %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 1a9536b..13b26b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -69,7 +69,7 @@
    1. Current Location: [% ITEM_DAT.holdingbranchname %] 
    2. -
    3. Checkout Status: [% IF ( ITEM_DAT.issue ) %]Checked out to [% ITEM_DAT.cardnumber %][% IF ( ITEM_DAT.lastreneweddate ) %], Last renewed [% ITEM_DAT.lastreneweddate %][% END %], Due back on [% ITEM_DAT.datedue %][% ELSE %]Not Checked out [% END %]
    4. +
    5. Checkout Status: [% IF ( ITEM_DAT.issue ) %]Checked out to [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrowernumber %][% ITEM_DAT.cardnumber %][% IF ( ITEM_DAT.lastreneweddate ) %], Last renewed [% ITEM_DAT.lastreneweddate %][% END %], Due back on [% ITEM_DAT.datedue %][% ELSE %]Not Checked out [% END %]
    6. Current Renewals: [% ITEM_DAT.renewals %] 
    7. [% IF ( ITEM_DAT.itemlostloop ) %]
    8. Lost Status: @@ -171,9 +171,9 @@
    9. Last seen: [% ITEM_DAT.datelastseen %] 
    10. Last borrowed: [% ITEM_DAT.datelastborrowed %] 
    11. - [% IF ( ITEM_DAT.card0 ) %]
    12. Last Borrower: [% ITEM_DAT.card0 %] 
    13. [% END %] - [% IF ( ITEM_DAT.card1 ) %]
    14. Previous Borrower: [% ITEM_DAT.card1 %] 
    15. [% END %] - [% IF ( ITEM_DAT.card2 ) %]
    16. Previous Borrower: [% ITEM_DAT.card2 %] 
    17. [% END %] + [% IF ( ITEM_DAT.card0 ) %]
    18. Last Borrower: [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrower0 %][% ITEM_DAT.card0 %] 
    19. [% END %] + [% IF ( ITEM_DAT.card1 ) %]
    20. Previous Borrower: [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrower1 %][% ITEM_DAT.card1 %] 
    21. [% END %] + [% IF ( ITEM_DAT.card2 ) %]
    22. Previous Borrower: [% INCLUDE 'patron-default-view.inc' borrowernumber = ITEM_DAT.borrower2 %][% ITEM_DAT.card2 %] 
    23. [% END %]
    24. Paid for?: [% ITEM_DAT.paidfor %] 
    25. Serial enumeration: [% ITEM_DAT.enumchron %] 
    26. Public Note: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt index a8a8912..a296536 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt @@ -48,7 +48,7 @@
      Barcode : [% overduesloo.barcode %] - [% overduesloo.borrowersurname %], [% overduesloo.borrowerfirstname %]
      [% overduesloo.borrowerphone %]
      + [% INCLUDE 'patron-default-view.inc' borrowernumber = overduesloo.borrowernumber %][% overduesloo.borrowersurname %], [% overduesloo.borrowerfirstname %]
      [% overduesloo.borrowerphone %]
      [% IF ( overduesloo.borroweremail ) %] [% overduesloo.borroweremail %][% END %] @@ -126,7 +126,7 @@

      -

      [% todayoverduesloo.borrowersurname %]   [% todayoverduesloo.borrowerfirstname %]
      [% todayoverduesloo.borrowerphone %]
      +

      [% INCLUDE 'patron-default-view.inc' borrowernumber = todayoverduesloo.borrowernumber %][% todayoverduesloo.borrowersurname %]   [% todayoverduesloo.borrowerfirstname %]
      [% todayoverduesloo.borrowerphone %]
      [% IF ( todayoverduesloo.borroweremail ) %] [% todayoverduesloo.borroweremail %][% END %]

      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt index 097089a..1d21abe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt @@ -16,10 +16,10 @@ @@ -116,7 +116,7 @@
    27. Item is already at destination library.
    28. [% END %] [% IF ( errmsgloo.errwasreturned ) %] -
    29. Item was on loan to +
    30. Item was on loan to [% INCLUDE 'patron-default-view.inc' borrowernumber = errmsgloo.borrowernumber %] [% errmsgloo.firstname %] [% errmsgloo.surname %] ([% errmsgloo.cardnumber %]) and has been returned.
    31. [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 1d0e07a..4a54ecc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -249,15 +249,15 @@ function refocus(calendar) { [% END %] [% IF ( RESERVE_WAITING ) %] -
    32. Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been waiting for [% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate %]
    33. +
    34. Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been waiting for [% INCLUDE 'patron-default-view.inc' borrowernumber = resborrowernumber %][% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate %]
    35. [% END %] [% IF ( RESERVED ) %] -
    36. Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been on hold for [% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate %]
    37. +
    38. Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been on hold for [% INCLUDE 'patron-default-view.inc' borrowernumber = resborrowernumber %][% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate %]
    39. [% END %] [% IF ( ISSUED_TO_ANOTHER ) %] -
    40. Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) is checked out to [% issued_firstname %] [% issued_surname %] ([% issued_cardnumber %]). Check in and check out?
    41. +
    42. Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) is checked out to [% INCLUDE 'patron-default-view.inc' borrowernumber = issued_borrowernumber %][% issued_firstname %] [% issued_surname %] ([% issued_cardnumber %]). Check in and check out?
    43. [% END %] [% IF ( TOO_MANY ) %] @@ -903,7 +903,7 @@ No patron matched [% message %] - + [% END %] [% END %] @@ -926,7 +926,7 @@ No patron matched [% message %] [% IF ( relprevissue.multiple_borrowers ) %][% END %] - + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt index e196399..66edb67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt @@ -116,7 +116,7 @@ [% FOREACH overdueloo IN overdueloop %] - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 004a44e..b5b53b7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -88,7 +88,7 @@ function Dopop(link) { [% IF ( WrongTransfer ) %]

      Please return [% title |html %] to [% TransferWaitingAt %]

      Print Slip or Cancel Transfer

      [% IF ( wborcnum ) %]
      Hold for:
      -
      • +
        • [% INCLUDE 'patron-default-view.inc' %] [% borsurname %], [% borfirstname %] ([% borcnum %])
        • [% wboraddress %][% IF ( wboraddress2 ) %]
          [% wboraddress2 %]
          [% END %] @@ -122,7 +122,7 @@ function Dopop(link) { [% IF ( reservenotes ) %]

          Notes: [% reservenotes %]

          [% END %]

          Hold for:

            -
          • [% borsurname %], [% borfirstname %] ([% borcnum %])
          • +
          • [% INCLUDE 'patron-default-view.inc' %][% borsurname %], [% borfirstname %] ([% borcnum %])
          • [% boraddress %]
            [% IF ( boraddress2 ) %][% boraddress2 %]
            [% END %] [% borcity %] [% borzip %]
          • @@ -163,7 +163,7 @@ function Dopop(link) {

            Hold needing transfer found: [% title |html %]

            Hold for:

              -
            • [% borsurname %], [% borfirstname %] ([% borcnum %])
            • +
            • [% INCLUDE 'patron-default-view.inc' %][% borsurname %], [% borfirstname %] ([% borcnum %])
            • [% boraddress %]
              [% IF ( boraddress2 ) %][% boraddress2 %]
              [% END %] [% borcity %] [% borzip %]
            • @@ -269,7 +269,7 @@ function Dopop(link) { [% IF ( reservenotes ) %]

              Notes: [% reservenotes %]

              [% END %]
              Hold for:
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt index 2c84d5d..ef624c4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt @@ -65,7 +65,7 @@ $(document).ready(function() {
      Barcode: [% reser.barcode %] - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt index 3ec2707..6e082c7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt @@ -93,7 +93,7 @@ $.tablesorter.addParser({   ([% reserveloo.itemtype %])
      Barcode: [% reserveloo.barcode %] - @@ -152,7 +152,7 @@ $.tablesorter.addParser({ [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %]  ([% overloo.itemtype %])[% END %][% END %]
      Barcode: [% overloo.barcode %] - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt index 1269270..00e39a1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt @@ -40,7 +40,7 @@ [% ELSE %] - + [% IF ( errormsg ) %] @@ -85,7 +85,13 @@ -
      Cancel
      +
      + [% IF ( destination == 'circ' ) %] + + [% ELSE %] + + [% END %] + Cancel
      [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index c3f3909..b2c919d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -60,7 +60,7 @@ [% END %] [% END %] - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 51a1ba1..0264d98 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -74,7 +74,7 @@ Add[% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %] [% surname %] [% firstname %] [% ELSE %] -[% firstname %] [% surname %][% IF ( opduplicate ) %]Duplicate[% ELSE %]Modify[% END %][% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %] +[% INCLUDE 'patron-default-view.inc' %][% firstname %] [% surname %] › [% IF ( opduplicate ) %]Duplicate[% ELSE %]Modify[% END %][% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %] [% END %] [% IF ( opadd ) %]
      [% ELSE %]
      [% END %] @@ -1326,7 +1326,7 @@ [% IF ( opduplicate ) %] [% ELSE %] - + [% END %] @@ -1464,7 +1464,12 @@ [% IF ( opadd ) %] Cancel [% ELSE %] - Cancel + [% IF ( destination == 'circ' ) %] + + [% ELSE %] + + [% END %] + Cancel [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt index f84052b..ed2cf60 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt @@ -16,7 +16,7 @@
      -

      Account Summary: [% firstname %] [% surname %] ([% cardnumber %])

      +

      [% INCLUDE 'patron-default-view.inc' %]Account Summary: [% firstname %] [% surname %] ([% cardnumber %])

      • [% address %]
        [% address2 %]
      • [% city %], [% zipcode %]
      • [% IF ( phone ) %][% phone %][% ELSE %](no phone number on file)[% END %]
      • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt index 4a85ccb..d3a352c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt @@ -4,12 +4,7 @@ - + @@ -18,7 +13,7 @@

        [% LibraryName %]

        [% IF ( branchname ) %][% branchname %]
        [% END %] Checked out to [% firstname %] [% surname %]
        -([% cardnumber %])
        +([% INCLUDE 'patron-default-view.inc' %][% cardnumber %])
        [% todaysdate %]
        diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index c3d7063..d770d67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -226,11 +226,11 @@ function validate1(date) { [% END %] [% IF ( isguarantee ) %] [% IF ( guaranteeloop ) %] -
      • Guarantees:
      • +
      • Guarantees:
          [% FOREACH guaranteeloo IN guaranteeloop %]
        • [% INCLUDE 'patron-default-view.inc' borrowernumber = guaranteeloo.borrowernumber %][% guaranteeloo.name %]
        • [% END %]
      • [% END %] [% ELSE %] [% IF ( guarantorborrowernumber ) %] -
      • Guarantor:[% guarantorsurname %], [% guarantorfirstname %]
      • +
      • Guarantor:[% INCLUDE 'patron-default-view.inc' borrowernumber = guarantorborrowernumber %][% guarantorsurname %], [% guarantorfirstname %]
      • [% END %] [% END %] @@ -572,7 +572,7 @@ function validate1(date) {
      - + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt index 81fa3b6..4b9c994 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt @@ -36,7 +36,8 @@ confirm_updatechild([% borrowernumber %]); [% IF ( SUCCESS ) %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt index e286cc8..c2cfac0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt @@ -78,7 +78,7 @@ - + @@ -97,7 +97,7 @@ - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt index b309d94..4548f7c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt @@ -51,7 +51,7 @@ function Dopop(link) { [% loopro.rowtitle %] [% FOREACH loopcel IN loopro.loopcell %] [% IF ( loopcel.hilighted ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index fa45e26..99b79ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -204,10 +204,10 @@ function checkMultiHold() {

      Cannot Place Hold

        [% IF ( maxreserves ) %] -
      • Too Many Holds: [% borrowerfirstname %] [% borrowersurname %] has too many holds.
      • +
      • Too Many Holds: [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %] has too many holds.
      • [% END %] [% IF ( alreadyreserved ) %] -
      • [% borrowerfirstname %] [% borrowersurname %] already has a hold on this item
      • +
      • [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %] already has a hold on this item
      • [% END %] [% IF ( none_available ) %]
      • No copies are available to be placed on hold
      • @@ -223,11 +223,11 @@ function checkMultiHold() { [% IF ( messages ) %]
          [% IF ( expiry ) %] -
        • [% borrowerfirstname %] [% borrowersurname %]'s account has expired
        • +
        • [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %]'s account has expired
        • [% END %] [% IF ( diffbranch ) %] -
        • Pickup library is different than [% borrowerfirstname %] [% borrowersurname %]'s home library ([% borrower_branchname %] / [% borrower_branchcode %] )
        • +
        • Pickup library is different than [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %]'s home library ([% borrower_branchname %] / [% borrower_branchcode %] )
        • [% END %]
        @@ -265,7 +265,7 @@ function checkMultiHold() {
        1. Patron: [% IF ( borrowernumber ) %] - [% borrowerfirstname %] [% borrowersurname %] ([% cardnumber %]) + [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %] ([% cardnumber %]) [% ELSE %] Not defined yet [% END %] @@ -460,7 +460,7 @@ function checkMultiHold() { Can't be cancelled when item is in transit [% ELSE %] [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %] - [% IF ( itemloo.canreservefromotherbranches ) %]for [% itemloo.ReservedForFirstname %] [% itemloo.ReservedForSurname %][% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemloo.ExpectedAtLibrary %] + [% IF ( itemloo.canreservefromotherbranches ) %]for [% INCLUDE 'patron-default-view.inc' borrowernumber = itemloo.ReservedForBorrowernumber %][% itemloo.ReservedForFirstname %] [% itemloo.ReservedForSurname %][% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemloo.ExpectedAtLibrary %] since [% IF ( itemloo.waitingdate ) %][% itemloo.waitingdate %][% ELSE %][% IF ( itemloo.reservedate ) %][% itemloo.reservedate %][% END %][% END %]. Cancel hold @@ -526,7 +526,7 @@ function checkMultiHold() { [% END %] [% IF ( biblioloo.alreadyres ) %] -
        2. [% borrowerfirstname %] [% borrowersurname %] already has a hold on this item
        3. +
        4. [% INCLUDE 'patron-default-view.inc' %][% borrowerfirstname %] [% borrowersurname %] already has a hold on this item
        5. [% END %] [% IF ( biblioloo.none_avail ) %]
        6. No copies are available to be placed on hold
        7. @@ -639,7 +639,7 @@ function checkMultiHold() { [% END %]
      [% FOREACH review IN reviews %] - + [% END %]
      [% IF ( reserved ) %] - Reserve found for [% name %] ([% borrowernumber %]). + Reserve found for [% name %] ([% INCLUDE 'patron-default-view.inc' %][% borrowernumber %]). [% END %] [% IF ( waiting ) %] - Item is marked waiting at [% branchname %] for [% name %] ([% borrowernumber %]). + Item is marked waiting at [% branchname %] for [% name %] ([% INCLUDE 'patron-default-view.inc' %][% borrowernumber %]). [% END %]
      [% relissue.issuingbranchname %] [% relissue.itemcallnumber %] [% relissue.charge %][% relissue.replacementprice %][% relissue.firstname %] [% relissue.surname %] ([% relissue.cardnumber %])[% relissue.replacementprice %][% INCLUDE 'patron-default-view.inc' borrowernumber = relissue.borrowernumber %][% relissue.firstname %] [% relissue.surname %] ([% relissue.cardnumber %])
      [% relprevissue.firstname %] [% relprevissue.surname %][% relprevissue.charge %] [% relprevissue.replacementprice %][% relprevissue.firstname %] [% relprevissue.surname %] ([% relprevissue.cardnumber %])[% INCLUDE 'patron-default-view.inc' borrowernumber = relprevissue.borrowernumber %][% relprevissue.firstname %] [% relprevissue.surname %] ([% relprevissue.cardnumber %])
      [% overdueloo.duedate %][% overdueloo.surname %] [% overdueloo.firstname %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = overdueloo.borrowernumber %][% overdueloo.surname %] [% overdueloo.firstname %] [% IF ( overdueloo.email ) %][email][% END %] [% IF ( overdueloo.phone ) %]([% overdueloo.phone %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro %])[% END %] [% overdueloo.branchcode %][% title |html %] - [% riborsurname %], [% ribortitle %] [% riborfirstname %] ([% riborcnum %]) + [% INCLUDE 'patron-default-view.inc' borrowernumber = riborrowernumber %][% riborsurname %], [% ribortitle %] [% riborfirstname %] ([% riborcnum %]) [% IF ( flagset ) %] ([% FOREACH flagloo IN flagloop %] [% flagloo.flag %] @@ -445,7 +445,7 @@ function Dopop(link) { [% riloo.itemcallnumber %] [% riloo.itemtype %] [% riloo.ccode %] [% IF ( riloo.duedate ) %] - + [% INCLUDE 'patron-default-view.inc' borrowernumber = riloo.borrowernumber %] [% riloo.borsurname %], [% riloo.borfirstname %] ([% riloo.borcategorycode %]) [% ELSE %]Not checked out[% END %] [% IF ( reser.borrowername ) %] - + [% INCLUDE 'patron-default-view.inc' borrowernumber = reser.borrowernum %] [% reser.borrowername %]   [% reser.borrowerfirstname %]
      [% reser.borrowerphone %]
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt index d9ba8fc..cb12736 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt @@ -77,7 +77,7 @@ $(document).ready(function() { [% itemsloo.barcode %] or any available [% END %]

      [% itemsloo.surname %], [% itemsloo.firstname %] ([% itemsloo.cardnumber %])

      [% itemsloo.phone %]

      [% INCLUDE 'patron-default-view.inc' borrowernumber = itemsloo.borrowernumber %][% itemsloo.surname %], [% itemsloo.firstname %] ([% itemsloo.cardnumber %])

      [% itemsloo.phone %]

      [% itemsloo.pickbranch %] [% itemsloo.reservedate %] [% itemsloo.notes %][% reserveloo.borrowername %], [% reserveloo.borrowerfirstname %]
      [% reserveloo.borrowerphone %]
      +
      [% INCLUDE 'patron-default-view.inc' borrowernumber = reserveloo.borrowernum %][% reserveloo.borrowername %], [% reserveloo.borrowerfirstname %]
      [% reserveloo.borrowerphone %]
      [% IF ( reserveloo.borrowermail ) %] [% reserveloo.borrowermail %][% END %]
      [% overloo.borrowername %], [% overloo.borrowerfirstname %]
      [% overloo.borrowerphone %]
      +
      [% INCLUDE 'patron-default-view.inc' borrowernumber = overloo.borrowernum %][% overloo.borrowername %], [% overloo.borrowerfirstname %]
      [% overloo.borrowerphone %]
      [% IF ( overloo.borrowermail ) %] [% overloo.borrowermail %][% END %]
      [% resultsloo.cardnumber %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = resultsloo.borrowernumber %] [% INCLUDE 'patron-title.inc' category_type = resultsloo.category_type firstname = resultsloo.firstname surname = resultsloo.surname othernames = resultsloo.othernames cardnumber = resultsloo.cardnumber %]
      [% IF ( resultsloo.streetnumber ) %][% resultsloo.streetnumber %] [% END %][% resultsloo.address %][% IF ( resultsloo.address2 ) %]
      [% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]
      [% resultsloo.city %][% IF ( resultsloo.state ) %],[% END %][% END %][% IF ( resultsloo.state ) %] [% resultsloo.state %][% END %] [% IF ( resultsloo.zipcode ) %] [% resultsloo.zipcode %][% END %][% IF ( resultsloo.country ) %], [% resultsloo.country %][% END %]
      [% resultsloo.category_description %] ([% resultsloo.category_type %])[% relissueloo.itemcallnumber %] [% relissueloo.charge %] [% relissueloo.replacementprice %][% relissueloo.firstname %] [% relissueloo.surname %] ([% relissueloo.cardnumber %])[% INCLUDE 'patron-default-view.inc' borrowernumber = relissueloo.borrowernumber %][% relissueloo.firstname %] [% relissueloo.surname %] ([% relissueloo.cardnumber %])
      Date Action BarcodeCardnumberPatron
      [% IF ( operation.actionissue ) %] [% IF ( operation.borrowernumber ) %] - [% operation.cardnumber %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = operation.borrowernumber %][% operation.borrower %] ([% operation.cardnumber %]) [% ELSE %] [% operation.cardnumber %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt index 6a66b6a..c65540d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt @@ -54,10 +54,10 @@ function CheckForm(f) { [% END %] [% IF ( message.ERROR_no_borrower_from_item ) %]

      Warning: Unable to determine patron from item barcode ([% message.badbarcode %]). Cannot check in.

      [% END %] - [% IF ( message.issue ) %]

      Checked out [% message.title |html %] ([% message.barcode %]) to [% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

      [% END %] - [% IF ( message.renew ) %]

      Renewed [% message.title |html %] ([% message.barcode %]) for [% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

      [% END %] - [% IF ( message.return ) %]

      Checked in [% message.title |html %] ([% message.barcode %]) from [% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

      [% END %] - [% IF ( message.payment ) %]

      Accepted payment ([% message.amount %]) from [% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

      [% END %] + [% IF ( message.issue ) %]

      Checked out [% message.title |html %] ([% message.barcode %]) to [% INCLUDE 'patron-default-view.inc' borrowernumber = message.borrowernumber %][% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

      [% END %] + [% IF ( message.renew ) %]

      Renewed [% message.title |html %] ([% message.barcode %]) for [% INCLUDE 'patron-default-view.inc' borrowernumber = message.borrowernumber %][% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

      [% END %] + [% IF ( message.return ) %]

      Checked in [% message.title |html %] ([% message.barcode %]) from [% INCLUDE 'patron-default-view.inc' borrowernumber = message.borrowernumber %][% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

      [% END %] + [% IF ( message.payment ) %]

      Accepted payment ([% message.amount %]) from [% INCLUDE 'patron-default-view.inc' borrowernumber = message.borrowernumber %][% message.firstname %] [% message.surname %] ([% message.cardnumber %]): [% message.datetime %]

      [% END %] [% END %] [% ELSE %]

      Upload Offline Circulation Data

      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt index cbd1db5..9a859a5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt @@ -113,7 +113,7 @@ function add_item(borrowernum,batch_id,type_id){ [% END %]
      [% resultsloo.cardnumber %][% resultsloo.surname %], [% resultsloo.firstname %]
      [% resultsloo.address %][% IF ( resultsloo.address2 ) %]
      [% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]
      [% resultsloo.city %][% END %]
      [% INCLUDE 'patron-default-view.inc' borrowernumber = resultsloo.borrowernumber %][% resultsloo.surname %], [% resultsloo.firstname %]
      [% resultsloo.address %][% IF ( resultsloo.address2 ) %]
      [% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]
      [% resultsloo.city %][% END %]
      [% resultsloo.category_description %] ([% resultsloo.categorycode %]) [% resultsloo.branchcode %] [% resultsloo.dateexpiry %][% ELSE %][% END %] - [% IF ( loopcel.reference ) %][% END %] + [% IF ( loopcel.reference ) %][% INCLUDE 'patron-default-view.inc' borrowernumber = loopcel.reference %][% END %] [% IF ( loopcel.value ) %][% loopcel.value %][% END %] [% IF ( loopcel.reference ) %][% END %] - + [% INCLUDE 'patron-default-view.inc' borrowernumber = reserveloo.borrowernumber %] [% IF ( reserveloo.hidename ) %] [% reserveloo.cardnumber (reserveloo.borrowernumber) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt index a1dabbd..76cb9971 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt @@ -44,7 +44,7 @@
      - [% review.surname %], [% review.firstname %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = review.borrowernumber %][% review.surname %], [% review.firstname %] [% review.bibliotitle %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt index 9c3f83f..f1559dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt @@ -26,7 +26,7 @@ [% FOREACH alertloo IN alertloop %]
      [% alertloo.name %]View[% INCLUDE 'patron-default-view.inc' borrowernumber = alertloo.borrowernumber %]View
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 47ee96a..1b81d67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -145,18 +145,18 @@ $(document).ready(function() { calcNewsuggTotal(); }); - [% IF ( suggestedby_borrowernumber ) %][% suggestedby_surname %], [% suggestedby_firstname %] [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %] + [% IF ( suggestedby_borrowernumber ) %][% INCLUDE 'patron-default-view.inc' borrowernumber = suggestedby_borrowernumber %][% suggestedby_surname %], [% suggestedby_firstname %] [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %] - [% IF ( managedby_borrowernumber ) %][% managedby_surname %], [% managedby_firstname %] [% managedby_branchcode %] ([% managedby_description %])[% END %] + [% IF ( managedby_borrowernumber ) %][% INCLUDE 'patron-default-view.inc' borrowernumber = managedby_borrowernumber %][% managedby_surname %], [% managedby_firstname %] [% managedby_branchcode %] ([% managedby_description %])[% END %] - [% IF ( acceptedby_borrowernumber ) %][% acceptedby_surname %], [% acceptedby_firstname %] [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %] + [% IF ( acceptedby_borrowernumber ) %][% INCLUDE 'patron-default-view.inc' borrowernumber = acceptedby_borrowernumber %][% acceptedby_surname %], [% acceptedby_firstname %] [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index b2ab90f..d4b4575 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -153,27 +153,26 @@ [% loopro.timestamp %] [% IF ( module == 'CIRCULATION' ) %] - [% loopro.user %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = loopro.user %] [% loopro.user %] [% ELSE %] - [% loopro.user %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = loopro.user %] [% loopro.user %] [% END %] [% loopro.module %] [% loopro.action %] [% IF ( module == 'MEMBERS' ) %] - member [% loopro.object %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = loopro.object %] patron [% loopro.object %] [% ELSE %] [% IF ( module == 'CIRCULATION' ) %] - - [% IF ( loopro.object ) %] - member [% loopro.object %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = loopro.object %] [% IF ( loopro.object ) %] + patron [% loopro.object %] [% END %] [% ELSE %] [% IF ( module == 'CATALOGUING' ) %] [% IF ( info == 'item' ) %] - Item [% loopro.object %] + Item [% loopro.object %] [% ELSE %] biblio [% loopro.object %] [% END %] @@ -208,7 +207,7 @@ for Bibliographic Record [% object %] [% END %] [% IF ( MEMBERS ) %] - for [% INCLUDE 'patron-title.inc' %] + for [% INCLUDE 'patron-default-view.inc' borrowernumber = object %][% INCLUDE 'patron-title.inc' %] [% END %] .
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index b054e09..ebc9a54 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -403,7 +403,7 @@ function placeHold () { [% FOREACH shelvesloo IN shelvesloop %] [% IF ( shelvesloo.toggle ) %][% ELSE %][% END %] [% shelvesloo.shelfname |html %] - [% shelvesloo.ownername %] + [% INCLUDE 'patron-default-view.inc' borrowernumber = shelvesloo.owner %][% shelvesloo.ownername %] [% shelvesloo.count %] item(s) [% IF ( shelvesloo.authorsort ) %]Author[% ELSIF ( shelvesloo.yearsort ) %]Year[% ELSE %]Title[% END %] [% IF ( shelvesloo.viewcategory1 ) %]Private[% END %] -- 1.7.3 From srdjan at catalyst.net.nz Fri Mar 9 01:26:50 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Fri, 9 Mar 2012 13:26:50 +1300 Subject: [Koha-patches] [PATCH] bug_7001: Issue and Reserve slips are notices. In-Reply-To: References: Message-ID: <1331252810-31583-1-git-send-email-srdjan@catalyst.net.nz> Branches can have their own version of notices - added branchcode to letter table. Support html notices - added is_html to letter table. Support for borrower attributes in templates. GetPreparedletter() is the interface for compiling letters (notices). Sysprefs for notice and slips stylesheets Added TRANSFERSLIP to the letters --- C4/Circulation.pm | 50 ++- C4/Letters.pm | 549 +++++++++++++------- C4/Members.pm | 81 +++- C4/Members/Attributes.pm | 18 + C4/Message.pm | 12 +- C4/Print.pm | 146 ++---- C4/Reserves.pm | 103 +++-- C4/Suggestions.pm | 22 +- acqui/booksellers.pl | 7 +- circ/circulation.pl | 3 +- circ/hold-transfer-slip.pl | 32 +- circ/transfer-slip.pl | 32 +- .../data/mysql/de-DE/mandatory/sample_notices.sql | 2 +- .../data/mysql/en/mandatory/sample_notices.sql | 92 ++++- .../data/mysql/es-ES/mandatory/sample_notices.sql | 2 +- .../mysql/fr-FR/1-Obligatoire/sample_notices.sql | 2 +- installer/data/mysql/it-IT/necessari/notices.sql | 2 +- installer/data/mysql/kohastructure.sql | 7 +- .../mysql/nb-NO/1-Obligatorisk/sample_notices.sql | 2 +- .../data/mysql/pl-PL/mandatory/sample_notices.sql | 2 +- .../data/mysql/ru-RU/mandatory/sample_notices.sql | 2 +- installer/data/mysql/sysprefs.sql | 3 + .../data/mysql/uk-UA/mandatory/sample_notices.sql | 2 +- installer/data/mysql/updatedatabase.pl | 111 ++++- .../prog/en/includes/circ-toolbar.inc | 4 +- .../en/modules/admin/preferences/circulation.pref | 5 + .../en/modules/admin/preferences/staff_client.pref | 5 + .../prog/en/modules/batch/print-notices.tt | 6 +- .../prog/en/modules/circ/hold-transfer-slip.tt | 54 -- .../prog/en/modules/circ/printslip.tt | 28 + .../intranet-tmpl/prog/en/modules/tools/letter.tt | 162 +++++-- .../prog/en/modules/tools/tools-home.tt | 2 +- members/memberentry.pl | 5 +- members/moremember.pl | 10 - members/printslip.pl | 92 ++++ misc/cronjobs/advance_notices.pl | 78 ++-- misc/cronjobs/gather_print_notices.pl | 14 +- misc/cronjobs/overdue_notices.pl | 86 ++-- t/db_dependent/lib/KohaTest/Letters.pm | 5 +- t/db_dependent/lib/KohaTest/Letters/GetLetter.pm | 3 +- t/db_dependent/lib/KohaTest/Members.pm | 1 + t/db_dependent/lib/KohaTest/Print.pm | 5 +- t/db_dependent/lib/KohaTest/Reserves.pm | 1 + tools/letter.pl | 230 ++++++--- 44 files changed, 1377 insertions(+), 703 deletions(-) mode change 100755 => 100644 installer/data/mysql/updatedatabase.pl delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt create mode 100755 members/printslip.pl diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 1a156d9..999f617 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -99,6 +99,7 @@ BEGIN { &IsBranchTransferAllowed &CreateBranchTransferLimit &DeleteBranchTransferLimits + &TransferSlip ); # subs to deal with offline circulation @@ -2676,11 +2677,18 @@ sub SendCirculationAlert { borrowernumber => $borrower->{borrowernumber}, message_name => $message_name{$type}, }); - my $letter = C4::Letters::getletter('circulation', $type); - C4::Letters::parseletter($letter, 'biblio', $item->{biblionumber}); - C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber}); - C4::Letters::parseletter($letter, 'borrowers', $borrower->{borrowernumber}); - C4::Letters::parseletter($letter, 'branches', $branch); + my $letter = C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => $type, + branchcode => $branch, + tables => { + 'biblio' => $item->{biblionumber}, + 'biblioitems' => $item->{biblionumber}, + 'borrowers' => $borrower, + 'branches' => $branch, + } + ) or return; + my @transports = @{ $borrower_preferences->{transports} }; # warn "no transports" unless @transports; for (@transports) { @@ -2695,7 +2703,8 @@ sub SendCirculationAlert { $message->update; } } - $letter; + + return $letter; } =head2 updateWrongTransfer @@ -3147,6 +3156,35 @@ sub ProcessOfflineIssue { +=head2 TransferSlip + + TransferSlip($user_branch, $itemnumber, $to_branch) + + Returns letter hash ( see C4::Letters::GetPreparedLetter ) or undef + +=cut + +sub TransferSlip { + my ($branch, $itemnumber, $to_branch) = @_; + + my $item = GetItem( $itemnumber ) + or return; + + my $pulldate = C4::Dates->new(); + + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => 'TRANSFERSLIP', + branchcode => $branch, + tables => { + 'branches' => $to_branch, + 'biblio' => $item->{biblionumber}, + 'items' => $item, + }, + ); +} + + 1; __END__ diff --git a/C4/Letters.pm b/C4/Letters.pm index 28c6984..5080a0c 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -24,6 +24,7 @@ use MIME::Lite; use Mail::Sendmail; use C4::Members; +use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Branch; use C4::Log; use C4::SMS; @@ -40,7 +41,7 @@ BEGIN { $VERSION = 3.01; @ISA = qw(Exporter); @EXPORT = qw( - &GetLetters &getletter &addalert &getalert &delalert &findrelatedto &SendAlerts GetPrintMessages + &GetLetters &GetPreparedLetter &GetWrappedLetter &addalert &getalert &delalert &findrelatedto &SendAlerts &GetPrintMessages ); } @@ -115,13 +116,26 @@ sub GetLetters (;$) { return \%letters; } -sub getletter ($$) { - my ( $module, $code ) = @_; +my %letter; +sub getletter ($$$) { + my ( $module, $code, $branchcode ) = @_; + + if (C4::Context->preference('IndependantBranches') && $branchcode){ + $branchcode = C4::Context->userenv->{'branch'}; + } + + if ( my $l = $letter{$module}{$code}{$branchcode} ) { + return { %$l }; # deep copy + } + my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("select * from letter where module=? and code=?"); - $sth->execute( $module, $code ); - my $line = $sth->fetchrow_hashref; - return $line; + my $sth = $dbh->prepare("select * from letter where module=? and code=? and (branchcode = ? or branchcode = '') order by branchcode desc limit 1"); + $sth->execute( $module, $code, $branchcode ); + my $line = $sth->fetchrow_hashref + or return; + $line->{'content-type'} = 'text/html; charset="UTF-8"' if $line->{is_html}; + $letter{$module}{$code}{$branchcode} = $line; + return { %$line }; } =head2 addalert ($borrowernumber, $type, $externalid) @@ -176,7 +190,7 @@ sub delalert ($) { sub getalert (;$$$) { my ( $borrowernumber, $type, $externalid ) = @_; my $dbh = C4::Context->dbh; - my $query = "SELECT * FROM alert WHERE"; + my $query = "SELECT a.*, b.branchcode FROM alert a JOIN borrowers b USING(borrowernumber) WHERE"; my @bind; if ($borrowernumber and $borrowernumber =~ /^\d+$/) { $query .= " borrowernumber=? AND "; @@ -232,73 +246,68 @@ sub findrelatedto ($$) { parameters : - $type : the type of alert - $externalid : the id of the "object" to query - - $letter : the letter to send. + - $letter_code : the letter to send. send an alert to all borrowers having put an alert on a given subject. =cut sub SendAlerts { - my ( $type, $externalid, $letter ) = @_; + my ( $type, $externalid, $letter_code ) = @_; my $dbh = C4::Context->dbh; my $strsth; if ( $type eq 'issue' ) { - # warn "sending issues..."; - my $letter = getletter( 'serial', $letter ); - # prepare the letter... # search the biblionumber my $sth = $dbh->prepare( "SELECT biblionumber FROM subscription WHERE subscriptionid=?"); $sth->execute($externalid); - my ($biblionumber) = $sth->fetchrow; - - # parsing branch info - my $userenv = C4::Context->userenv; - parseletter( $letter, 'branches', $userenv->{branch} ); - - # parsing librarian name - $letter->{content} =~ s/<>/$userenv->{firstname}/g; - $letter->{content} =~ s/<>/$userenv->{surname}/g; - $letter->{content} =~ - s/<>/$userenv->{emailaddress}/g; - - # parsing biblio information - parseletter( $letter, 'biblio', $biblionumber ); - parseletter( $letter, 'biblioitems', $biblionumber ); + my ($biblionumber) = $sth->fetchrow + or warn( "No subscription for '$externalid'" ), + return; + my %letter; # find the list of borrowers to alert my $alerts = getalert( '', 'issue', $externalid ); foreach (@$alerts) { - # and parse borrower ... - my $innerletter = $letter; my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); - parseletter( $innerletter, 'borrowers', $_->{'borrowernumber'} ); + my $email = $borinfo->{email} or next; + + # warn "sending issues..."; + my $userenv = C4::Context->userenv; + my $letter = GetPreparedLetter ( + module => 'serial', + letter_code => $letter_code, + branchcode => $userenv->{branch}, + tables => { + 'branches' => $_->{branchcode}, + 'biblio' => $biblionumber, + 'biblioitems' => $biblionumber, + 'borrowers' => $borinfo, + }, + want_librarian => 1, + ) or return; # ... then send mail - if ( $borinfo->{email} ) { - my %mail = ( - To => $borinfo->{email}, - From => $borinfo->{email}, - Subject => "" . $innerletter->{title}, - Message => "" . $innerletter->{content}, - 'Content-Type' => 'text/plain; charset="utf8"', - ); - sendmail(%mail) or carp $Mail::Sendmail::error; - - } + my %mail = ( + To => $email, + From => $email, + Subject => "" . $letter->{title}, + Message => "" . $letter->{content}, + 'Content-Type' => 'text/plain; charset="utf8"', + ); + sendmail(%mail) or carp $Mail::Sendmail::error; } } - elsif ( $type eq 'claimacquisition' ) { - - $letter = getletter( 'claimacquisition', $letter ); + elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) { # prepare the letter... # search the biblionumber - $strsth = qq{ + $strsth = $type eq 'claimacquisition' + ? qq{ SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*,aqbooksellers.* FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno @@ -306,114 +315,83 @@ sub SendAlerts { LEFT JOIN biblioitems ON aqorders.biblioitemnumber=biblioitems.biblioitemnumber LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id WHERE aqorders.ordernumber IN ( - } - . join( ",", @$externalid ) . ")"; - } - elsif ( $type eq 'claimissues' ) { - - $letter = getletter( 'claimissues', $letter ); - - # prepare the letter... - # search the biblionumber - $strsth = qq{ + } + : qq{ SELECT serial.*,subscription.*, biblio.*, aqbooksellers.* FROM serial LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid LEFT JOIN biblio ON serial.biblionumber=biblio.biblionumber LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id WHERE serial.serialid IN ( - } + } . join( ",", @$externalid ) . ")"; - } - - if ( $type eq 'claimacquisition' or $type eq 'claimissues' ) { my $sthorders = $dbh->prepare($strsth); $sthorders->execute; - my @fields = map { - $sthorders->{mysql_table}[$_] . "." . $sthorders->{NAME}[$_] } - (0 .. $#{$sthorders->{NAME}} ) ; - - my @orders_infos; - while ( my $row = $sthorders->fetchrow_arrayref() ) { - my %rec = (); - @rec{@fields} = @$row; - push @orders_infos, \%rec; + my $dataorders = $sthorders->fetchall_arrayref( {} ); + + my $sthbookseller = + $dbh->prepare("select * from aqbooksellers where id=?"); + $sthbookseller->execute( $dataorders->[0]->{booksellerid} ); + my $databookseller = $sthbookseller->fetchrow_hashref; + + my @email; + push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail}; + push @email, $databookseller->{contemail} if $databookseller->{contemail}; + unless (@email) { + warn "Bookseller $dataorders->[0]->{booksellerid} without emails"; + return; } - # parsing branch info my $userenv = C4::Context->userenv; - parseletter( $letter, 'branches', $userenv->{branch} ); - - # parsing librarian name - $letter->{content} =~ s/<>/$userenv->{firstname}/g; - $letter->{content} =~ s/<>/$userenv->{surname}/g; - $letter->{content} =~ s/<>/$userenv->{emailaddress}/g; - - # Get Fields remplacement - my $order_format = $1 if ( $letter->{content} =~ m/(.*<\/order>)/xms ); - - # Foreach field to remplace - while ( $letter->{content} =~ m/<<([^>]*)>>/g ) { - my $field = $1; - my $value = $orders_infos[0]->{$field} || ""; - $value = sprintf("%.2f", $value) if $field =~ /price/; - $letter->{content} =~ s/<<$field>>/$value/g; - } - - if ( $order_format ) { - # For each order - foreach my $infos ( @orders_infos ) { - my $order_content = $order_format; - # We replace by value - while ( $order_content =~ m/<<([^>]*)>>/g ) { - my $field = $1; - my $value = $infos->{$field} || ""; - $value = sprintf("%.2f", $value) if $field =~ /price/; - $order_content =~ s/(<<$field>>)/$value/g; - } - $order_content =~ s/<\/{0,1}?order>//g; - $letter->{content} =~ s/.*<\/order>/$order_content\n$order_format/xms; - } - $letter->{content} =~ s/.*<\/order>//xms; - } - - my $innerletter = $letter; + my $letter = GetPreparedLetter ( + module => $type, + letter_code => $letter_code, + branchcode => $userenv->{branch}, + tables => { + 'branches' => $userenv->{branch}, + 'aqbooksellers' => $databookseller, + }, + repeat => $dataorders, + want_librarian => 1, + ) or return; # ... then send mail - if ( $orders_infos[0]->{'aqbooksellers.bookselleremail'} - || $orders_infos[0]->{'aqbooksellers.contemail'} ) { - my $to = $orders_infos[0]->{'aqbooksellers.bookselleremail'}; - $to .= ", " if $to; - $to .= $orders_infos[0]->{'aqbooksellers.contemail'} || ""; - my %mail = ( - To => $to, - From => $userenv->{emailaddress}, - Subject => Encode::encode( "utf8", "" . $innerletter->{title} ), - Message => Encode::encode( "utf8", "" . $innerletter->{content} ), - 'Content-Type' => 'text/plain; charset="utf8"', - ); - sendmail(%mail) or carp $Mail::Sendmail::error; - warn "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}" if $debug; - if ( C4::Context->preference("LetterLog") ) { - logaction( "ACQUISITION", "Send Acquisition claim letter", "", "order list : " . join( ",", @$externalid ) . "\n$innerletter->{title}\n$innerletter->{content}" ) if $type eq 'claimacquisition'; - logaction( "ACQUISITION", "CLAIM ISSUE", undef, "To=" . $mail{To} . " Title=" . $innerletter->{title} . " Content=" . $innerletter->{content} ) if $type eq 'claimissues'; - } - } else { - return {error => "no_email" }; - } - - warn "sending to From $userenv->{emailaddress} subj $innerletter->{title} Mess $innerletter->{content}" if $debug; - } + my %mail = ( + To => join( ','. @email), + From => $userenv->{emailaddress}, + Subject => "" . $letter->{title}, + Message => "" . $letter->{content}, + 'Content-Type' => 'text/plain; charset="utf8"', + ); + sendmail(%mail) or carp $Mail::Sendmail::error; - # send an "account details" notice to a newly created user + logaction( + "ACQUISITION", + $type eq 'claimissues' ? "CLAIM ISSUE" : "ACQUISITION CLAIM", + undef, + "To=" + . $databookseller->{contemail} + . " Title=" + . $letter->{title} + . " Content=" + . $letter->{content} + ) if C4::Context->preference("LetterLog"); + } + # send an "account details" notice to a newly created user elsif ( $type eq 'members' ) { - # must parse the password special, before it's hashed. - $letter->{content} =~ s/<>/$externalid->{'password'}/g; - - parseletter( $letter, 'borrowers', $externalid->{'borrowernumber'}); - parseletter( $letter, 'branches', $externalid->{'branchcode'} ); - my $branchdetails = GetBranchDetail($externalid->{'branchcode'}); + my $letter = GetPreparedLetter ( + module => 'members', + letter_code => $letter_code, + branchcode => $externalid->{'branchcode'}, + tables => { + 'branches' => $branchdetails, + 'borrowers' => $externalid->{'borrowernumber'}, + }, + substitute => { 'borrowers.password' => $externalid->{'password'} }, + want_librarian => 1, + ) or return; + my %mail = ( To => $externalid->{'emailaddr'}, From => $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"), @@ -425,24 +403,148 @@ sub SendAlerts { } } -=head2 parseletter($letter, $table, $pk) - - parameters : - - $letter : a hash to letter fields (title & content useful) - - $table : the Koha table to parse. - - $pk : the primary key to query on the $table table - parse all fields from a table, and replace values in title & content with the appropriate value - (not exported sub, used only internally) +=head2 GetPreparedLetter( %params ) + + %params hash: + module => letter module, mandatory + letter_code => letter code, mandatory + branchcode => for letter selection, if missing default system letter taken + tables => a hashref with table names as keys. Values are either: + - a scalar - primary key value + - an arrayref - primary key values + - a hashref - full record + substitute => custom substitution key/value pairs + repeat => records to be substituted on consecutive lines: + - an arrayref - tries to guess what needs substituting by + taking remaining << >> tokensr; not recommended + - a hashref token => @tables - replaces << >> << >> + subtemplate for each @tables row; table is a hashref as above + want_librarian => boolean, if set to true triggers librarian details + substitution from the userenv + Return value: + letter fields hashref (title & content useful) =cut -our %handles = (); -our %columns = (); +sub GetPreparedLetter { + my %params = @_; + + my $module = $params{module} or croak "No module"; + my $letter_code = $params{letter_code} or croak "No letter_code"; + my $branchcode = $params{branchcode} || ''; + + my $letter = getletter( $module, $letter_code, $branchcode ) + or warn( "No $module $letter_code letter"), + return; -sub parseletter_sth { + my $tables = $params{tables}; + my $substitute = $params{substitute}; + my $repeat = $params{repeat}; + $tables || $substitute || $repeat + or carp( "ERROR: nothing to substitute - both 'tables' and 'substitute' are empty" ), + return; + my $want_librarian = $params{want_librarian}; + + if ($substitute) { + while ( my ($token, $val) = each %$substitute ) { + $letter->{title} =~ s/<<$token>>/$val/g; + $letter->{content} =~ s/<<$token>>/$val/g; + } + } + + if ($want_librarian) { + # parsing librarian name + my $userenv = C4::Context->userenv; + $letter->{content} =~ s/<>/$userenv->{firstname}/go; + $letter->{content} =~ s/<>/$userenv->{surname}/go; + $letter->{content} =~ s/<>/$userenv->{emailaddress}/go; + } + + my ($repeat_no_enclosing_tags, $repeat_enclosing_tags); + + if ($repeat) { + if (ref ($repeat) eq 'ARRAY' ) { + $repeat_no_enclosing_tags = $repeat; + } else { + $repeat_enclosing_tags = $repeat; + } + } + + if ($repeat_enclosing_tags) { + while ( my ($tag, $tag_tables) = each %$repeat_enclosing_tags ) { + if ( $letter->{content} =~ m!<$tag>(.*)!s ) { + my $subcontent = $1; + my @lines = map { + my %subletter = ( title => '', content => $subcontent ); + _substitute_tables( \%subletter, $_ ); + $subletter{content}; + } @$tag_tables; + $letter->{content} =~ s!<$tag>.*!join( "\n", @lines )!se; + } + } + } + + if ($tables) { + _substitute_tables( $letter, $tables ); + } + + if ($repeat_no_enclosing_tags) { + if ( $letter->{content} =~ m/[^\n]*<<.*>>[^\n]*/so ) { + my $line = $&; + my $i = 1; + my @lines = map { + my $c = $line; + $c =~ s/<>/$i/go; + foreach my $field ( keys %{$_} ) { + $c =~ s/(<<[^\.]+.$field>>)/$_->{$field}/; + } + $i++; + $c; + } @$repeat_no_enclosing_tags; + + my $replaceby = join( "\n", @lines ); + $letter->{content} =~ s/\Q$line\E/$replaceby/s; + } + } + + $letter->{content} =~ s/<<\S*>>//go; #remove any stragglers +# $letter->{content} =~ s/<<[^>]*>>//go; + + return $letter; +} + +sub _substitute_tables { + my ( $letter, $tables ) = @_; + while ( my ($table, $param) = each %$tables ) { + next unless $param; + + my $ref = ref $param; + + my $values; + if ($ref && $ref eq 'HASH') { + $values = $param; + } + else { + my @pk; + my $sth = _parseletter_sth($table); + unless ($sth) { + warn "_parseletter_sth('$table') failed to return a valid sth. No substitution will be done for that table."; + return; + } + $sth->execute( $ref ? @$param : $param ); + + $values = $sth->fetchrow_hashref; + } + + _parseletter ( $letter, $table, $values ); + } +} + +my %handles = (); +sub _parseletter_sth { my $table = shift; unless ($table) { - carp "ERROR: parseletter_sth() called without argument (table)"; + carp "ERROR: _parseletter_sth() called without argument (table)"; return; } # check cache first @@ -456,9 +558,12 @@ sub parseletter_sth { ($table eq 'borrowers' ) ? "SELECT * FROM $table WHERE borrowernumber = ?" : ($table eq 'branches' ) ? "SELECT * FROM $table WHERE branchcode = ?" : ($table eq 'suggestions' ) ? "SELECT * FROM $table WHERE suggestionid = ?" : - ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE id = ?" : undef ; + ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE id = ?" : + ($table eq 'aqorders' ) ? "SELECT * FROM $table WHERE ordernumber = ?" : + ($table eq 'opac_news' ) ? "SELECT * FROM $table WHERE idnew = ?" : + undef ; unless ($query) { - warn "ERROR: No parseletter_sth query for table '$table'"; + warn "ERROR: No _parseletter_sth query for table '$table'"; return; # nothing to get } unless ($handles{$table} = C4::Context->dbh->prepare($query)) { @@ -468,25 +573,21 @@ sub parseletter_sth { return $handles{$table}; # now cache is populated for that $table } -sub parseletter { - my ( $letter, $table, $pk, $pk2 ) = @_; - unless ($letter) { - carp "ERROR: parseletter() 1st argument 'letter' empty"; - return; - } - my $sth = parseletter_sth($table); - unless ($sth) { - warn "parseletter_sth('$table') failed to return a valid sth. No substitution will be done for that table."; - return; - } - if ( $pk2 ) { - $sth->execute($pk, $pk2); - } else { - $sth->execute($pk); - } +=head2 _parseletter($letter, $table, $values) - my $values = $sth->fetchrow_hashref; - + parameters : + - $letter : a hash to letter fields (title & content useful) + - $table : the Koha table to parse. + - $values : table record hashref + parse all fields from a table, and replace values in title & content with the appropriate value + (not exported sub, used only internally) + +=cut + +my %columns = (); +sub _parseletter { + my ( $letter, $table, $values ) = @_; + # TEMPORARY hack until the expirationdate column is added to reserves if ( $table eq 'reserves' && $values->{'waitingdate'} ) { my @waitingdate = split /-/, $values->{'waitingdate'}; @@ -500,16 +601,51 @@ sub parseletter { )->output(); } + if ($letter->{content} && $letter->{content} =~ /<>/) { + my @da = localtime(); + my $todaysdate = "$da[2]:$da[1] " . C4::Dates->today(); + $letter->{content} =~ s/<>/$todaysdate/go; + } # and get all fields from the table - my $columns = C4::Context->dbh->prepare("SHOW COLUMNS FROM $table"); - $columns->execute; - while ( ( my $field ) = $columns->fetchrow_array ) { - my $replacefield = "<<$table.$field>>"; - $values->{$field} =~ s/\p{P}(?=$)//g if $values->{$field}; - my $replacedby = $values->{$field} || ''; - ($letter->{title} ) and $letter->{title} =~ s/$replacefield/$replacedby/g; - ($letter->{content}) and $letter->{content} =~ s/$replacefield/$replacedby/g; +# my $columns = $columns{$table}; +# unless ($columns) { +# $columns = $columns{$table} = C4::Context->dbh->selectcol_arrayref("SHOW COLUMNS FROM $table"); +# } +# foreach my $field (@$columns) { + + while ( my ($field, $val) = each %$values ) { + my $replacetablefield = "<<$table.$field>>"; + my $replacefield = "<<$field>>"; + $val =~ s/\p{P}(?=$)//g if $val; + my $replacedby = defined ($val) ? $val : ''; + ($letter->{title} ) and do { + $letter->{title} =~ s/$replacetablefield/$replacedby/g; + $letter->{title} =~ s/$replacefield/$replacedby/g; + }; + ($letter->{content}) and do { + $letter->{content} =~ s/$replacetablefield/$replacedby/g; + $letter->{content} =~ s/$replacefield/$replacedby/g; + }; + } + + if ($table eq 'borrowers' && $letter->{content}) { + if ( my $attributes = GetBorrowerAttributes($values->{borrowernumber}) ) { + my %attr; + foreach (@$attributes) { + my $code = $_->{code}; + my $val = $_->{value_description} || $_->{value}; + $val =~ s/\p{P}(?=$)//g if $val; + next unless $val gt ''; + $attr{$code} ||= []; + push @{ $attr{$code} }, $val; + } + while ( my ($code, $val_ar) = each %attr ) { + my $replacefield = "<>"; + my $replacedby = join ',', @$val_ar; + $letter->{content} =~ s/$replacefield/$replacedby/g; + } + } } return $letter; } @@ -694,31 +830,32 @@ returns your letter object, with the content updated. sub _add_attachments { my $params = shift; - return unless 'HASH' eq ref $params; - foreach my $required_parameter (qw( letter attachments message )) { - return unless exists $params->{$required_parameter}; - } - return $params->{'letter'} unless @{ $params->{'attachments'} }; + my $letter = $params->{'letter'}; + my $attachments = $params->{'attachments'}; + return $letter unless @$attachments; + my $message = $params->{'message'}; # First, we have to put the body in as the first attachment - $params->{'message'}->attach( - Type => 'TEXT', - Data => $params->{'letter'}->{'content'}, + $message->attach( + Type => $letter->{'content-type'} || 'TEXT', + Data => $letter->{'is_html'} + ? _wrap_html($letter->{'content'}, $letter->{'title'}) + : $letter->{'content'}, ); - foreach my $attachment ( @{ $params->{'attachments'} } ) { - $params->{'message'}->attach( + foreach my $attachment ( @$attachments ) { + $message->attach( Type => $attachment->{'type'}, Data => $attachment->{'content'}, Filename => $attachment->{'filename'}, ); } # we're forcing list context here to get the header, not the count back from grep. - ( $params->{'letter'}->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) ); - $params->{'letter'}->{'content-type'} =~ s/^Content-Type:\s+//; - $params->{'letter'}->{'content'} = $params->{'message'}->body_as_string; + ( $letter->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) ); + $letter->{'content-type'} =~ s/^Content-Type:\s+//; + $letter->{'content'} = $message->body_as_string; - return $params->{'letter'}; + return $letter; } @@ -785,14 +922,17 @@ sub _send_message_by_email ($;$$$) { my $utf8 = decode('MIME-Header', $message->{'subject'} ); $message->{subject}= encode('MIME-Header', $utf8); + my $subject = encode('utf8', $message->{'subject'}); my $content = encode('utf8', $message->{'content'}); + my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"'; + my $is_html = $content_type =~ m/html/io; my %sendmail_params = ( To => $to_address, From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'), - Subject => encode('utf8', $message->{'subject'}), + Subject => $subject, charset => 'utf8', - Message => $content, - 'content-type' => $message->{'content_type'} || 'text/plain; charset="UTF-8"', + Message => $is_html ? _wrap_html($content, $subject) : $content, + 'content-type' => $content_type, ); $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username; if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) { @@ -812,6 +952,27 @@ sub _send_message_by_email ($;$$$) { } } +sub _wrap_html { + my ($content, $title) = @_; + + my $css = C4::Context->preference("NoticeCSS") || ''; + $css = qq{} if $css; + return < + + +$title + +$css + + +$content + + +EOS +} + sub _send_message_by_sms ($) { my $message = shift or return undef; my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} ); diff --git a/C4/Members.pm b/C4/Members.pm index b81872c..7def77e 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -23,7 +23,7 @@ package C4::Members; use strict; #use warnings; FIXME - Bug 2505 use C4::Context; -use C4::Dates qw(format_date_in_iso); +use C4::Dates qw(format_date_in_iso format_date); use Digest::MD5 qw(md5_base64); use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/; use C4::Log; # logaction @@ -31,8 +31,10 @@ use C4::Overdues; use C4::Reserves; use C4::Accounts; use C4::Biblio; +use C4::Letters; use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable); use C4::Members::Attributes qw(SearchIdMatchingAttribute); +use C4::NewsChannels; #get slip news our ($VERSION, at ISA, at EXPORT, at EXPORT_OK,$debug); @@ -91,6 +93,8 @@ BEGIN { &DeleteMessage &GetMessages &GetMessagesCount + + &IssueSlip ); #Modify data @@ -2229,7 +2233,80 @@ sub DeleteMessage { logaction("MEMBERS", "DELCIRCMESSAGE", $message->{'borrowernumber'}, $message->{'message'}) if C4::Context->preference("BorrowersLog"); } -END { } # module clean-up code here (global destructor) +=head2 IssueSlip + + IssueSlip($branchcode, $borrowernumber, $quickslip) + + Returns letter hash ( see C4::Letters::GetPreparedLetter ) + + $quickslip is boolean, to indicate whether we want a quick slip + +=cut + +sub IssueSlip { + my ($branch, $borrowernumber, $quickslip) = @_; + +# return unless ( C4::Context->boolean_preference('printcirculationslips') ); + + my $today = POSIX::strftime("%Y-%m-%d", localtime); + + my $issueslist = GetPendingIssues($borrowernumber); + foreach my $it (@$issueslist){ + if ($it->{'issuedate'} eq $today) { + $it->{'today'} = 1; + } + elsif ($it->{'date_due'} le $today) { + $it->{'overdue'} = 1; + } + + $it->{'date_due'}=format_date($it->{'date_due'}); + } + my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist; + + my ($letter_code, %repeat); + if ( $quickslip ) { + $letter_code = 'ISSUEQSLIP'; + %repeat = ( + 'checkedout' => [ map { + 'biblio' => $_, + 'items' => $_, + 'issues' => $_, + }, grep { $_->{'today'} } @issues ], + ); + } + else { + $letter_code = 'ISSUESLIP'; + %repeat = ( + 'checkedout' => [ map { + 'biblio' => $_, + 'items' => $_, + 'issues' => $_, + }, grep { !$_->{'overdue'} } @issues ], + + 'overdue' => [ map { + 'biblio' => $_, + 'items' => $_, + 'issues' => $_, + }, grep { $_->{'overdue'} } @issues ], + + 'news' => [ map { + $_->{'timestamp'} = $_->{'newdate'}; + { opac_news => $_ } + } @{ GetNewsToDisplay("slip") } ], + ); + } + + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => $letter_code, + branchcode => $branch, + tables => { + 'branches' => $branch, + 'borrowers' => $borrowernumber, + }, + repeat => \%repeat, + ); +} 1; diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm index 4ae5600..33affa8 100644 --- a/C4/Members/Attributes.pm +++ b/C4/Members/Attributes.pm @@ -95,6 +95,24 @@ sub GetBorrowerAttributes { return \@results; } +=head2 GetAttributes + + my $attributes = C4::Members::Attributes::GetAttributes([$opac_only]); + +Retrieve an arrayref of extended attribute codes + +=cut + +sub GetAttributes { + my ($opac_only) = @_; + + my $dbh = C4::Context->dbh(); + my $query = "SELECT code FROM borrower_attribute_types"; + $query .= "\nWHERE opac_display = 1" if $opac_only; + $query .= "\nORDER BY code"; + return $dbh->selectcol_arrayref($query); +} + =head2 GetBorrowerAttributeValue my $value = C4::Members::Attributes::GetBorrowerAttributeValue($borrowernumber, $attribute_code); diff --git a/C4/Message.pm b/C4/Message.pm index 16272ff..4b88970 100644 --- a/C4/Message.pm +++ b/C4/Message.pm @@ -18,9 +18,15 @@ How to add a new message to the queue: use C4::Items; my $borrower = { borrowernumber => 1 }; my $item = C4::Items::GetItem(1); - my $letter = C4::Letters::getletter('circulation', 'CHECKOUT'); - C4::Letters::parseletter($letter, 'biblio', $item->{biblionumber}); - C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber}); + my $letter = C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => 'CHECKOUT', + branchcode => $branch, + tables => { + 'biblio', $item->{biblionumber}, + 'biblioitems', $item->{biblionumber}, + }, + ); C4::Message->enqueue($letter, $borrower->{borrowernumber}, 'email'); How to update a borrower's last checkout message: diff --git a/C4/Print.pm b/C4/Print.pm index f810816..7fb55cf 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -20,8 +20,6 @@ package C4::Print; use strict; #use warnings; FIXME - Bug 2505 use C4::Context; -use C4::Members; -use C4::Dates qw(format_date); use vars qw($VERSION @ISA @EXPORT); @@ -30,7 +28,7 @@ BEGIN { $VERSION = 3.01; require Exporter; @ISA = qw(Exporter); - @EXPORT = qw(&remoteprint &printreserve &printslip); + @EXPORT = qw(&printslip); } =head1 NAME @@ -47,28 +45,48 @@ The functions in this module handle sending text to a printer. =head1 FUNCTIONS -=head2 remoteprint +=cut - &remoteprint($items, $borrower); +=comment + my $slip = <<"EOF"; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Date: $todaysdate; -Prints the list of items in C<$items> to a printer. +ITEM RESERVED: +$itemdata->{'title'} ($itemdata->{'author'}) +barcode: $itemdata->{'barcode'} -C<$borrower> is a reference-to-hash giving information about a patron. -This may be gotten from C<&GetMemberDetails>. The patron's name -will be printed in the output. +COLLECT AT: $branchname + +BORROWER: +$bordata->{'surname'}, $bordata->{'firstname'} +card number: $bordata->{'cardnumber'} +Phone: $bordata->{'phone'} +$bordata->{'streetaddress'} +$bordata->{'suburb'} +$bordata->{'town'} +$bordata->{'emailaddress'} -C<$items> is a reference-to-list, where each element is a -reference-to-hash describing a borrowed item. C<$items> may be gotten -from C<&GetBorrowerIssues>. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +EOF =cut +=head2 printslip + + &printslip($slip) + +print a slip for the given $borrowernumber and $branchcode + +=cut + +sub printslip ($) { + my ($slip) = @_; + + return unless ( C4::Context->boolean_preference('printcirculationslips') ); + # FIXME - It'd be nifty if this could generate pretty PostScript. -sub remoteprint ($$) { - my ($items, $borrower) = @_; - (return) - unless ( C4::Context->boolean_preference('printcirculationslips') ); my $queue = ''; # FIXME - If 'queue' is undefined or empty, then presumably it should @@ -94,107 +112,13 @@ sub remoteprint ($$) { # print $queue; #open (FILE,">/tmp/$file"); - my $i = 0; - # FIXME - This is HLT-specific. Put this stuff in a customizable - # site-specific file somewhere. - print PRINTER "Horowhenua Library Trust\r\n"; - print PRINTER "Phone: 368-1953\r\n"; - print PRINTER "Fax: 367-9218\r\n"; - print PRINTER "Email: renewals\@library.org.nz\r\n\r\n\r\n"; - print PRINTER "$borrower->{'cardnumber'}\r\n"; - print PRINTER - "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n"; - - # FIXME - Use for ($i = 0; $items->[$i]; $i++) - # Or better yet, foreach $item (@{$items}) - while ( $items->[$i] ) { - - # print $i; - my $itemdata = $items->[$i]; - - # FIXME - This is just begging for a Perl format. - print PRINTER "$i $itemdata->{'title'}\r\n"; - print PRINTER "$itemdata->{'barcode'}"; - print PRINTER " " x 15; - print PRINTER "$itemdata->{'date_due'}\r\n"; - $i++; - } + print PRINTER $slip; print PRINTER "\r\n" x 7 ; close PRINTER; #system("lpr /tmp/$file"); } -sub printreserve { - - # FIXME - make useful - return; - - my ( $branchname, $bordata, $itemdata ) = @_; - my $printer = ''; - (return) unless ( C4::Context->boolean_preference('printreserveslips') ); - if ( $printer eq "" || $printer eq 'nulllp' ) { - open( PRINTER, ">>/tmp/kohares" ) - or die "Could not write to /tmp/kohares"; - } - else { - open( PRINTER, "| lpr -P $printer >/dev/null" ) - or die "Couldn't write to queue:$!\n"; - } - my @da = localtime(); - my $todaysdate = "$da[2]:$da[1] " . C4::Dates->today(); - my $slip = <<"EOF"; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Date: $todaysdate; - -ITEM RESERVED: -$itemdata->{'title'} ($itemdata->{'author'}) -barcode: $itemdata->{'barcode'} - -COLLECT AT: $branchname - -BORROWER: -$bordata->{'surname'}, $bordata->{'firstname'} -card number: $bordata->{'cardnumber'} -Phone: $bordata->{'phone'} -$bordata->{'streetaddress'} -$bordata->{'suburb'} -$bordata->{'town'} -$bordata->{'emailaddress'} - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -EOF - print PRINTER $slip; - close PRINTER; - return $slip; -} - -=head2 printslip - - &printslip($borrowernumber) - -print a slip for the given $borrowernumber - -=cut - -#' -sub printslip ($) { - - #FIXME - make useful - - my $borrowernumber = shift; - my $borrower = GetMemberDetails($borrowernumber); - my $issueslist = GetPendingIssues($borrowernumber); - foreach my $it (@$issueslist){ - $it->{'date_due'}=format_date($it->{'date_due'}); - } - my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist; - remoteprint(\@issues, $borrower ); -} - -END { } # module clean-up code here (global destructor) - 1; __END__ diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 359bbad..d2af1c5 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -121,6 +121,8 @@ BEGIN { &AlterPriority &ToggleLowestPriority + + &ReserveSlip ); @EXPORT_OK = qw( MergeHolds ); } @@ -194,32 +196,31 @@ sub AddReserve { # Send e-mail to librarian if syspref is active if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){ my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber); - my $biblio = GetBiblioData($biblionumber); - my $letter = C4::Letters::getletter( 'reserves', 'HOLDPLACED'); - my $branchcode = $borrower->{branchcode}; - my $branch_details = C4::Branch::GetBranchDetail($branchcode); - my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'); - - my %keys = (%$borrower, %$biblio); - foreach my $key (keys %keys) { - my $replacefield = "<<$key>>"; - $letter->{content} =~ s/$replacefield/$keys{$key}/g; - $letter->{title} =~ s/$replacefield/$keys{$key}/g; + my $branch_details = C4::Branch::GetBranchDetail($borrower->{branchcode}); + if ( my $letter = C4::Letters::GetPreparedLetter ( + module => 'reserves', + letter_code => 'HOLDPLACED', + branchcode => $branch, + tables => { + 'branches' => $branch_details, + 'borrowers' => $borrower, + 'biblio' => $biblionumber, + }, + ) ) { + + my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'); + + C4::Letters::EnqueueLetter( + { letter => $letter, + borrowernumber => $borrowernumber, + message_transport_type => 'email', + from_address => $admin_email_address, + to_address => $admin_email_address, + } + ); } - - C4::Letters::EnqueueLetter( - { letter => $letter, - borrowernumber => $borrowernumber, - message_transport_type => 'email', - from_address => $admin_email_address, - to_address => $admin_email_address, - } - ); - - } - #} ($const eq "o" || $const eq "e") or return; # FIXME: why not have a useful return value? $query = qq/ @@ -1720,21 +1721,21 @@ sub _koha_notify_reserve { my $admin_email_address = $branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'); - my $letter = getletter( 'reserves', $letter_code ); - die "Could not find a letter called '$letter_code' in the 'reserves' module" unless( $letter ); + my $letter = C4::Letters::GetPreparedLetter ( + module => 'reserves', + letter_code => $letter_code, + branchcode => $reserve->{branchcode}, + tables => { + 'branches' => $branch_details, + 'borrowers' => $borrower, + 'biblio' => $biblionumber, + 'reserves' => $reserve, + 'items', $reserve->{'itemnumber'}, + }, + substitute => { today => C4::Dates->new()->output() }, + ) or die "Could not find a letter called '$letter_code' in the 'reserves' module"; - C4::Letters::parseletter( $letter, 'branches', $reserve->{'branchcode'} ); - C4::Letters::parseletter( $letter, 'borrowers', $borrowernumber ); - C4::Letters::parseletter( $letter, 'biblio', $biblionumber ); - C4::Letters::parseletter( $letter, 'reserves', $borrowernumber, $biblionumber ); - if ( $reserve->{'itemnumber'} ) { - C4::Letters::parseletter( $letter, 'items', $reserve->{'itemnumber'} ); - } - my $today = C4::Dates->new()->output(); - $letter->{'title'} =~ s/<>/$today/g; - $letter->{'content'} =~ s/<>/$today/g; - $letter->{'content'} =~ s/<<[a-z0-9_]+\.[a-z0-9]+>>//g; #remove any stragglers if ( $print_mode ) { C4::Letters::EnqueueLetter( { @@ -1908,6 +1909,36 @@ sub MergeHolds { } +=head2 ReserveSlip + + ReserveSlip($branchcode, $borrowernumber, $biblionumber) + + Returns letter hash ( see C4::Letters::GetPreparedLetter ) or undef + +=cut + +sub ReserveSlip { + my ($branch, $borrowernumber, $biblionumber) = @_; + +# return unless ( C4::Context->boolean_preference('printreserveslips') ); + + my $reserve = GetReserveInfo($borrowernumber,$biblionumber ) + or return; + + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => 'RESERVESLIP', + branchcode => $branch, + tables => { + 'reserves' => $reserve, + 'branches' => $reserve->{branchcode}, + 'borrowers' => $reserve, + 'biblio' => $reserve, + 'items' => $reserve, + }, + ); +} + =head1 AUTHOR Koha Development Team diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index c9461f5..60d0e99 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -425,20 +425,24 @@ sub ModSuggestion { if ($suggestion->{STATUS}) { # fetch the entire updated suggestion so that we can populate the letter my $full_suggestion = GetSuggestion($suggestion->{suggestionid}); - my $letter = C4::Letters::getletter('suggestions', $full_suggestion->{STATUS}); - if ($letter) { - C4::Letters::parseletter($letter, 'branches', $full_suggestion->{branchcode}); - C4::Letters::parseletter($letter, 'borrowers', $full_suggestion->{suggestedby}); - C4::Letters::parseletter($letter, 'suggestions', $full_suggestion->{suggestionid}); - C4::Letters::parseletter($letter, 'biblio', $full_suggestion->{biblionumber}); - my $enqueued = C4::Letters::EnqueueLetter({ + if ( my $letter = C4::Letters::GetPreparedLetter ( + module => 'suggestions', + letter_code => $full_suggestion->{STATUS}, + branchcode => $full_suggestion->{branchcode}, + tables => { + 'branches' => $full_suggestion->{branchcode}, + 'borrowers' => $full_suggestion->{suggestedby}, + 'suggestions' => $full_suggestion, + 'biblio' => $full_suggestion->{biblionumber}, + }, + ) ) { + C4::Letters::EnqueueLetter({ letter => $letter, borrowernumber => $full_suggestion->{suggestedby}, suggestionid => $full_suggestion->{suggestionid}, LibraryName => C4::Context->preference("LibraryName"), message_transport_type => 'email', - }); - if (!$enqueued){warn "can't enqueue letter $letter";} + }) or warn "can't enqueue letter $letter"; } } return $status_update_table; diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index d7c64db..ac3c557 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -111,16 +111,11 @@ for my $vendor (@suppliers) { for my $basket ( @{$baskets} ) { my $authorisedby = $basket->{authorisedby}; - my $basketbranch = ''; # set a blank branch to start with - if ( GetMember( borrowernumber => $authorisedby ) ) { - # authorisedby may not be a valid borrowernumber; it's not foreign-key constrained! - $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode}; - } if ($userenv->{'flags'} & 1 || #user is superlibrarian (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and ($viewbaskets eq 'all' || #user is allowed to see all baskets - ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq $basketbranch) || #basket belongs to user's branch + ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq GetMember( borrowernumber => $authorisedby )->{branchcode}) || #basket belongs to user's branch ($basket->{authorisedby} && $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket ) ) diff --git a/circ/circulation.pl b/circ/circulation.pl index e8d22cb..6928966 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -24,7 +24,6 @@ use strict; #use warnings; FIXME - Bug 2505 use CGI; use C4::Output; -use C4::Print; use C4::Auth qw/:DEFAULT get_session/; use C4::Dates qw/format_date/; use C4::Branch; # GetBranches @@ -176,7 +175,7 @@ if ( $barcode eq '' && $query->param('charges') eq 'yes' ) { } if ( $print eq 'yes' && $borrowernumber ne '' ) { - printslip( $borrowernumber ); + PrintIssueSlip($session->param('branch') || $branch, $borrowernumber); $query->param( 'borrowernumber', '' ); $borrowernumber = ''; } diff --git a/circ/hold-transfer-slip.pl b/circ/hold-transfer-slip.pl index f581464..8ae5d2a 100755 --- a/circ/hold-transfer-slip.pl +++ b/circ/hold-transfer-slip.pl @@ -23,10 +23,8 @@ use strict; use C4::Context; use C4::Output; use CGI; -use C4::Auth; +use C4::Auth qw/:DEFAULT get_session/; use C4::Reserves; -use C4::Branch; -use C4::Dates qw/format_date format_date_in_iso/; use vars qw($debug); @@ -35,13 +33,16 @@ BEGIN { } my $input = new CGI; +my $sessionID = $input->cookie("CGISESSID"); +my $session = get_session($sessionID); + my $biblionumber = $input->param('biblionumber'); my $borrowernumber = $input->param('borrowernumber'); my $transfer = $input->param('transfer'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "circ/hold-transfer-slip.tmpl", + template_name => "circ/printslip.tmpl", query => $input, type => "intranet", authnotrequired => 0, @@ -50,14 +51,21 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $reserveinfo = GetReserveInfo($borrowernumber,$biblionumber ); -my $pulldate = C4::Dates->new(); -$reserveinfo->{'pulldate'} = $pulldate->output(); -$reserveinfo->{'branchname'} = GetBranchName($reserveinfo->{'branchcode'}); -$reserveinfo->{'transferrequired'} = $transfer; - -$template->param( reservedata => [ $reserveinfo ] , - ); +my $userenv = C4::Context->userenv; +my ($slip, $is_html); +if ( my $letter = ReserveSlip ($session->param('branch') || $userenv->{branch}, $borrowernumber, $biblionumber) ) { + $slip = $letter->{content}; + $is_html = $letter->{is_html}; +} +else { + $slip = "Reserve not found"; +} +$template->param( + slip => $slip, + plain => !$is_html, + title => "Koha -- Circulation: Transfers", + stylesheet => C4::Context->preference("SlipCSS"), +); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/circ/transfer-slip.pl b/circ/transfer-slip.pl index f054ca4..c8e97a0 100755 --- a/circ/transfer-slip.pl +++ b/circ/transfer-slip.pl @@ -24,11 +24,8 @@ use warnings; use C4::Context; use C4::Output; use CGI; -use C4::Auth; -use C4::Biblio; -use C4::Items; -use C4::Branch; -use C4::Dates qw/format_date format_date_in_iso/; +use C4::Auth qw/:DEFAULT get_session/; +use C4::Circulation; use vars qw($debug); @@ -37,12 +34,15 @@ BEGIN { } my $input = new CGI; +my $sessionID = $input->cookie("CGISESSID"); +my $session = get_session($sessionID); + my $itemnumber = $input->param('transferitem'); my $branchcode = $input->param('branchcode'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "circ/transfer-slip.tmpl", + template_name => "circ/printslip.tmpl", query => $input, type => "intranet", authnotrequired => 0, @@ -51,15 +51,21 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $pulldate = C4::Dates->new(); -my $item = GetItem( $itemnumber ); -my ( undef, $biblio ) = GetBiblio($item->{biblionumber}); +my $userenv = C4::Context->userenv; +my ($slip, $is_html); +if ( my $letter = TransferSlip ($session->param('branch') || $userenv->{branch}, $itemnumber, $branchcode) ) { + $slip = $letter->{content}; + $is_html = $letter->{is_html}; +} +else { + $slip = "Item not found"; +} $template->param( - pulldate => $pulldate->output(), - branchname => GetBranchName($branchcode), - biblio => $biblio, - item => $item, + slip => $slip, + plain => !$is_html, + title => "Koha -- Circulation: Transfers", + stylesheet => C4::Context->preference("SlipCSS"), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/installer/data/mysql/de-DE/mandatory/sample_notices.sql b/installer/data/mysql/de-DE/mandatory/sample_notices.sql index 0d172db..f668d99 100644 --- a/installer/data/mysql/de-DE/mandatory/sample_notices.sql +++ b/installer/data/mysql/de-DE/mandatory/sample_notices.sql @@ -11,7 +11,7 @@ VALUES ('circulation','ODUE','Mahnung','Mahnung','Liebe/r < ('reserves', 'HOLD_PRINT', 'Vormerkbenachrichtigung (Print)', 'Vormerkbenachrichtigung (Print)', '<>\r\n<>\r\n<>\r\n<>\r\n<> <>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<> <>\r\n<>\r\n<>\r\n<> <>\r\n<>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nLiebe(r) <> <>,\r\n\r\nF??r Sie liegt seit dem <> eine Vormerkung zur Abholung bereit:\r\n\r\nTitel: <>\r\nVerfasser: <>\r\nSignatur: <>\r\n'), ('circulation','CHECKIN','R??ckgabequittung (Zusammenfassung)','R??ckgabequittung','Die folgenden Medien wurden zur??ckgegeben:\r\n----\r\n<>\r\n----\r\nVielen Dank.'), ('circulation','CHECKOUT','Ausleihquittung (Zusammenfassung)','Ausleihquittung','Die folgenden Medien wurden entliehen:\r\n----\r\n<>\r\n----\r\nVielen Dank f??r Ihren Besuch in <>.'), -('reserves', 'HOLDPLACED', 'Neue Vormerkung', 'Neue Vormerkung','Folgender Titel wurde vorgemerkt: <> (<<biblionumber>>) durch den Benutzer <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Neue Vormerkung', 'Neue Vormerkung','Folgender Titel wurde vorgemerkt: <<biblio.title>> (<<biblio.biblionumber>>) durch den Benutzer <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Anschaffungsvorschlag wurde angenommen', 'Ihr Anschaffungsvorschlag wurde angenommen','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlagen: <<suggestions.title>> by <<suggestions.author>>.\n\nDie Bibliothek hat diesen Titel heute recherchiert und wird Ihn sobald wie m??glich im Buchhandel bestellen. Sie erhalten Nachricht, sobald die Bestellung abgeschlossen ist und sobald der Titel in der Bibliotek verf??gbar ist.\n\nWenn Sie Fragen haben, richten Sie Ihre Mail bitte an: <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Vorgeschlagenes Medium verf??gbar', 'Das vorgeschlagene Medium ist jetzt verf??gbar','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlagen: <<suggestions.title>> von <<suggestions.author>>.\n\nWir freuen uns Ihnen mitteilen zu k??nnen, dass dieser Titel jetzt im Bestand der Bibliothek verf??gbar ist.\n\nWenn Sie Fragen haben, richten Sie Ihre Mail bitte an: <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Vorgeschlagenes Medium bestellt', 'Das vorgeschlagene Medium wurde im Buchhandel bestellt','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlaten: <<suggestions.title>> von <<suggestions.author>>.\n\nWir freuen uns Ihnen mitteilen zu k??nnen, dass dieser Titel jetzt im Buchhandel bestellt wurde. Nach Eintreffen wird er in unseren Bestand eingearbeitet.\n\nSie erhalten Nachricht, sobald das Medium verf??gbar ist.\n\nBei Nachfragen erreichen Sie uns unter der Emailadresse <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql index 5ca7eaf..f5015bf 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ b/installer/data/mysql/en/mandatory/sample_notices.sql @@ -11,8 +11,98 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <<suggestions.reason>>\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'); +INSERT INTO `letter` (module, code, name, title, content, is_html) +VALUES ('circulation','ISSUESLIP','Issue Slip','Issue Slip', '<h3><<branches.branchname>></h3> +Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> +(<<borrowers.cardnumber>>) <br /> + +<<today>><br /> + +<h4>Checked Out</h4> +<checkedout> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</checkedout> + +<h4>Overdues</h4> +<overdue> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</overdue> + +<hr> + +<h4 style="text-align: center; font-style:italic;">News</h4> +<news> +<div class="newsitem"> +<h5 style="margin-bottom: 1px; margin-top: 1px"><b><<opac_news.title>></b></h5> +<p style="margin-bottom: 1px; margin-top: 1px"><<opac_news.new>></p> +<p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px">Posted on <<opac_news.timestamp>></p> +<hr /> +</div> +</news>', 1), +('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '<h3><<branches.branchname>></h3> +Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> +(<<borrowers.cardnumber>>) <br /> + +<<today>><br /> + +<h4>Checked Out Today</h4> +<checkedout> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</checkedout>', 1), +('circulation','RESERVESLIP','Reserve Slip','Reserve Slip', '<h5>Date: <<today>></h5> + +<h3> Transfer to/Hold in <<branches.branchname>></h3> + +<h3><<borrowers.surname>>, <<borrowers.firstname>></h3> + +<ul> + <li><<borrowers.cardnumber>></li> + <li><<borrowers.phone>></li> + <li> <<borrowers.address>><br /> + <<borrowers.address2>><br /> + <<borrowers.city >> <<borrowers.zipcode>> + </li> + <li><<borrowers.email>></li> +</ul> +<br /> +<h3>ITEM ON HOLD</h3> +<h4><<biblio.title>></h4> +<h5><<biblio.author>></h5> +<ul> + <li><<items.barcode>></li> + <li><<items.itemcallnumber>></li> + <li><<reserves.waitingdate>></li> +</ul> +<p>Notes: +<pre><<reserves.reservenotes>></pre> +</p> +', 1), +('circulation','TRANSFERSLIP','Transfer Slip','Transfer Slip', '<h5>Date: <<today>></h5> + +<h3>Transfer to <<branches.branchname>></h3> + +<h3>ITEM</h3> +<h4><<biblio.title>></h4> +<h5><<biblio.author>></h5> +<ul> + <li><<items.barcode>></li> + <li><<items.itemcallnumber>></li> +</ul>', 1); + diff --git a/installer/data/mysql/es-ES/mandatory/sample_notices.sql b/installer/data/mysql/es-ES/mandatory/sample_notices.sql index 78b80fa..0450bd0 100644 --- a/installer/data/mysql/es-ES/mandatory/sample_notices.sql +++ b/installer/data/mysql/es-ES/mandatory/sample_notices.sql @@ -11,7 +11,7 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql index 9e9f66d..4eb1210 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql @@ -13,7 +13,7 @@ VALUES ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup at <<branches.branchname>>', '<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n\n\nChange Service Requested\n\n\n\n\n\n\n\n<<borrowers.firstname>> <<borrowers.surname>>\n<<borrowers.address>>\n<<borrowers.city>> <<borrowers.zipcode>>\n\n\n\n\n\n\n\n\n\n\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\n\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/it-IT/necessari/notices.sql b/installer/data/mysql/it-IT/necessari/notices.sql index 78b80fa..0450bd0 100644 --- a/installer/data/mysql/it-IT/necessari/notices.sql +++ b/installer/data/mysql/it-IT/necessari/notices.sql @@ -11,7 +11,7 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 14f6122..9dbd032 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1169,10 +1169,12 @@ DROP TABLE IF EXISTS `letter`; CREATE TABLE `letter` ( -- table for all notice templates in Koha `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice `code` varchar(20) NOT NULL default '', -- unique identifier for this notice + `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out `name` varchar(100) NOT NULL default '', -- plain text name for this notice + `is_html` tinyint(1) default 0, `title` varchar(200) NOT NULL default '', -- subject line of the notice `content` text, -- body text for the notice - PRIMARY KEY (`module`,`code`) + PRIMARY KEY (`module`,`code`, `branchcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -2273,12 +2275,13 @@ CREATE TABLE `message_transports` ( `is_digest` tinyint(1) NOT NULL default '0', `letter_module` varchar(20) NOT NULL default '', `letter_code` varchar(20) NOT NULL default '', + `branchcode` varchar(10) NOT NULL default '', PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`), KEY `message_transport_type` (`message_transport_type`), KEY `letter_module` (`letter_module`,`letter_code`), CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`) REFERENCES `letter` (`module`, `code`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`, `branchcode`) REFERENCES `letter` (`module`, `code`, `branchcode`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql index 762da91..f40da36 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql @@ -32,7 +32,7 @@ VALUES ('circulation','ODUE','Purring','Purring p?? dokument','<<borrowers.first ('reserves', 'HOLD_PRINT', 'Hentemelding (p?? papir)', 'Hentemelding', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nDu har et reservert dokument som kan hentes fra <<reserves.waitingdate>>:\r\n\r\nTittel: <<biblio.title>>\r\nForfatter: <<biblio.author>>\r\nEksemplar: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Innlevering','Melding om innlevering','F??lgende dokument har blitt innlevert:\r\n----\r\n<<biblio.title>>\r\n----\r\nVennlig hilsen\r\nBiblioteket'), ('circulation','CHECKOUT','Utl??n','Melding om utl??n','F??lgende dokument har blitt l??nt ut:\r\n----\r\n<<biblio.title>>\r\n----\r\nVennlig hilsen\r\nBiblioteket'), -('reserves', 'HOLDPLACED', 'Melding om reservasjon', 'Melding om reservasjon','F??lgende dokument har blitt reservert : <<title>> (<<biblionumber>>) av <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Melding om reservasjon', 'Melding om reservasjon','F??lgende dokument har blitt reservert : <<biblio.title>> (<<biblio.biblionumber>>) av <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Forslag godtatt', 'Innkj??psforslag godtatt','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foresl??tt at biblioteket kj??per inn <<suggestions.title>> av <<suggestions.author>>.\n\nBiblioteket har vurdert forslaget i dag. Dokumentet vil bli bestilt s?? fort det lar seg gj??re. Du vil f?? en ny melding n??r bestillingen er gjort, og n??r dokumentet ankommer biblioteket.\n\nEr det noe du lurer p??, vennligst kontakt oss p?? <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Foresl??tt dokument tilgjengelig', 'Foresl??tt dokument tilgjengelig','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foresl??tt at biblioteket kj??per inn <<suggestions.title>> av <<suggestions.author>>.\n\nVi har gleden av ?? informere deg om at dokumentet n?? er innlemmet i samlingen.\n\nEr det noe du lurer p??, vennligst kontakt oss p?? <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Innkj??psforslag i bestilling', 'Innkj??psforslag i bestilling','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foresl??tt at biblioteket kj??per inn <<suggestions.title>> av <<suggestions.author>>.\n\nVi har gleden av ?? informere deg om at dokumentet du foreslo n?? er i bestilling.\n\nDu vil f?? en ny melding n??r dokumentet er tilgjengelig.\n\nEr det noe du lurer p??, vennligst kontakt oss p?? <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql index c101b0b..73102af 100644 --- a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql +++ b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql @@ -13,7 +13,7 @@ VALUES ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql index 5ca7eaf..e13782a 100644 --- a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql +++ b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql @@ -11,7 +11,7 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index bda97f5..12ee2b7 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -331,7 +331,10 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('TransferWhenCancelAllWaitingHolds','0','Transfer items when cancelling all waiting holds',NULL,'YesNo'); +>>>>>>> kc/master INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo'); diff --git a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql index 6ab0e18..a908f6c 100644 --- a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql +++ b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql @@ -10,7 +10,7 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD', 'Hold Available for Pickup', 'Hold Available for Pickup at <<branches.branchname>>', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\nLocation: <<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress3>>\r\n<<branches.branchcity>> <<branches.branchzip>>'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl old mode 100755 new mode 100644 index 5b635cc..5b72a91 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4497,7 +4497,6 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n"; SetVersion ($DBversion); } - } $DBversion = "3.05.00.018"; @@ -4775,6 +4774,116 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.07.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE `message_transports` DROP FOREIGN KEY `message_transports_ibfk_3`"); + $dbh->do("ALTER TABLE `letter` DROP PRIMARY KEY"); + $dbh->do("ALTER TABLE `letter` ADD `branchcode` varchar(10) default NULL AFTER `code`"); + $dbh->do("ALTER TABLE `letter` ADD PRIMARY KEY (`module`,`code`, `branchcode`)"); + $dbh->do("ALTER TABLE `message_transports` ADD `branchcode` varchar(10) NOT NULL default ''"); + $dbh->do("ALTER TABLE `message_transports` ADD CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`, `branchcode`) REFERENCES `letter` (`module`, `code`, `branchcode`) ON DELETE CASCADE ON UPDATE CASCADE"); + $dbh->do("ALTER TABLE `letter` ADD `is_html` tinyint(1) default 0 AFTER `name`"); + + $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html) + VALUES ('circulation','ISSUESLIP','Issue Slip','Issue Slip', '<h3><<branches.branchname>></h3> +Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> +(<<borrowers.cardnumber>>) <br /> + +<<today>><br /> + +<h4>Checked Out</h4> +<checkedout> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</checkedout> + +<h4>Overdues</h4> +<overdue> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</overdue> + +<hr> + +<h4 style=\"text-align: center; font-style:italic;\">News</h4> +<news> +<div class=\"newsitem\"> +<h5 style=\"margin-bottom: 1px; margin-top: 1px\"><b><<opac_news.title>></b></h5> +<p style=\"margin-bottom: 1px; margin-top: 1px\"><<opac_news.new>></p> +<p class=\"newsfooter\" style=\"font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px\">Posted on <<opac_news.timestamp>></p> +<hr /> +</div> +</news>', 1)"); + $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html) + VALUES ('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '<h3><<branches.branchname>></h3> +Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> +(<<borrowers.cardnumber>>) <br /> + +<<today>><br /> + +<h4>Checked Out Today</h4> +<checkedout> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</checkedout>', 1)"); + $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html) + VALUES ('circulation','RESERVESLIP','Reserve Slip','Reserve Slip', '<h5>Date: <<today>></h5> + +<h3> Transfer to/Hold in <<branches.branchname>></h3> + +<h3><<borrowers.surname>>, <<borrowers.firstname>></h3> + +<ul> + <li><<borrowers.cardnumber>></li> + <li><<borrowers.phone>></li> + <li> <<borrowers.address>><br /> + <<borrowers.address2>><br /> + <<borrowers.city >> <<borrowers.zipcode>> + </li> + <li><<borrowers.email>></li> +</ul> +<br /> +<h3>ITEM ON HOLD</h3> +<h4><<biblio.title>></h4> +<h5><<biblio.author>></h5> +<ul> + <li><<items.barcode>></li> + <li><<items.itemcallnumber>></li> + <li><<reserves.waitingdate>></li> +</ul> +<p>Notes: +<pre><<reserves.reservenotes>></pre> +</p>', 1)"); + $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html) + VALUES ('circulation','TRANSFERSLIP','Transfer Slip','Transfer Slip', '<h5>Date: <<today>></h5> +<h3>Transfer to <<branches.branchname>></h3> + +<h3>ITEM</h3> +<h4><<biblio.title>></h4> +<h5><<biblio.author>></h5> +<ul> + <li><<items.barcode>></li> + <li><<items.itemcallnumber>></li> +</ul>', 1)"); + + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free')"); + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free')"); + + $dbh->do("UPDATE `letter` SET content = replace(content, '<<title>>', '<<biblio.title>>') WHERE code = 'HOLDPLACED'"); + + print "Upgrade to $DBversion done (Add branchcode and is_html to letter table; Default ISSUESLIP, RESERVESLIP and TRANSFERSLIP letters; Add NoticeCSS and SlipCSS sysprefs)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc index a4acfdf..4e583f1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc @@ -42,8 +42,10 @@ function update_child() { }); // YUI Toolbar Functions + var slip_re = /slip/; function printx_window(print_type) { - window.open("/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]&print=" + print_type, "printwindow"); + var handler = print_type.match(slip_re) ? "printslip" : "moremember"; + window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&print=" + print_type, "printwindow"); return false; } function searchToHold(){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 6b05b2c..b020a92 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -98,6 +98,11 @@ Circulation: yes: "open a print quick slip window" no: "clear the screen" - . + - + - Include the stylesheet at + - pref: NoticeCSS + class: url + - on Notices. (This should be a complete URL, starting with <code>http://</code>) Checkout Policy: - - pref: AllowNotForLoanOverride diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref index df0a434..efa33a8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -83,6 +83,11 @@ Staff Client: Results: "Results page (for future use, Results XSLT not functional at this time)." Both: "Both Results and Details pages (for future use, Results XSLT not functional at this time)." - 'Note: The corresponding XSLT option must be turned on.' + - + - Include the stylesheet at + - pref: SlipCSS + class: url + - on Issue and Reserve Slips. (This should be a complete URL, starting with <code>http://</code>.) Options: - - pref: viewMARC diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt index 1904381..73f9e61 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt @@ -8,11 +8,7 @@ --> </style> [% IF ( stylesheet ) %] - <style type="text/css"> - <!-- - [% stylesheet %] - --> - </style> + <link rel="stylesheet" type="text/css" href="[% stylesheet %]"> [% END %] </head> <body> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt deleted file mode 100644 index 18d45aa..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt +++ /dev/null @@ -1,54 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -<title>Koha -- Circulation: Transfers -[% INCLUDE 'doc-head-close-receipt.inc' %] - - -
    - -[% FOREACH reservedat IN reservedata %] - -
    Date: [% reservedat.pulldate %]
    -

    [% IF ( reservedat.transferrequired ) %]Transfer to [% reservedat.branchname %] [% ELSE %]Hold in [% reservedat.branchname %][% END %]

    - -
    - -

    [% reservedat.surname %], [% reservedat.firstname %]

    - -
      -
    • [% reservedat.cardnumber %]
    • - [% IF ( reservedat.phone ) %] -
    • [% reservedat.phone %]
    • - [% END %] -
    • - [% reservedat.address %]
      - [% IF ( reservedat.address2 ) %][% reservedat.address2 %]
      [% END %] - [% reservedat.city %] [% reservedat.zip %] -
    • - [% IF ( reservedat.email ) %] -
    • [% reservedat.email %]
    • - [% END %] -
    -
    -

    ITEM ON HOLD

    -

    [% reservedat.title |html %]

    -
    [% reservedat.author %]
    -
      - [% IF ( reservedat.barcode ) %]
    • [% reservedat.barcode %]
    • [% END %] - [% IF ( reservedat.itemcallnumber ) %]
    • [% reservedat.itemcallnumber %]
    • [% END %] - [% IF ( reservedat.waitingdate ) %]
    • [% reservedat.waitingdate %]
    • [% END %] -
    - [% IF ( reservedat.reservenotes ) %] -

    Notes: [% reservedat.reservenotes %]

    - [% END %] - - - -[% END %] -
    -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt new file mode 100644 index 0000000..a790069 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt @@ -0,0 +1,28 @@ +[% INCLUDE 'doc-head-open.inc' %] +[% title %] + + + +[% IF stylesheet %] + +[% END %] + + + + +
    + +[% IF plain %] +
    +[% slip %]
    +
    +[% ELSE %] +[% slip %] +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 063236e..eec2384 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -5,14 +5,29 @@ -
    - +[% IF ( no_op_set ) %] +
    + + [% UNLESS independant_branch %] +

    + Select a library : + +

    + [% END %] +

    + + +

    +
    + [% IF ( search ) %]

    You Searched for [% searchfield %]

    [% END %] - [% IF ( letter ) %] + [% IF ( letter && !independant_branch) %] + [% select_for_copy = BLOCK %] + + [% END %] + [% END %] +
    + + - [% FOREACH lette IN letter %] - [% UNLESS ( loop.odd ) %] + + [% FOREACH lette IN letter %] + [% can_edit = lette.branchcode || !independant_branch %] + [% UNLESS ( loop.odd ) %] - [% ELSE %] + [% ELSE %] - [% END %] + [% END %] + + - [% END %] + [% END %] +
    Branch Module Code Name     
    [% lette.branchname || "(All libraries)" %] [% lette.module %] [% lette.code %] [% lette.name %] - Edit + [% IF can_edit %] + Edit + [% END %] + + [% IF !independant_branch || !lette.branchcode %] +
    + + + + + [% IF independant_branch %] + + [% ELSE %] + [% select_for_copy %] + [% END %] + +
    + [% END %]
    - [% IF ( lette.protected ) %] - - - [% ELSE %] - Delete - [% END %] + [% IF !lette.protected && can_edit %] + Delete + [% END %]
    - [% END %] +[% END %] - [% END %] - [% IF ( add_form ) %] +[% IF ( add_form ) %] -
    - + + [% IF ( modify ) %] @@ -182,6 +229,20 @@ $(document).ready(function() {
    [% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]
      + + [% IF independant_branch %] + + [% ELSE %] +
    1. + + +
    2. + [% END %]
    3. @@ -235,6 +296,14 @@ $(document).ready(function() {
    4. + + [% IF is_html %] + + [% ELSE %] + + [% END %] +
    5. +
    6. @@ -252,27 +321,31 @@ $(document).ready(function() {
    +
    +
    - [% END %] +[% END %] - [% IF ( add_validate ) %] +[% IF ( add_validate ) %] Data recorded
    - [% END %] +[% END %] - [% IF ( delete_confirm ) %] +[% IF ( delete_confirm ) %]

    Delete Notice?

    + + @@ -280,6 +353,7 @@ $(document).ready(function() {
    Branch Module Code Name
    [% branchname %] [% module %] [% code %] [% name %]
    + @@ -290,14 +364,14 @@ $(document).ready(function() {
    - [% END %] +[% END %] - [% IF ( delete_confirmed ) %] +[% IF ( delete_confirmed ) %] Data deleted
    - [% END %] +[% END %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt index b71a1ee..5cc3bbf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt @@ -26,7 +26,7 @@ [% END %] [% IF ( CAN_user_tools_edit_notices ) %] -
    Notices
    +
    Notices & Slips
    Define notices (print and email notification messages for overdues, etc.)
    [% END %] diff --git a/members/memberentry.pl b/members/memberentry.pl index 86dd6ed..c474a66 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -347,10 +347,7 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ # if we manage to find a valid email address, send notice if ($emailaddr) { $newdata{emailaddr} = $emailaddr; - my $letter = getletter ('members', "ACCTDETAILS:$newdata{'branchcode'}") ; - # if $branch notice fails, then email a default notice instead. - $letter = getletter ('members', "ACCTDETAILS") if !$letter; - SendAlerts ( 'members' , \%newdata , $letter ) if $letter + SendAlerts ( 'members', \%newdata, "ACCTDETAILS" ); } } diff --git a/members/moremember.pl b/members/moremember.pl index c477100..5a988f9 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -51,7 +51,6 @@ use C4::Reserves; use C4::Branch; # GetBranchName use C4::Overdues qw/CheckBorrowerDebarred/; use C4::Form::MessagingPreferences; -use C4::NewsChannels; #get slip news use List::MoreUtils qw/uniq/; use C4::Members::Attributes qw(GetBorrowerAttributes); @@ -484,13 +483,4 @@ $template->param( activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), ); -#Get the slip news items -my $all_koha_news = &GetNewsToDisplay("slip"); -my $koha_news_count = scalar @$all_koha_news; - -$template->param( - koha_news => $all_koha_news, - koha_news_count => $koha_news_count -); - output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/printslip.pl b/members/printslip.pl new file mode 100755 index 0000000..3a499cd --- /dev/null +++ b/members/printslip.pl @@ -0,0 +1,92 @@ +#!/usr/bin/perl + +# Copyright 2000-2002 Katipo Communications +# Copyright 2010 BibLibre +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +=head1 moremember.pl + + script to do a borrower enquiry/bring up borrower details etc + Displays all the details about a borrower + written 20/12/99 by chris at katipo.co.nz + last modified 21/1/2000 by chris at katipo.co.nz + modified 31/1/2001 by chris at katipo.co.nz + to not allow items on request to be renewed + + needs html removed and to use the C4::Output more, but its tricky + +=cut + +use strict; +#use warnings; FIXME - Bug 2505 +use CGI; +use C4::Context; +use C4::Auth qw/:DEFAULT get_session/; +use C4::Output; +use C4::Members; +use C4::Koha; + +#use Smart::Comments; +#use Data::Dumper; + +use vars qw($debug); + +BEGIN { + $debug = $ENV{DEBUG} || 0; +} + +my $input = new CGI; +my $sessionID = $input->cookie("CGISESSID"); +my $session = get_session($sessionID); + +$debug or $debug = $input->param('debug') || 0; +my $print = $input->param('print'); +my $error = $input->param('error'); + +# circ staff who process checkouts but can't edit +# patrons still need to be able to print receipts +my $flagsrequired = { circulate => "circulate_remaining_permissions" }; + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "circ/printslip.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => $flagsrequired, + debug => 1, + } +); + +my $borrowernumber = $input->param('borrowernumber'); +my $branch=C4::Context->userenv->{'branch'}; +my ($slip, $is_html); +if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) { + $slip = $letter->{content}; + $is_html = $letter->{is_html}; +} + +$template->param( + slip => $slip, + plain => !$is_html, + title => "Print Receipt for $borrowernumber", + stylesheet => C4::Context->preference("SlipCSS"), + error => $error, +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl index 1fa358f..09c4017 100755 --- a/misc/cronjobs/advance_notices.pl +++ b/misc/cronjobs/advance_notices.pl @@ -79,13 +79,10 @@ patrons. It queues them in the message queue, which is processed by the process_message_queue.pl cronjob. See the comments in the script for directions on changing the script. This script has the following parameters : - -c Confirm and remove this help & warning - -m maximum number of days in advance to send advance notices. - -n send No mail. Instead, all mail messages are printed on screen. Usefull for testing purposes. - -v verbose - -i csv list of fields that get substituted into templates in places - of the EEitems.contentEE placeholder. Defaults to - issuedate,title,barcode,author + -c Confirm and remove this help & warning + -m maximum number of days in advance to send advance notices. + -n send No mail. Instead, all mail messages are printed on screen. Usefull for testing purposes. + -v verbose ENDUSAGE # Since advance notice options are not visible in the web-interface @@ -157,8 +154,6 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { } else { my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} ); my $letter_type = 'DUE'; - $letter = C4::Letters::getletter( 'circulation', $letter_type ); - die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter; $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},'0'); my $titles = ""; while ( my $item_info = $sth->fetchrow_hashref()) { @@ -166,13 +161,14 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { $titles .= join("\t", at item_info) . "\n"; } - $letter = parse_letter( { letter => $letter, + $letter = parse_letter( { letter_code => $letter_type, borrowernumber => $upcoming->{'borrowernumber'}, branchcode => $upcoming->{'branchcode'}, biblionumber => $biblio->{'biblionumber'}, itemnumber => $upcoming->{'itemnumber'}, substitute => { 'items.content' => $titles } - } ); + } ) + or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; } } else { $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'}, @@ -189,8 +185,6 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { } else { my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} ); my $letter_type = 'PREDUE'; - $letter = C4::Letters::getletter( 'circulation', $letter_type ); - die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter; $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},$borrower_preferences->{'days_in_advance'}); my $titles = ""; while ( my $item_info = $sth->fetchrow_hashref()) { @@ -198,13 +192,14 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { $titles .= join("\t", at item_info) . "\n"; } - $letter = parse_letter( { letter => $letter, + $letter = parse_letter( { letter_code => $letter_type, borrowernumber => $upcoming->{'borrowernumber'}, branchcode => $upcoming->{'branchcode'}, biblionumber => $biblio->{'biblionumber'}, itemnumber => $upcoming->{'itemnumber'}, substitute => { 'items.content' => $titles } - } ); + } ) + or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; } } @@ -250,8 +245,6 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) { my $letter_type = 'PREDUEDGST'; - my $letter = C4::Letters::getletter( 'circulation', $letter_type ); - die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter; $sth->execute($borrowernumber,$borrower_preferences->{'days_in_advance'}); my $titles = ""; @@ -259,12 +252,13 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) { my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields; $titles .= join("\t", at item_info) . "\n"; } - $letter = parse_letter( { letter => $letter, + my $letter = parse_letter( { letter_code => $letter_type, borrowernumber => $borrowernumber, substitute => { count => $count, 'items.content' => $titles } - } ); + } ) + or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; if ($nomail) { local $, = "\f"; print $letter->{'content'}; @@ -290,20 +284,19 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) { next PATRON unless $borrower_preferences; # how could this happen? my $letter_type = 'DUEDGST'; - my $letter = C4::Letters::getletter( 'circulation', $letter_type ); - die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter; $sth->execute($borrowernumber,'0'); my $titles = ""; while ( my $item_info = $sth->fetchrow_hashref()) { my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields; $titles .= join("\t", at item_info) . "\n"; } - $letter = parse_letter( { letter => $letter, + my $letter = parse_letter( { letter_code => $letter_type, borrowernumber => $borrowernumber, substitute => { count => $count, 'items.content' => $titles } - } ); + } ) + or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; if ($nomail) { local $, = "\f"; @@ -323,40 +316,35 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) { =head2 parse_letter - - =cut sub parse_letter { my $params = shift; - foreach my $required ( qw( letter borrowernumber ) ) { + foreach my $required ( qw( letter_code borrowernumber ) ) { return unless exists $params->{$required}; } - if ( $params->{'substitute'} ) { - while ( my ($key, $replacedby) = each %{$params->{'substitute'}} ) { - my $replacefield = "<<$key>>"; - - $params->{'letter'}->{title} =~ s/$replacefield/$replacedby/g; - $params->{'letter'}->{content} =~ s/$replacefield/$replacedby/g; - } - } - - C4::Letters::parseletter( $params->{'letter'}, 'borrowers', $params->{'borrowernumber'} ); + my %table_params = ( 'borrowers' => $params->{'borrowernumber'} ); - if ( $params->{'branchcode'} ) { - C4::Letters::parseletter( $params->{'letter'}, 'branches', $params->{'branchcode'} ); + if ( my $p = $params->{'branchcode'} ) { + $table_params{'branches'} = $p; } - if ( $params->{'itemnumber'} ) { - C4::Letters::parseletter( $params->{'letter'}, 'issues', $params->{'itemnumber'} ); - C4::Letters::parseletter( $params->{'letter'}, 'items', $params->{'itemnumber'} ); + if ( my $p = $params->{'itemnumber'} ) { + $table_params{'issues'} = $p; + $table_params{'items'} = $p; } - if ( $params->{'biblionumber'} ) { - C4::Letters::parseletter( $params->{'letter'}, 'biblio', $params->{'biblionumber'} ); - C4::Letters::parseletter( $params->{'letter'}, 'biblioitems', $params->{'biblionumber'} ); + if ( my $p = $params->{'biblionumber'} ) { + $table_params{'biblio'} = $p; + $table_params{'biblioitems'} = $p; } - return $params->{'letter'}; + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => $params->{'letter_code'}, + branchcode => $table_params{'branches'}, + substitute => $params->{'substitute'}, + tables => \%table_params, + ); } 1; diff --git a/misc/cronjobs/gather_print_notices.pl b/misc/cronjobs/gather_print_notices.pl index a72d6a6..165b16e 100755 --- a/misc/cronjobs/gather_print_notices.pl +++ b/misc/cronjobs/gather_print_notices.pl @@ -39,11 +39,9 @@ use Getopt::Long; sub usage { print STDERR < \$stylesheet, 'h|help' => \$help, ) || usage( 1 ); @@ -71,16 +68,9 @@ exit unless( @messages ); open OUTPUT, '>', File::Spec->catdir( $output_directory, "holdnotices-" . $today->output( 'iso' ) . ".html" ); my $template = C4::Templates::gettemplate( 'batch/print-notices.tmpl', 'intranet', new CGI ); -my $stylesheet_contents = ''; - -if ($stylesheet) { - open STYLESHEET, '<', $stylesheet; - while ( ) { $stylesheet_contents .= $_ } - close STYLESHEET; -} $template->param( - stylesheet => $stylesheet_contents, + stylesheet => C4::Context->preference("NoticeCSS"), today => $today->output(), messages => \@messages, ); diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 5896abd..d303f4f 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -460,16 +460,6 @@ END_SQL { $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has items triggering level $i."; - my $letter = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"} ); - - unless ($letter) { - $verbose and warn "Message '$overdue_rules->{letter$i}' content not found"; - - # might as well skip while PERIOD, no other borrowers are going to work. - # FIXME : Does this mean a letter must be defined in order to trigger a debar ? - next PERIOD; - } - if ( $overdue_rules->{"debarred$i"} ) { #action taken is debarring @@ -494,11 +484,12 @@ END_SQL my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields; $titles .= join("\t", @item_info) . "\n"; $itemcount++; - push @items, { itemnumber => $item_info->{'itemnumber'}, biblionumber => $item_info->{'biblionumber'} }; + push @items, $item_info; } $sth2->finish; - $letter = parse_letter( - { letter => $letter, + + my $letter = parse_letter( + { letter_code => $overdue_rules->{"letter$i"}, borrowernumber => $borrowernumber, branchcode => $branchcode, items => \@items, @@ -509,6 +500,13 @@ END_SQL } } ); + unless ($letter) { + $verbose and warn "Message '$overdue_rules->{letter$i}' content not found"; + + # might as well skip while PERIOD, no other borrowers are going to work. + # FIXME : Does this mean a letter must be defined in order to trigger a debar ? + next PERIOD; + } if ( $exceededPrintNoticesMaxLines ) { $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items."; @@ -643,54 +641,56 @@ substituted keys and values. =cut -sub parse_letter { # FIXME: this code should probably be moved to C4::Letters:parseletter +sub parse_letter { my $params = shift; - foreach my $required (qw( letter borrowernumber )) { + foreach my $required (qw( letter_code borrowernumber )) { return unless exists $params->{$required}; } - my $todaysdate = C4::Dates->new()->output("syspref"); - $params->{'letter'}->{title} =~ s/<>/$todaysdate/g; - $params->{'letter'}->{content} =~ s/<>/$todaysdate/g; + my $substitute = $params->{'substitute'} || {}; + $substitute->{today} ||= C4::Dates->new()->output("syspref"); - if ( $params->{'substitute'} ) { - while ( my ( $key, $replacedby ) = each %{ $params->{'substitute'} } ) { - my $replacefield = "<<$key>>"; - $params->{'letter'}->{title} =~ s/$replacefield/$replacedby/g; - $params->{'letter'}->{content} =~ s/$replacefield/$replacedby/g; - } + my %tables = ( 'borrowers' => $params->{'borrowernumber'} ); + if ( my $p = $params->{'branchcode'} ) { + $tables{'branches'} = $p; } - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'borrowers', $params->{'borrowernumber'} ); - - if ( $params->{'branchcode'} ) { - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'branches', $params->{'branchcode'} ); + my $currency_format; + if ($params->{'letter'}->{'content'} =~ m/(.*)<\/fine>/o) { # process any fine tags... + $currency_format = $1; + $params->{'letter'}->{'content'} =~ s/.*<\/fine>/<>/o; } - if ( $params->{'items'} ) { + my @item_tables; + if ( my $i = $params->{'items'} ) { my $item_format = ''; - PROCESS_ITEMS: - while (scalar(@{$params->{'items'}}) > 0) { - my $item = shift @{$params->{'items'}}; + foreach my $item (@$i) { my $fine = GetFine($item->{'itemnumber'}, $params->{'borrowernumber'}); if (!$item_format) { $params->{'letter'}->{'content'} =~ m/(.*<\/item>)/; $item_format = $1; } - if ($params->{'letter'}->{'content'} =~ m/(.*)<\/fine>/) { # process any fine tags... - my $formatted_fine = currency_format("$1", "$fine", FMT_SYMBOL); - $params->{'letter'}->{'content'} =~ s/.*<\/fine>/$formatted_fine/; - } - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'biblio', $item->{'biblionumber'} ); - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'biblioitems', $item->{'biblionumber'} ); - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'items', $item->{'itemnumber'} ); - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'issues', $item->{'itemnumber'} ); - $params->{'letter'}->{'content'} =~ s/(.*<\/item>)/$1\n$item_format/ if scalar(@{$params->{'items'}} > 0); + $item->{'fine'} = currency_format($currency_format, "$fine", FMT_SYMBOL) + if $currency_format; + + push @item_tables, { + 'biblio' => $item->{'biblionumber'}, + 'biblioitems' => $item->{'biblionumber'}, + 'items' => $item, + 'issues' => $item->{'itemnumber'}, + }; } } - $params->{'letter'}->{'content'} =~ s/<\/{0,1}?item>//g; # strip all remaining item tags... - return $params->{'letter'}; + + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => $params->{'letter_code'}, + branchcode => $params->{'branchcode'}, + tables => \%tables, + substitute => $substitute, + repeat => { item => \@item_tables }, + ); } =head2 prepare_letter_for_printing diff --git a/t/db_dependent/lib/KohaTest/Letters.pm b/t/db_dependent/lib/KohaTest/Letters.pm index 97d58fb..f2d7b0d 100644 --- a/t/db_dependent/lib/KohaTest/Letters.pm +++ b/t/db_dependent/lib/KohaTest/Letters.pm @@ -12,13 +12,12 @@ sub testing_class { 'C4::Letters' }; sub methods : Test( 1 ) { my $self = shift; - my @methods = qw( getletter - addalert + my @methods = qw( addalert delalert getalert findrelatedto SendAlerts - parseletter + GetPreparedLetter ); can_ok( $self->testing_class, @methods ); diff --git a/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm b/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm index 76b6ab4..53e5439 100644 --- a/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm +++ b/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm @@ -10,7 +10,7 @@ use Test::More; sub GetLetter : Test( 6 ) { my $self = shift; - my $letter = getletter( 'circulation', 'ODUE' ); + my $letter = getletter( 'circulation', 'ODUE', '' ); isa_ok( $letter, 'HASH' ) or diag( Data::Dumper->Dump( [ $letter ], [ 'letter' ] ) ); @@ -21,7 +21,6 @@ sub GetLetter : Test( 6 ) { ok( exists $letter->{'name'}, 'name' ); ok( exists $letter->{'title'}, 'title' ); - } 1; diff --git a/t/db_dependent/lib/KohaTest/Members.pm b/t/db_dependent/lib/KohaTest/Members.pm index 5646be1..dfde7da 100644 --- a/t/db_dependent/lib/KohaTest/Members.pm +++ b/t/db_dependent/lib/KohaTest/Members.pm @@ -52,6 +52,7 @@ sub methods : Test( 1 ) { GetBorrowersWhoHaveNeverBorrowed GetBorrowersWithIssuesHistoryOlderThan GetBorrowersNamesAndLatestIssue + IssueSlip ); can_ok( $self->testing_class, @methods ); diff --git a/t/db_dependent/lib/KohaTest/Print.pm b/t/db_dependent/lib/KohaTest/Print.pm index 02fd5fb..d35ab34 100644 --- a/t/db_dependent/lib/KohaTest/Print.pm +++ b/t/db_dependent/lib/KohaTest/Print.pm @@ -12,10 +12,7 @@ sub testing_class { 'C4::Print' }; sub methods : Test( 1 ) { my $self = shift; - my @methods = qw( remoteprint - printreserve - printslip - ); + my @methods = qw( printslip ); can_ok( $self->testing_class, @methods ); } diff --git a/t/db_dependent/lib/KohaTest/Reserves.pm b/t/db_dependent/lib/KohaTest/Reserves.pm index 8b05dd0..6416ac3 100644 --- a/t/db_dependent/lib/KohaTest/Reserves.pm +++ b/t/db_dependent/lib/KohaTest/Reserves.pm @@ -33,6 +33,7 @@ sub methods : Test( 1 ) { GetReserveInfo _FixPriority _Findgroupreserve + ReserveSlip ); can_ok( $self->testing_class, @methods ); diff --git a/tools/letter.pl b/tools/letter.pl index 04cd7d2..ae47810 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -46,14 +46,35 @@ use CGI; use C4::Auth; use C4::Context; use C4::Output; +use C4::Branch; # GetBranches +use C4::Members::Attributes; -# letter_exists($module, $code) -# - return true if a letter with the given $module and $code exists +# _letter_from_where($branchcode,$module, $code) +# - return FROM WHERE clause and bind args for a letter +sub _letter_from_where { + my ($branchcode, $module, $code) = @_; + my $sql = q{FROM letter WHERE branchcode = ? AND module = ? AND code = ?}; + my @args = ($branchcode || '', $module, $code); +# Mysql is retarded. cause branchcode is part of the primary key it cannot be null. How does that +# work with foreign key constraint I wonder... + +# if ($branchcode) { +# $sql .= " AND branchcode = ?"; +# push @args, $branchcode; +# } else { +# $sql .= " AND branchcode IS NULL"; +# } + + return ($sql, \@args); +} + +# letter_exists($branchcode,$module, $code) +# - return true if a letter with the given $branchcode, $module and $code exists sub letter_exists { - my ($module, $code) = @_; + my ($sql, $args) = _letter_from_where(@_); my $dbh = C4::Context->dbh; - my $letters = $dbh->selectall_arrayref(q{SELECT name FROM letter WHERE module = ? AND code = ?}, undef, $module, $code); - return @{$letters}; + my $letter = $dbh->selectrow_hashref("SELECT * $sql", undef, @$args); + return $letter; } # $protected_letters = protected_letters() @@ -67,16 +88,14 @@ sub protected_letters { my $input = new CGI; my $searchfield = $input->param('searchfield'); my $script_name = '/cgi-bin/koha/tools/letter.pl'; +my $branchcode = $input->param('branchcode'); my $code = $input->param('code'); my $module = $input->param('module'); my $content = $input->param('content'); -my $op = $input->param('op'); +my $op = $input->param('op') || ''; my $dbh = C4::Context->dbh; -if (!defined $module ) { - $module = q{}; -} -my ( $template, $borrowernumber, $cookie ) = get_template_and_user( +my ( $template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user( { template_name => 'tools/letter.tmpl', query => $input, @@ -87,32 +106,39 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); -if (!defined $op) { - $op = q{}; # silence errors from eq -} +my $my_branch = C4::Context->preference("IndependantBranches") && !$staffflags->{'superlibrarian'} + ? C4::Context->userenv()->{'branch'} + : undef; # we show only the TMPL_VAR names $op $template->param( + independant_branch => $my_branch, script_name => $script_name, + searchfield => $searchfield, action => $script_name ); +if ($op eq 'copy') { + add_copy(); + $op = 'add_form'; +} + if ($op eq 'add_form') { - add_form($module, $code); + add_form($branchcode, $module, $code); } elsif ( $op eq 'add_validate' ) { add_validate(); $op = q{}; # next operation is to return to default screen } elsif ( $op eq 'delete_confirm' ) { - delete_confirm($module, $code); + delete_confirm($branchcode, $module, $code); } elsif ( $op eq 'delete_confirmed' ) { - delete_confirmed($module, $code); + delete_confirmed($branchcode, $module, $code); $op = q{}; # next operation is to return to default screen } else { - default_display($searchfield); + default_display($branchcode,$searchfield); } # Do this last as delete_confirmed resets @@ -125,23 +151,21 @@ if ($op) { output_html_with_http_headers $input, $cookie, $template->output; sub add_form { - my ($module, $code ) = @_; + my ($branchcode,$module, $code ) = @_; my $letter; # if code has been passed we can identify letter and its an update action if ($code) { - $letter = $dbh->selectrow_hashref(q{SELECT module, code, name, title, content FROM letter WHERE module=? AND code=?}, - undef, $module, $code); + $letter = letter_exists($branchcode,$module, $code); + } + if ($letter) { $template->param( modify => 1 ); $template->param( code => $letter->{code} ); } else { # initialize the new fields $letter = { - module => $module, - code => q{}, - name => q{}, - title => q{}, - content => q{}, + branchcode => $branchcode, + module => $module, }; $template->param( adding => 1 ); } @@ -173,14 +197,20 @@ sub add_form { {value => q{}, text => '---ITEMS---' }, {value => 'items.content', text => 'items.content'}, add_fields('issues','borrowers'); + if ($module eq 'circulation') { + push @{$field_selection}, add_fields('opac_news'); + } } $template->param( - name => $letter->{name}, - title => $letter->{title}, - content => $letter->{content}, - module => $module, - $module => 1, + branchcode => $letter->{branchcode}, + name => $letter->{name}, + is_html => $letter->{is_html}, + title => $letter->{title}, + content => $letter->{content}, + module => $module, + $module => 1, + branchloop => _branchloop($branchcode), SQLfieldname => $field_selection, ); return; @@ -188,37 +218,56 @@ sub add_form { sub add_validate { my $dbh = C4::Context->dbh; - my $module = $input->param('module'); - my $oldmodule = $input->param('oldmodule'); - my $code = $input->param('code'); - my $name = $input->param('name'); - my $title = $input->param('title'); - my $content = $input->param('content'); - if (letter_exists($oldmodule, $code)) { + my $oldbranchcode = $input->param('oldbranchcode'); + my $branchcode = $input->param('branchcode') || ''; + my $module = $input->param('module'); + my $oldmodule = $input->param('oldmodule'); + my $code = $input->param('code'); + my $name = $input->param('name'); + my $is_html = $input->param('is_html'); + my $title = $input->param('title'); + my $content = $input->param('content'); + if (letter_exists($oldbranchcode,$oldmodule, $code)) { $dbh->do( - q{UPDATE letter SET module = ?, code = ?, name = ?, title = ?, content = ? WHERE module = ? AND code = ?}, + q{UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ? WHERE branchcode = ? AND module = ? AND code = ?}, undef, - $module, $code, $name, $title, $content, - $oldmodule, $code + $branchcode, $module, $name, $is_html || 0, $title, $content, + $oldbranchcode, $oldmodule, $code ); } else { $dbh->do( - q{INSERT INTO letter (module,code,name,title,content) VALUES (?,?,?,?,?)}, + q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content) VALUES (?,?,?,?,?,?,?)}, undef, - $module, $code, $name, $title, $content + $branchcode, $module, $code, $name, $is_html || 0, $title, $content ); } # set up default display - default_display(); - return; + default_display($branchcode); +} + +sub add_copy { + my $dbh = C4::Context->dbh; + my $oldbranchcode = $input->param('oldbranchcode'); + my $branchcode = $input->param('branchcode'); + my $module = $input->param('module'); + my $code = $input->param('code'); + + return if letter_exists($branchcode,$module, $code); + + my $old_letter = letter_exists($oldbranchcode,$module, $code); + + $dbh->do( + q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content) VALUES (?,?,?,?,?,?,?)}, + undef, + $branchcode, $module, $code, $old_letter->{name}, $old_letter->{is_html}, $old_letter->{title}, $old_letter->{content} + ); } sub delete_confirm { - my ($module, $code) = @_; + my ($branchcode, $module, $code) = @_; my $dbh = C4::Context->dbh; - my $letter = $dbh->selectrow_hashref(q|SELECT name FROM letter WHERE module = ? AND code = ?|, - { Slice => {} }, - $module, $code); + my $letter = letter_exists($branchcode, $module, $code); + $template->param( branchcode => $branchcode, branchname => GetBranchName($branchcode) ); $template->param( code => $code ); $template->param( module => $module); $template->param( name => $letter->{name}); @@ -226,40 +275,53 @@ sub delete_confirm { } sub delete_confirmed { - my ($module, $code) = @_; + my ($branchcode, $module, $code) = @_; + my ($sql, $args) = _letter_from_where($branchcode, $module, $code); my $dbh = C4::Context->dbh; - $dbh->do('DELETE FROM letter WHERE module=? AND code=?',{},$module,$code); + $dbh->do("DELETE $sql", undef, @$args); # setup default display for screen - default_display(); + default_display($branchcode); return; } sub retrieve_letters { - my $searchstring = shift; + my ($branchcode, $searchstring) = @_; + + $branchcode = $my_branch if $branchcode && $my_branch; + my $dbh = C4::Context->dbh; - if ($searchstring) { - if ($searchstring=~m/(\S+)/) { - $searchstring = $1 . q{%}; - return $dbh->selectall_arrayref('SELECT module, code, name FROM letter WHERE code LIKE ? ORDER BY module, code', - { Slice => {} }, $searchstring); - } + my ($sql, @where, @args); + $sql = "SELECT branchcode, module, code, name, branchname + FROM letter + LEFT OUTER JOIN branches USING (branchcode)"; + if ($searchstring && $searchstring=~m/(\S+)/) { + $searchstring = $1 . q{%}; + push @where, 'code LIKE ?'; + push @args, $searchstring; } - else { - return $dbh->selectall_arrayref('SELECT module, code, name FROM letter ORDER BY module, code', { Slice => {} }); + elsif ($branchcode) { + push @where, 'branchcode = ?'; + push @args, $branchcode || ''; } - return; + elsif ($my_branch) { + push @where, "(branchcode = ? OR branchcode = '')"; + push @args, $my_branch; + } + + $sql .= " WHERE ".join(" AND ", @where) if @where; + $sql .= " ORDER BY module, code, branchcode"; +# use Data::Dumper; die Dumper($sql, \@args); + return $dbh->selectall_arrayref($sql, { Slice => {} }, @args); } sub default_display { - my $searchfield = shift; - my $results; + my ($branchcode, $searchfield) = @_; + if ( $searchfield ) { $template->param( search => 1 ); - $template->param( searchfield => $searchfield ); - $results = retrieve_letters($searchfield); - } else { - $results = retrieve_letters(); } + my $results = retrieve_letters($branchcode,$searchfield); + my $loop_data = []; my $protected_letters = protected_letters(); foreach my $row (@{$results}) { @@ -267,8 +329,27 @@ sub default_display { push @{$loop_data}, $row; } - $template->param( letter => $loop_data ); - return; + + $template->param( + letter => $loop_data, + branchloop => _branchloop($branchcode), + ); +} + +sub _branchloop { + my ($branchcode) = @_; + + my $branches = GetBranches(); + my @branchloop; + for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { + push @branchloop, { + value => $thisbranch, + selected => $branchcode && $thisbranch eq $branchcode, + branchname => $branches->{$thisbranch}->{'branchname'}, + }; + } + + return \@branchloop; } sub add_fields { @@ -307,6 +388,7 @@ sub get_columns_for { text => $tlabel, }; } + my $sql = "SHOW COLUMNS FROM $table";# TODO not db agnostic my $table_prefix = $table . q|.|; my $rows = C4::Context->dbh->selectall_arrayref($sql, { Slice => {} }); @@ -317,5 +399,15 @@ sub get_columns_for { text => $table_prefix . $row->{Field}, } } + if ($table eq 'borrowers') { + if ( my $attributes = C4::Members::Attributes::GetAttributes() ) { + foreach (@$attributes) { + push @fields, { + value => "borrower-attribute:$_", + text => "attribute:$_", + } + } + } + } return @fields; } -- 1.6.5 From srdjan at catalyst.net.nz Fri Mar 9 01:42:23 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Fri, 9 Mar 2012 13:42:23 +1300 Subject: [Koha-patches] [PATCH] Bug 7477: Followup: Fix perlcritic issues In-Reply-To: References: Message-ID: <1331253743-32398-1-git-send-email-srdjan@catalyst.net.nz> From: Jonathan Druart Signed-off-by: Srdjan Jankovic --- C4/Calendar.pm | 51 ++++++++++----------------------------------------- 1 files changed, 10 insertions(+), 41 deletions(-) diff --git a/C4/Calendar.pm b/C4/Calendar.pm index 8ad363f..a9d39dc 100644 --- a/C4/Calendar.pm +++ b/C4/Calendar.pm @@ -582,37 +582,6 @@ sub copy_to_branch { return 1; } -=head2 daysBetween - - my $daysBetween = $calendar->daysBetween($startdate, $enddate) - -C<$startdate> and C<$enddate> are C4::Dates objects that define the interval. - -Returns the number of non-holiday days in the interval. -useDaysMode syspref has no effect here. -=cut - -sub daysBetween ($$$) { - my $self = shift or return undef; - my $startdate = shift or return undef; - my $enddate = shift or return undef; - my ($yearFrom,$monthFrom,$dayFrom) = split("-",$startdate->output('iso')); - my ($yearTo, $monthTo, $dayTo ) = split("-", $enddate->output('iso')); - if (Date_to_Days($yearFrom,$monthFrom,$dayFrom) > Date_to_Days($yearTo,$monthTo,$dayTo)) { - return 0; - # we don't go backwards ( FIXME - handle this error better ) - } - my $count = 0; - while (1) { - ($yearFrom != $yearTo or $monthFrom != $monthTo or $dayFrom != $dayTo) or last; # if they all match, it's the last day - unless ($self->isHoliday($dayFrom, $monthFrom, $yearFrom)) { - $count++; - } - ($yearFrom, $monthFrom, $dayFrom) = &Date::Calc::Add_Delta_Days($yearFrom, $monthFrom, $dayFrom, 1); - } - return($count); -} - =head2 addDate my ($day, $month, $year) = $calendar->addDate($date, $offset) @@ -660,16 +629,16 @@ Returns the number of non-holiday days in the interval. useDaysMode syspref has no effect here. =cut -sub daysBetween ($$$) { - my $self = shift or return undef; - my $startdate = shift or return undef; - my $enddate = shift or return undef; - my ($yearFrom,$monthFrom,$dayFrom) = split("-",$startdate->output('iso')); - my ($yearTo, $monthTo, $dayTo ) = split("-", $enddate->output('iso')); - if (Date_to_Days($yearFrom,$monthFrom,$dayFrom) > Date_to_Days($yearTo,$monthTo,$dayTo)) { - return 0; - # we don't go backwards ( FIXME - handle this error better ) - } +sub daysBetween { + my $self = shift or return; + my $startdate = shift or return; + my $enddate = shift or return; + my ($yearFrom,$monthFrom,$dayFrom) = split("-",$startdate->output('iso')); + my ($yearTo, $monthTo, $dayTo ) = split("-", $enddate->output('iso')); + if (Date_to_Days($yearFrom,$monthFrom,$dayFrom) > Date_to_Days($yearTo,$monthTo,$dayTo)) { + return 0; + # we don't go backwards ( FIXME - handle this error better ) + } my $count = 0; while (1) { ($yearFrom != $yearTo or $monthFrom != $monthTo or $dayFrom != $dayTo) or last; # if they all match, it's the last day -- 1.6.5 From srdjan at catalyst.net.nz Fri Mar 9 02:27:15 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Fri, 09 Mar 2012 11:27:15 +1000 Subject: [Koha-patches] [PATCH] bug_7264: Branch popup on OPAC detail Message-ID: <4F595C73.2050700@catalyst.net.nz> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-bug_7264-Branch-popup-on-OPAC-detail.patch Type: text/x-patch Size: 16234 bytes Desc: not available URL: From srdjan at catalyst.net.nz Mon Mar 12 01:05:14 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Mon, 12 Mar 2012 13:05:14 +1300 Subject: [Koha-patches] [PATCH] bug_7001: protected are only all libraries letters In-Reply-To: References: Message-ID: <1331510714-27343-1-git-send-email-srdjan@catalyst.net.nz> --- C4/Letters.pm | 3 +-- tools/letter.pl | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index ce21a5d..af1ce82 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -255,7 +255,6 @@ sub findrelatedto ($$) { sub SendAlerts { my ( $type, $externalid, $letter_code ) = @_; my $dbh = C4::Context->dbh; - my $strsth; if ( $type eq 'issue' ) { # prepare the letter... @@ -306,7 +305,7 @@ sub SendAlerts { # prepare the letter... # search the biblionumber - $strsth = $type eq 'claimacquisition' + my $strsth = $type eq 'claimacquisition' ? qq{ SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*,aqbooksellers.* FROM aqorders diff --git a/tools/letter.pl b/tools/letter.pl index ae47810..eb9d6a6 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -325,7 +325,7 @@ sub default_display { my $loop_data = []; my $protected_letters = protected_letters(); foreach my $row (@{$results}) { - $row->{protected} = $protected_letters->{ $row->{code}}; + $row->{protected} = !$row->{branchcode} && $protected_letters->{ $row->{code} }; push @{$loop_data}, $row; } -- 1.6.5 From srdjan at catalyst.net.nz Mon Mar 12 03:33:37 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Mon, 12 Mar 2012 15:33:37 +1300 Subject: [Koha-patches] [PATCH] bug7398: OPACShowHoldsCount syspref In-Reply-To: References: Message-ID: <1331519617-25980-1-git-send-email-srdjan@catalyst.net.nz> Show holds count on OPAC detail if OPACShowHoldsCount is yes --- installer/data/mysql/sysprefs.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/opac.pref | 6 ++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 9 +++++++++ opac/opac-detail.pl | 10 ++++++++++ 5 files changed, 34 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d16ff81..21f6de4 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -347,4 +347,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('LinkerKeepStale',0,'If ON the authority linker will keep existing authority links for headings where it is unable to find a match.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogModuleRelink',0,'If OFF the linker will never replace the authids that are set in the cataloging module.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelay', '0', '', 'Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay', 'YesNo'); -INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free') +INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACShowHoldsCount',0,'Show the total number of holds in the OPAC details',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index b844560..38d19e1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4892,6 +4892,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.07.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACShowHoldsCount',0,'Show the total number of holds in the OPAC details',NULL,'YesNo')"); + print "Upgrade to $DBversion done (Added system preference OPACShowHoldsCount)\n"; + 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 1acc414..339107e 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 @@ -343,6 +343,12 @@ OPAC: 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: OPACShowHoldsCount + choices: + yes: Show + no: "Don't show" + - the total number of holds on the details page + - - pref: OpacRenewalAllowed choices: yes: Allow diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 7af60a0..40c5389 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -589,6 +589,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () { Status [% IF ( itemdata_itemnotes ) %]Notes[% END %] Date Due + [% IF holds_count.defined %] + Holds + [% END %] [% FOREACH ITEM_RESULT IN ITEM_RESULTS %] [% IF ( item_level_itypes ) %][% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %][% ITEM_RESULT.description %][% END %][% END %] [% ITEM_RESULT.description %][% END %] @@ -601,10 +604,16 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] [% ITEM_RESULT.datedue %] + [% IF holds_count.defined %] + [% ITEM_RESULT.holds_count %] + [% END %] [% END %] [% END %] + [% IF holds_count.defined %] +
    Holds: [% holds_count %]
    + [% END %] [% ELSE %] [% IF ( ALTERNATEHOLDINGS ) %] [% FOREACH ALTERNATEHOLDING IN ALTERNATEHOLDINGS %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 27684d4..b07c240 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -479,10 +479,20 @@ if ($dat->{'count'} >= 50 && !$viewallitems) { my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) ); +my %item_reserves; +if ( C4::Context->preference("OPACShowHoldsCount") ) { + my ($reserve_count,$reserves) = GetReservesFromBiblionumber($biblionumber); + $template->param( holds_count => $reserve_count ); + foreach (@$reserves) { + $item_reserves{ $_->{itemnumber} }++ if $_->{itemnumber}; + } +} + my $norequests = 1; my $branches = GetBranches(); my %itemfields; for my $itm (@items) { + $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} }; $norequests = 0 if ( (not $itm->{'wthdrawn'} ) && (not $itm->{'itemlost'} ) -- 1.6.5 From oleonard at myacpl.org Mon Mar 12 13:53:26 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Mon, 12 Mar 2012 08:53:26 -0400 Subject: [Koha-patches] [PATCH] Bug 5596 [REVISED] add author to holds to pull report Message-ID: <1331556806-2826-1-git-send-email-oleonard@myacpl.org> Adding output of author and, for good measure, subtitle. --- circ/pendingreserves.pl | 6 ++++++ .../prog/en/modules/circ/pendingreserves.tt | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index 52a0450..d44a96a 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -29,6 +29,7 @@ use C4::Context; use C4::Output; use CGI; use C4::Auth; +use C4::Biblio; use C4::Dates qw/format_date format_date_in_iso/; use C4::Debug; use Date::Calc qw/Today Add_Delta_YMD/; @@ -158,6 +159,10 @@ if ( $run_report ) { $sth->execute(@query_params); while ( my $data = $sth->fetchrow_hashref ) { + my $record = GetMarcBiblio($data->{biblionumber}); + if ($record){ + $data->{subtitle} = GetRecordValue('subtitle',$record,'')->[0]->{subfield}; + } push( @reservedata, { @@ -165,6 +170,7 @@ if ( $run_report ) { priority => $data->{priority}, name => $data->{l_patron}, title => $data->{title}, + subtitle => $data->{subtitle}, author => $data->{author}, borrowernumber => $data->{borrowernumber}, itemnum => $data->{itemnumber}, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt index c11bdd7..9b72691 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -91,8 +91,8 @@ $(document).ready(function() {

    [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %] - [% reserveloo.title |html %] [% reserveloo.subtitle %] - + [% reserveloo.title |html %] [% IF ( reserveloo.subtitle ) %][% reserveloo.subtitle %][% END %] + [% IF ( reserveloo.author ) %]

    by [% reserveloo.author %]

    [% ELSE %][% END %]

    [% ELSE %] -- 1.7.3 From srdjan at catalyst.net.nz Tue Mar 13 04:53:12 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Tue, 13 Mar 2012 16:53:12 +1300 Subject: [Koha-patches] [PATCH] bug_7613: OCLC Connexion gateway In-Reply-To: References: Message-ID: <1331610792-23773-1-git-send-email-srdjan@catalyst.net.nz> svc/import_bib: * takes custom POST request with parameters and MARC XML * pushes MARC XML to an impoort bach queue of type 'webservice' * returns status and imported record XML * is a drop-in replacement for svc/new_bib misc/cronjobs/import_webservice_batch.pl: * a cron job for processing impoort bach queues of type 'webservice' * batches can also be processed through the UI misc/bin/connexion_import_daemon.pl: * a daemon that listens for OCLC Connexion requests * takes request with MARC XML * takes import batch params from a config file and forwards the lot to svc/import_bib * returns status Added new import batch type of 'webservice' Changed interface to AddImportBatch() - now it takes a hashref --- C4/Breeding.pm | 8 +- C4/ImportBatch.pm | 116 ++++++++- C4/Matcher.pm | 16 ++ installer/data/mysql/kohastructure.sql | 2 +- installer/data/mysql/updatedatabase.pl | 7 + misc/bin/connexion_import_daemon.pl | 263 ++++++++++++++++++++ misc/cronjobs/import_webservice_batch.pl | 57 +++++ svc/import_bib | 120 +++++++++ t/db_dependent/lib/KohaTest/ImportBatch.pm | 6 +- .../lib/KohaTest/ImportBatch/AddImportBatch.pm | 31 --- .../lib/KohaTest/ImportBatch/GetImportBatch.pm | 8 +- 11 files changed, 570 insertions(+), 64 deletions(-) create mode 100755 misc/bin/connexion_import_daemon.pl create mode 100755 misc/cronjobs/import_webservice_batch.pl create mode 100755 svc/import_bib delete mode 100644 t/db_dependent/lib/KohaTest/ImportBatch/AddImportBatch.pm diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 9003f9a..c588c64 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -76,13 +76,7 @@ sub ImportBreeding { my $dbh = C4::Context->dbh; - my $batch_id = 0; - if ($batch_type eq 'z3950') { - $batch_id = GetZ3950BatchId($filename); - } else { - # create a new one - $batch_id = AddImportBatch('create_new', 'staging', 'batch', $filename, ''); - } + my $batch_id = GetZ3950BatchId($filename); my $searchisbn = $dbh->prepare("select biblioitemnumber from biblioitems where isbn=?"); my $searchissn = $dbh->prepare("select biblioitemnumber from biblioitems where issn=?"); # FIXME -- not sure that this kind of checking is actually needed diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 63cc60b..2568422 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -35,10 +35,13 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw( GetZ3950BatchId + GetWebserviceBatchId GetImportRecordMarc + GetImportRecordMarcXML AddImportBatch GetImportBatch AddBiblioToBatch + AddItemsToImportBiblio ModBiblioInBatch BatchStageMarcRecords @@ -48,6 +51,7 @@ BEGIN { CleanBatch GetAllImportBatches + GetStagedWebserviceBatches GetImportBatchRangeDesc GetNumberOfNonZ3950ImportBatches GetImportBibliosRange @@ -105,12 +109,51 @@ sub GetZ3950BatchId { if (defined $rowref) { return $rowref->[0]; } else { - my $batch_id = AddImportBatch('create_new', 'staged', 'z3950', $z3950server, ''); + my $batch_id = AddImportBatch( { + overlay_action => 'create_new', + import_status => 'staged', + batch_type => 'z3950', + file_name => $z3950server, + } ); return $batch_id; } } +=head2 GetWebserviceBatchId + + my $batchid = GetWebserviceBatchId(); + +Retrieves the ID of the import batch for webservice. +If necessary, creates the import batch. + +=cut + +my $WEBSERVICE_BASE_QRY = <dbh; + my $sql = $WEBSERVICE_BASE_QRY; + my @args; + foreach my $field (qw(matcher_id overlay_action nomatch_action item_action)) { + if (my $val = $params->{$field}) { + $sql .= " AND $field = ?"; + push @args, $val; + } + } + my $id = $dbh->selectrow_array($sql, undef, @args); + return $id if $id; + + $params->{batch_type} = 'webservice'; + $params->{import_status} = 'staged'; + return AddImportBatch($params); +} + =head2 GetImportRecordMarc my ($marcblob, $encoding) = GetImportRecordMarc($import_record_id); @@ -129,26 +172,48 @@ sub GetImportRecordMarc { } -=head2 AddImportBatch +=head2 GetImportRecordMarcXML - my $batch_id = AddImportBatch($overlay_action, $import_status, $type, - $file_name, $comments); + my $marcxml = GetImportRecordMarcXML($import_record_id); =cut -sub AddImportBatch { - my ($overlay_action, $import_status, $type, $file_name, $comments) = @_; +sub GetImportRecordMarcXML { + my ($import_record_id) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("INSERT INTO import_batches (overlay_action, import_status, batch_type, - file_name, comments) - VALUES (?, ?, ?, ?, ?)"); - $sth->execute($overlay_action, $import_status, $type, $file_name, $comments); - my $batch_id = $dbh->{'mysql_insertid'}; + my $sth = $dbh->prepare("SELECT marcxml FROM import_records WHERE import_record_id = ?"); + $sth->execute($import_record_id); + my ($marcxml) = $sth->fetchrow(); $sth->finish(); + return $marcxml; + +} + +=head2 AddImportBatch - return $batch_id; + my $batch_id = AddImportBatch($params_hash); + +=cut +sub AddImportBatch { + my ($params) = @_; + + my (@fields, @vals); + foreach (qw( matcher_id template_id branchcode + overlay_action nomatch_action item_action + import_status batch_type file_name comments )) { + if (exists $params->{$_}) { + push @fields, $_; + push @vals, $params->{$_}; + } + } + my $dbh = C4::Context->dbh; + $dbh->do("INSERT INTO import_batches (".join( ',', @fields).") + VALUES (".join( ',', map '?', @fields).")", + undef, + @vals); + return $dbh->{'mysql_insertid'}; } =head2 GetImportBatch @@ -237,7 +302,13 @@ sub BatchStageMarcRecords { $progress_interval = 0 unless 'CODE' eq ref $progress_callback; } - my $batch_id = AddImportBatch('create_new', 'staging', 'batch', $file_name, $comments); + my $batch_id = AddImportBatch( { + overlay_action => 'create_new', + import_status => 'staging', + batch_type => 'batch', + file_name => $file_name, + comments => $comments, + } ); if ($parse_items) { SetImportBatchItemAction($batch_id, 'always_add'); } else { @@ -700,6 +771,25 @@ sub GetAllImportBatches { return $results; } +=head2 GetStagedWebserviceBatches + + my $batch_ids = GetStagedWebserviceBatches(); + +Returns a references to an array of batch id's +of batch_type 'webservice' that are not imported + +=cut + +my $PENDING_WEBSERVICE_BATCHES_QRY = <dbh; + return $dbh->selectcol_arrayref($PENDING_WEBSERVICE_BATCHES_QRY); +} + =head2 GetImportBatchRangeDesc my $results = GetImportBatchRangeDesc($offset, $results_per_group); diff --git a/C4/Matcher.pm b/C4/Matcher.pm index 9d1df67..1721a9a 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -95,6 +95,22 @@ sub GetMatcherList { return @results; } +=head2 GetMatcherId + + my $matcher_id = C4::Matcher::GetMatcherId($code); + +Returns the matcher_id of a code. + +=cut + +sub GetMatcherId { + my ($code) = @_; + my $dbh = C4::Context->dbh; + + my $matcher_id = $dbh->selectrow_array("SELECT matcher_id FROM marc_matchers WHERE code = ?", undef, $code); + return $matcher_id; +} + =head1 METHODS =head2 new diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 9dbd032..da91ef6 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -851,7 +851,7 @@ CREATE TABLE `import_batches` ( `nomatch_action` enum('create_new', 'ignore') NOT NULL default 'create_new', `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add', `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging', - `batch_type` enum('batch', 'z3950') NOT NULL default 'batch', + `batch_type` enum('batch', 'z3950', 'webservice') NOT NULL default 'batch', `file_name` varchar(100), `comments` mediumtext, PRIMARY KEY (`import_batch_id`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index b844560..8ece898 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4892,6 +4892,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.07.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE import_batches MODIFY COLUMN batch_type ENUM('batch','z3950','webservice') NOT NULL default 'batch'"); + print "Upgrade to $DBversion done (Add 'webservice' to batch_type enum)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/misc/bin/connexion_import_daemon.pl b/misc/bin/connexion_import_daemon.pl new file mode 100755 index 0000000..a4775bc --- /dev/null +++ b/misc/bin/connexion_import_daemon.pl @@ -0,0 +1,263 @@ +#!/usr/bin/perl -w + +# Copyright 2012 CatalystIT +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use strict; +use warnings; + +use Getopt::Long; + +my ($help, $config, $daemon); + +GetOptions( + 'config|c=s' => \$config, + 'daemon|d' => \$daemon, + 'help|?' => \$help, +); + +if($help || !$config){ + print <new; +$server->config_file($config); + +if ($daemon) { + print $server->background; +} else { + $server->run; +} + + +{ +package ImportProxyServer; + +use base qw(HTTP::Server::Simple::CGI); + +use LWP::UserAgent; +use HTTP::Status qw(:constants status_message); +use XML::Simple; + +use constant AUTH_URI => "/cgi-bin/koha/mainpage.pl"; +use constant IMPORT_SVC_URI => "/cgi-bin/koha/svc/import_bib"; + +sub config_file { + my $self = shift; + $self->{'config_file'} = shift if (@_); + return $self->{'config_file'}; + +} + +sub parse_config { + my $self = shift; + + my $config_file = $self->config_file or die "No config file"; + + open CONF, $config_file or die "Cannot open config file $config: $!"; + + my %param; + my $line = 0; + while () { + $line++; + chomp; + s/\s*#.*//o; # remove comments + s/^\s+//o; # trim leading spaces + s/\s+$//o; # trim trailing spaces + next unless $_; + + my ($p, $v) = m/(\S+?):\s*(.*)/o; + die "Invalid config line $line: $_" unless defined $v; + $param{$p} = $v; + } + + $self->{LOCAL}->{koha} = delete( $param{koha} ) + or die "No koha base url in config file"; + $self->{LOCAL}->{user} = delete( $param{user} ) + or die "No koha user in config file"; + $self->{LOCAL}->{password} = delete( $param{password} ) + or die "No koha user password in config file"; + + $self->host( delete $param{host} ); + $self->port( delete( $param{port} ) || 80 ); + + my $log_fh; + if (my $logfile = delete $param{log}) { + open $log_fh, ">>$logfile" or die "Cannot open $logfile for write: $!"; + } else { + $log_fh = \*STDERR; + } + $self->{LOCAL}->{log_fh} = $log_fh; + + my $prefix = ""; + while ( my ($p, $v) = each %param ) { + $prefix .= "$p: $v\n"; + } + + $self->{LOCAL}->{prefix} = $prefix; +} + +sub log { + my $self = shift; + my $log_fh = $self->{LOCAL}->{log_fh} + or warn "No log fh", + return; + print $log_fh map "$_\n", @_; +} + +sub print_banner {}; + +sub run { + my $self = shift; + + $self->parse_config; + + my $ua = LWP::UserAgent->new; + $ua->timeout(10); + $ua->cookie_jar({}); + $self->{LOCAL}->{ua} = $ua; + + $self->SUPER::run(@_); +} + +sub response_start { + my ( $self, $status ) = @_; + print "HTTP/1.0 $status ". status_message($status); + print "\r\n"; +# print "Content-Type: text/html; charset='UTF-8'\r\n"; + +} +sub bad_req_error { + my ( $self, $cgi ) = @_; + $self->response_start(HTTP_BAD_REQUEST); + die $cgi->headers->as_string, $cgi->param; +} +sub handle_request { + my ( $self, $cgi ) = @_; + + my $data = $cgi->param('POSTDATA') + or return $self->bad_req_error($cgi); + + $data = $self->{LOCAL}->{prefix} . $data; + + my $ua = $self->{LOCAL}->{ua}; + my $base_url = $self->{LOCAL}->{koha}; + my $resp = $ua->post( $base_url.IMPORT_SVC_URI, 'Content-Type' => 'text/plain', Content => $data ); + my $status = $resp->code; + if ($status == HTTP_UNAUTHORIZED || $status == HTTP_FORBIDDEN) { + my $user = $self->{LOCAL}->{user}; + my $password = $self->{LOCAL}->{password}; + $resp = $ua->post( $base_url.AUTH_URI, { userid => $user, password => $password } ); + $resp = $ua->post( $base_url.IMPORT_SVC_URI, 'Content-Type' => 'text/plain', Content => $data ) + if $resp->is_success; + } + $self->log("Unsuccessful request", $resp->request->as_string, $resp->as_string) + unless $resp->is_success; + + $self->response_start($resp->code); + print $resp->headers->as_string; + print "\r\n"; + + if ($resp->is_success) { + my ($koha_status, $bib, $batch_id, $error); + if ( my $r = eval { XMLin($resp->content) } ) { + $koha_status = $r->{status}; + $batch_id = $r->{import_batch_id}; + $error = $r->{error}; + } + else { + $koha_status = "error"; + $error = "Response iformat error:\n$resp->content" + } + + if ($koha_status eq "ok") { + printf "Got it. Thanks.\nImport batch id: %s\0", $batch_id; + } else { + printf "%s. Please contact administrator.\0", $error; + } + } + else { + print $resp->content; + } +} + +} # package +=comment +use HTTP::Proxy; +use HTTP::Proxy::HeaderFilter::simple; +use HTTP::Proxy::BodyFilter::complete; +use HTTP::Proxy::BodyFilter::simple; + +my $header_filter = HTTP::Proxy::HeaderFilter::simple->new( + sub { + my ( $self, $headers, $message) = @_; + $headers->header('Content-Type' => 'text/plain'); + $message->url($svc_url); + } +); +my $body_filter = HTTP::Proxy::BodyFilter::simple->new( + sub { + my ( $self, $dataref, $message, $protocol, $buffer) = @_; + $$dataref = $prefix.$$dataref unless $buffer; + } +); +my $proxy = HTTP::Proxy->new( + host => $host, + port => $port ); +$proxy->push_filter( + method => 'POST', + request => $header_filter, + request => HTTP::Proxy::BodyFilter::complete->new, + request => $body_filter, +); +$proxy->start; +=cut + + diff --git a/misc/cronjobs/import_webservice_batch.pl b/misc/cronjobs/import_webservice_batch.pl new file mode 100755 index 0000000..d1b30ef --- /dev/null +++ b/misc/cronjobs/import_webservice_batch.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w + +# Copyright 2012 CatalystIT +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use strict; +use warnings; +use utf8; + +BEGIN { + + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} + +use Getopt::Long; +use Pod::Usage; +use C4::ImportBatch; + +my ($help, $framework); + +GetOptions( + 'help|?' => \$help, + 'framework=s' => \$framework, +); + +if($help){ + print < 'edit_catalogue'} ); +unless ($status eq "ok") { + print $query->header(-type => 'text/xml', -status => '403 Forbidden'); + print XMLout({ auth_status => $status }, NoAttr => 1, RootName => 'response', XMLDecl => 1); + exit 0; +} + +my $in; +if ($query->request_method eq "POST") { + $in = $query->param('POSTDATA'); +} +if ($in) { + my $result = import_bib($in); + print $query->header(-type => 'text/xml'); + print XMLout($result, NoAttr => 1, RootName => 'response', XMLDecl => 1); +} else { + print $query->header(-type => 'text/xml', -status => '400 Bad Request'); +} + +exit 0; + +sub import_bib { + my ($in) = shift; + + my $result = {}; + + unless ($in) { + $result->{'status'} = "failed"; + $result->{'error'} = "Empty request"; + return $result; + } + + my ($inparams, $inxml) = ($in =~ m/^(.*)?(\<\?xml .*)$/s); + unless ($inxml) { + $result->{'status'} = "failed"; + $result->{'error'} = "No xml in the request\n$in"; + return $result; + } + + my %params; + if ($inparams) { + # params are "p1: v1\np2: v2\np3: v3..." + chomp $inparams; + %params = map { split /:\s*/ } split "\n", $inparams; + } + + my $import_mode = delete $params{import_mode} || ''; + my $framework = delete $params{framework} || ''; + + if (my $matcher_code = delete $params{matcher}) { + $params{matcher_id} = C4::Matcher::GetMatcherId($matcher_code); + } + + my $batch_id = GetWebserviceBatchId(\%params); + unless ($batch_id) { + $result->{'status'} = "failed"; + $result->{'error'} = "Batch create error"; + return $result; + } + + my $marcflavour = C4::Context->preference('marcflavour') || 'MARC21'; + my $marc_record = eval {MARC::Record::new_from_xml( $inxml, "utf8", $marcflavour)}; + if ($@) { + $result->{'status'} = "failed"; + $result->{'error'} = $@; + return $result; + } + + my $import_record_id = AddBiblioToBatch($batch_id, 0, $marc_record, "utf8", int(rand(99999))); + my @import_items_ids = AddItemsToImportBiblio($batch_id, $import_record_id, $marc_record, 0); + my $marcxml = GetImportRecordMarcXML($import_record_id); + unless ($marcxml) { + $result->{'status'} = "failed"; + $result->{'error'} = "database write error"; + return $result; + } + $marcxml =~ s/<\?xml.*?\?>//i; + + # XXX we are ignoring the result of this; + BatchCommitBibRecords($batch_id, $framework) if lc($import_mode) eq 'direct'; + + $result->{'status'} = "ok"; + $result->{'import_batch_id'} = $batch_id; + $result->{'marcxml'} = $marcxml; + return $result; +} diff --git a/t/db_dependent/lib/KohaTest/ImportBatch.pm b/t/db_dependent/lib/KohaTest/ImportBatch.pm index a8fefaa..743b1aa 100644 --- a/t/db_dependent/lib/KohaTest/ImportBatch.pm +++ b/t/db_dependent/lib/KohaTest/ImportBatch.pm @@ -118,11 +118,7 @@ sub add_import_batch { file_name => 'foo', comments => 'inserted during automated testing', }; - my $batch_id = AddImportBatch( $test_batch->{'overlay_action'}, - $test_batch->{'import_status'}, - $test_batch->{'batch_type'}, - $test_batch->{'file_name'}, - $test_batch->{'comments'}, ); + my $batch_id = AddImportBatch( $test_batch ); return $batch_id; } diff --git a/t/db_dependent/lib/KohaTest/ImportBatch/AddImportBatch.pm b/t/db_dependent/lib/KohaTest/ImportBatch/AddImportBatch.pm deleted file mode 100644 index 7b97e72..0000000 --- a/t/db_dependent/lib/KohaTest/ImportBatch/AddImportBatch.pm +++ /dev/null @@ -1,31 +0,0 @@ -package KohaTest::ImportBatch::AddImportBatch; -use base qw( KohaTest::ImportBatch ); - -use strict; -use warnings; - -use Test::More; - -use C4::ImportBatch; -use C4::Matcher; -use C4::Biblio; - - -=head3 add_one - -=cut - -sub add_one : Test( 1 ) { - my $self = shift; - - my $batch_id = AddImportBatch( - 'create_new', #overlay_action - 'staging', # import_status - 'batch', # batc_type - 'foo', # file_name - 'inserted during automated testing', # comments - ); - ok( $batch_id, "successfully inserted batch: $batch_id" ); -} - -1; diff --git a/t/db_dependent/lib/KohaTest/ImportBatch/GetImportBatch.pm b/t/db_dependent/lib/KohaTest/ImportBatch/GetImportBatch.pm index 0b01707..6f436c5 100644 --- a/t/db_dependent/lib/KohaTest/ImportBatch/GetImportBatch.pm +++ b/t/db_dependent/lib/KohaTest/ImportBatch/GetImportBatch.pm @@ -25,13 +25,7 @@ sub add_one_and_find_it : Test( 7 ) { file_name => 'foo', comments => 'inserted during automated testing', }; - my $batch_id = AddImportBatch( - $batch->{'overlay_action'}, - $batch->{'import_status'}, - $batch->{'batch_type'}, - $batch->{'file_name'}, - $batch->{'comments'}, - ); + my $batch_id = AddImportBatch($batch); ok( $batch_id, "successfully inserted batch: $batch_id" ); my $retrieved = GetImportBatch( $batch_id ); -- 1.6.5 From srdjan at catalyst.net.nz Tue Mar 13 05:28:57 2012 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Tue, 13 Mar 2012 17:28:57 +1300 Subject: [Koha-patches] [PATCH] bug_3966: Update items on receive In-Reply-To: References: Message-ID: <1331612937-5155-1-git-send-email-srdjan@catalyst.net.nz> Changed AddItem() and ModItem() interface so now they return item record. AddItemFromMarc() looks for itemnumber, and calls ModItem() if one is found. --- C4/Acquisition.pm | 51 +++------- C4/Biblio.pm | 2 - C4/ImportBatch.pm | 4 +- C4/Items.pm | 25 +++-- acqui/addorder.pl | 5 +- acqui/addorderiso2709.pl | 4 +- acqui/booksellers.pl | 6 +- acqui/finishreceive.pl | 103 ++++++++++++-------- acqui/orderreceive.pl | 63 ++++++------- cataloguing/additem.pl | 8 +- .../prog/en/modules/acqui/orderreceive.tt | 36 +++---- t/db_dependent/lib/KohaTest.pm | 16 +-- .../lib/KohaTest/Acquisition/GetParcel.pm | 17 +--- .../lib/KohaTest/Acquisition/GetParcels.pm | 18 +--- t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm | 6 +- 15 files changed, 174 insertions(+), 190 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 0a96a02..bef6625 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1083,16 +1083,14 @@ sub GetCancelledOrders { =head3 ModReceiveOrder - &ModReceiveOrder($biblionumber, $ordernumber, $quantityreceived, $user, - $unitprice, $booksellerinvoicenumber, $biblioitemnumber, - $freight, $bookfund, $rrp); + &ModReceiveOrder($biblionumber, $ordernumber, $quantityreceived, $receiveditems); Updates an order, to reflect the fact that it was received, at least -in part. All arguments not mentioned below update the fields with the -same name in the aqorders table of the Koha database. +in part. If a partial order is received, splits the order into two. The received -portion must have a booksellerinvoicenumber. +portion must have a booksellerinvoicenumber. If $receiveditems are supplied, +the rest of the items will be moved to the new order. Updates the order with bibilionumber C<$biblionumber> and ordernumber C<$ordernumber>. @@ -1101,13 +1099,9 @@ C<$ordernumber>. sub ModReceiveOrder { - my ( - $biblionumber, $ordernumber, $quantrec, $user, $cost, - $invoiceno, $freight, $rrp, $budget_id, $datereceived - ) - = @_; + my ( $biblionumber, $ordernumber, $quantrec, $receiveditems ) = @_; my $dbh = C4::Context->dbh; - $datereceived = C4::Dates->output('iso') unless $datereceived; + my $suggestionid = GetSuggestionFromBiblionumber( $dbh, $biblionumber ); if ($suggestionid) { ModSuggestion( {suggestionid=>$suggestionid, @@ -1125,36 +1119,23 @@ sub ModReceiveOrder { $sth->finish(); if ( $order->{quantity} > $quantrec ) { - $sth=$dbh->prepare(" - UPDATE aqorders - SET quantityreceived=? - , datereceived=? - , booksellerinvoicenumber=? - , unitprice=? - , freight=? - , rrp=? - , quantity=? - WHERE biblionumber=? AND ordernumber=?"); - - $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber); - $sth->finish; - # create a new order for the remaining items, and set its bookfund. foreach my $orderkey ( "linenumber", "allocation" ) { delete($order->{'$orderkey'}); } $order->{'quantity'} -= $quantrec; $order->{'quantityreceived'} = 0; - my $newOrder = NewOrder($order); -} else { - $sth=$dbh->prepare("update aqorders - set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?, - unitprice=?,freight=?,rrp=? - where biblionumber=? and ordernumber=?"); - $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber); - $sth->finish; + my (undef, $newOrder) = NewOrder($order); + + if ($receiveditems && @$receiveditems) { + my $sql = " + UPDATE aqorders_items + SET ordernumber = ? + WHERE ordernumber = ? + AND itemnumber NOT IN (".join(",", map "?", @$receiveditems).")"; + $dbh->do($sql, undef, $newOrder, $ordernumber, @$receiveditems); + } } - return $datereceived; } #------------------------------------------------------------# diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 81da91b..2f3c08e 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2580,8 +2580,6 @@ sub TransformMarcToKohaOneField { } -#" - # # true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates # at the same time diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 63cc60b..cc054ad 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -547,10 +547,10 @@ sub BatchCommitItems { $updsth->execute(); $num_items_errored++; } else { - my ($item_biblionumber, $biblioitemnumber, $itemnumber) = AddItemFromMarc($item_marc, $biblionumber); + my $item = AddItemFromMarc($item_marc, $biblionumber); my $updsth = $dbh->prepare("UPDATE import_items SET status = ?, itemnumber = ? WHERE import_items_id = ?"); $updsth->bind_param(1, 'imported'); - $updsth->bind_param(2, $itemnumber); + $updsth->bind_param(2, $item->{itemnumber}); $updsth->bind_param(3, $row->{'import_items_id'}); $updsth->execute(); $updsth->finish(); diff --git a/C4/Items.pm b/C4/Items.pm index b257e52..2752215 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -194,11 +194,11 @@ sub CartToShelf { =head2 AddItemFromMarc - my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItemFromMarc($source_item_marc, $biblionumber); + my $item = AddItemFromMarc($source_item_marc, $biblionumber); Given a MARC::Record object containing an embedded item -record and a biblionumber, create a new item record. +record and a biblionumber, create a new item record or update +existing one. =cut @@ -214,13 +214,15 @@ sub AddItemFromMarc { $localitemmarc->append_fields($source_item_marc->field($itemtag)); my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode ,'items'); my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode); + if (my $itemnumber = $item->{itemnumber}) { + return ModItem($item, $biblionumber, $itemnumber, $dbh, $frameworkcode, $unlinked_item_subfields); + } return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields); } =head2 AddItem - my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]); + my $item = AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]); Given a hash containing item column names as keys, create a new Koha item record. @@ -272,7 +274,7 @@ sub AddItem { logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); - return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber); + return $item; } =head2 AddItemBatchFromMarc @@ -451,6 +453,7 @@ sub ModItemFromMarc { $item->{$item_field} = $default_values_for_mod_from_marc{$item_field} unless (exists $item->{$item_field}); } my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); + $itemnumber ||= $item->{itemnumber}; ModItem($item, $biblionumber, $itemnumber, $dbh, $frameworkcode, $unlinked_item_subfields); return $item; @@ -458,7 +461,7 @@ sub ModItemFromMarc { =head2 ModItem - ModItem({ column => $newvalue }, $biblionumber, $itemnumber); + my $item = ModItem({ column => $newvalue }, $biblionumber, $itemnumber); Change one or more columns in an item record and update the MARC representation of the item. @@ -521,6 +524,8 @@ sub ModItem { ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef ); logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog"); + + return $item; } =head2 ModItemTransfer @@ -2534,7 +2539,7 @@ sub _find_value { =head2 PrepareItemrecordDisplay - PrepareItemrecordDisplay($itemrecord,$bibnum,$itemumber,$frameworkcode); + PrepareItemrecordDisplay(bibnum,$itemumber,$itemrecord,$$frameworkcode); Returns a hash with all the fields for Display a given item data in a template @@ -2713,14 +2718,14 @@ sub PrepareItemrecordDisplay { $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? my $index_subfield = int(rand(1000000)); $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; - $subfield_data{marc_value} = qq[ ... $javascript]; } else { warn "Plugin Failed: $plugin"; - $subfield_data{marc_value} = qq(); # supply default input form + $subfield_data{marc_value} = qq(); # supply default input form } } elsif ( $tag eq '' ) { # it's an hidden field diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 279084b..e977c23 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -262,9 +262,8 @@ if ( $orderinfo->{quantity} ne '0' ) { $itemhash{$item}->{'indicator'}, 'ITEM'); my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); - my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$$orderinfo{biblionumber}); - NewOrderItem($itemnumber, $$orderinfo{ordernumber}); - + my $item = AddItemFromMarc($record,$$orderinfo{biblionumber}); + NewOrderItem($item->{itemnumber}, $$orderinfo{ordernumber}); } } diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 660d633..9fb5fd4 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -260,8 +260,8 @@ if ($op eq ""){ my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator ); my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); for (my $qtyloop=1;$qtyloop <=$quantity;$qtyloop++) { - my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); - NewOrderItem( $itemnumber, $ordernumber ); + my $item = AddItemFromMarc( $record, $biblionumber ); + NewOrderItem( $item->{itemnumber}, $ordernumber ); } } else { SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index ac3c557..8815905 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -111,12 +111,14 @@ for my $vendor (@suppliers) { for my $basket ( @{$baskets} ) { my $authorisedby = $basket->{authorisedby}; + my $basketbranch = ''; + $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode} if $authorisedby; if ($userenv->{'flags'} & 1 || #user is superlibrarian (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and ($viewbaskets eq 'all' || #user is allowed to see all baskets - ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq GetMember( borrowernumber => $authorisedby )->{branchcode}) || #basket belongs to user's branch - ($basket->{authorisedby} && $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket + ($viewbaskets eq 'branch' && $userbranch eq $basketbranch) || #basket belongs to user's branch + ($basket->{authorisedby} && $viewbaskets == 'user' && $authorisedby eq $loggedinuser) #user created this basket ) ) ) { diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 90a85fe..db57446 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -26,10 +26,10 @@ use CGI; use C4::Auth; use C4::Output; use C4::Context; +use C4::Dates; use C4::Acquisition; use C4::Biblio; use C4::Items; -use C4::Search; use List::MoreUtils qw/any/; my $input=new CGI; @@ -44,57 +44,79 @@ my $quantityrec=$input->param('quantityrec'); my $quantity=$input->param('quantity'); my $unitprice=$input->param('cost'); my $invoiceno=$input->param('invoice'); -my $datereceived=$input->param('datereceived'); +my $datereceived=$input->param('datereceived') || C4::Dates->output('iso'); my $replacement=$input->param('rrp'); my $gst=$input->param('gst'); my $freight=$input->param('freight'); my $booksellerid = $input->param('booksellerid'); my $cnt=0; -my $error_url_str; +my $error_url_str = ''; my $ecost = $input->param('ecost'); my $note = $input->param("note"); +my $order = GetOrder($ordernumber); +$order->{booksellerinvoicenumber} = $invoiceno; +$order->{datereceived} = $datereceived; +$order->{freight} = $freight; +$order->{quantity} = $quantity; +$order->{quantityreceived} = $quantityrec; +$order->{notes} = $note; +$order->{rrp} = $replacement; +$order->{ecost} = $ecost; +$order->{unitprice} = $unitprice; +ModOrder($order); + #need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME -if ($quantityrec > $origquantityrec ) { - # now, add items if applicable - if (C4::Context->preference('AcqCreateItem') eq 'receiving') { - my @tags = $input->param('tag'); - my @subfields = $input->param('subfield'); - my @field_values = $input->param('field_value'); - my @serials = $input->param('serial'); - my @itemid = $input->param('itemid'); - my @ind_tag = $input->param('ind_tag'); - my @indicator = $input->param('indicator'); - #Rebuilding ALL the data for items into a hash - # parting them on $itemid. - my %itemhash; - my $countdistinct; - my $range=scalar(@itemid); - for (my $i=0; $i<$range; $i++){ - unless ($itemhash{$itemid[$i]}){ - $countdistinct++; - } - push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i]; - push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i]; - push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i]; - push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i]; - push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; - } - foreach my $item (keys %itemhash){ - my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'}, - $itemhash{$item}->{'subfields'}, - $itemhash{$item}->{'field_values'}, - $itemhash{$item}->{'ind_tag'}, - $itemhash{$item}->{'indicator'},'ITEM'); - my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); - my (undef,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$biblionumber); - NewOrderItem($itemnumber, $ordernumber); - } +# now, add or update items if applicable +my @tags = $input->param('tag'); +my @subfields = $input->param('subfield'); +my @field_values = $input->param('field_value'); +my @serials = $input->param('serial'); +my @itemid = $input->param('itemid'); +my @ind_tag = $input->param('ind_tag'); +my @indicator = $input->param('indicator'); +#Rebuilding ALL the data for items into a hash +# parting them on $itemid. +my %itemhash; +my $countdistinct; +my $range=scalar(@itemid); +for (my $i=0; $i<$range; $i++){ + unless ($itemhash{$itemid[$i]}){ + $countdistinct++; + } + push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i]; + push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i]; + push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i]; + push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i]; + push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; +} +my $error; +my %itemnumbers = map { $_ => 1 } GetItemnumbersFromOrder($ordernumber); +my @received; +foreach my $id (keys %itemhash){ + my $xml = TransformHtmlToXml( $itemhash{$id}->{'tags'}, + $itemhash{$id}->{'subfields'}, + $itemhash{$id}->{'field_values'}, + $itemhash{$id}->{'ind_tag'}, + $itemhash{$id}->{'indicator'},'ITEM'); + my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); + my $item = AddItemFromMarc($record,$biblionumber); + my $itemnumber = $item ? $item->{itemnumber} : undef; + if ($itemnumber) { + push @received, $itemnumber; + NewOrderItem($itemnumber, $ordernumber) unless $itemnumbers{$itemnumber}; + } else { + $error++; } - +} + +if ($error) { + $error_url_str = "&error=Datbase+write+error"; +} +else { # save the quantity received. - $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoiceno,$freight,$replacement,undef,$datereceived); + ModReceiveOrder($biblionumber,$ordernumber, $quantityrec, \@received); } update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber ); @@ -114,3 +136,4 @@ sub update_item { replacementpricedate => $datereceived, }, $biblionumber, $itemnumber ); } + diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 659c103..3f2995d 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -87,21 +87,13 @@ my $search = $input->param('receive'); my $invoice = $input->param('invoice'); my $freight = $input->param('freight'); my $datereceived = $input->param('datereceived'); - - $datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new(); my $bookseller = GetBookSellerFromId($booksellerid); my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; my $results = SearchOrder($ordernumber,$search); - - my $count = scalar @$results; -my $order = GetOrder($ordernumber); - - -my $date = @$results[0]->{'entrydate'}; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -116,24 +108,27 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( # prepare the form for receiving if ( $count == 1 ) { - if (C4::Context->preference('AcqCreateItem') eq 'receiving') { + my $order = GetOrder($results->[0]->{ordernumber}); + my $biblionumber = $order->{biblionumber}; + + my @itemloop; + if ( my @itemnumbers = GetItemnumbersFromOrder($ordernumber) ) { + @itemloop = map PrepareItemrecordDisplay($biblionumber,$_), @itemnumbers; + } + elsif (C4::Context->preference('AcqCreateItem') eq 'receiving') { # prepare empty item form my $cell = PrepareItemrecordDisplay('','','','ACQ'); unless ($cell) { $cell = PrepareItemrecordDisplay('','','',''); $template->param('NoACQframework' => 1); } - my @itemloop; push @itemloop,$cell; - - $template->param(items => \@itemloop); } + + $template->param(items => \@itemloop) if @itemloop; - if ( @$results[0]->{'quantityreceived'} == 0 ) { - @$results[0]->{'quantityreceived'} = ''; - } - if ( @$results[0]->{'unitprice'} == 0 ) { - @$results[0]->{'unitprice'} = ''; + if ( $order->{'unitprice'} == 0 ) { + $order->{'unitprice'} = ''; } my $suggestion = GetSuggestionInfoFromBiblionumber(@$results[0]->{'biblionumber'}); @@ -145,26 +140,26 @@ if ( $count == 1 ) { $template->param( count => 1, - biblionumber => @$results[0]->{'biblionumber'}, - ordernumber => @$results[0]->{'ordernumber'}, - biblioitemnumber => @$results[0]->{'biblioitemnumber'}, - booksellerid => @$results[0]->{'booksellerid'}, + biblionumber => $biblionumber, + ordernumber => $order->{'ordernumber'}, + biblioitemnumber => $order->{'biblioitemnumber'}, + booksellerid => $booksellerid, freight => $freight, gst => $gst, name => $bookseller->{'name'}, - date => format_date($date), - title => @$results[0]->{'title'}, - author => @$results[0]->{'author'}, - copyrightdate => @$results[0]->{'copyrightdate'}, - isbn => @$results[0]->{'isbn'}, - seriestitle => @$results[0]->{'seriestitle'}, - bookfund => $budget->{budget_name}, - quantity => @$results[0]->{'quantity'}, - quantityreceivedplus1 => @$results[0]->{'quantityreceived'} + 1, - quantityreceived => @$results[0]->{'quantityreceived'}, - rrp => @$results[0]->{'rrp'}, - ecost => @$results[0]->{'ecost'}, - unitprice => @$results[0]->{'unitprice'}, + date => format_date($order->{'entrydate'}), + title => $order->{'title'}, + author => $order->{'author'}, + copyrightdate => $order->{'copyrightdate'}, + isbn => $order->{'isbn'}, + seriestitle => $order->{'seriestitle'}, + bookfund => $order->{'bookfundid'}, + quantity => $order->{'quantity'}, + quantityreceived => scalar(@itemloop) || 1, + origquantityrec => $order->{'quantityreceived'}, + rrp => $order->{'rrp'}, + ecost => $order->{'ecost'}, + unitprice => $order->{'unitprice'}, memberfirstname => $member->{firstname} || "", membersurname => $member->{surname} || "", invoice => $invoice, diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 4bf06b5..8e2f81b 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -348,8 +348,8 @@ if ($op eq "additem") { push @errors,"barcode_not_unique" if($exist_itemnumber); # if barcode exists, don't create, but report The problem. unless ($exist_itemnumber) { - my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); - set_item_default_location($oldbibitemnum); + my $item = AddItemFromMarc($record,$biblionumber); + set_item_default_location($item->{biblioitemnumber}); } $nextop = "additem"; if ($exist_itemnumber) { @@ -416,8 +416,8 @@ if ($op eq "additem") { # Adding the item if (!$exist_itemnumber) { - my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); - set_item_default_location($oldbibitemnum); + my $item = AddItemFromMarc($record,$biblionumber); + set_item_default_location($item->{biblioitemnumber}); # We count the item only if it was really added # That way, all items are added, even if there was some already existing barcodes diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 3eb3e23..a25d190 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -55,15 +55,15 @@

    No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used

    [% END %] + [% itemid = 1 %] [% FOREACH item IN items %] -
    -
    +
      [% FOREACH iteminformatio IN item.iteminformation %]
    1. [% iteminformatio.marc_value %] - + @@ -75,18 +75,18 @@
    2. [% END %]
    - Add - + +  + - + + + + + + + +
    -
    - - - - - - - - + [% itemid = itemid + 1 %] [% END %] [% END %] @@ -116,14 +116,12 @@ [% IF ( quantityreceived ) %] [% IF ( edit ) %] - [% ELSE %] [% IF ( items ) %] - + [% ELSE %] - + [% END %] - [% END %] [% ELSE %] [% IF ( items ) %] @@ -131,8 +129,8 @@ [% ELSE %] [% END %] - [% END %] +
  • diff --git a/t/db_dependent/lib/KohaTest.pm b/t/db_dependent/lib/KohaTest.pm index d8cf495..c632740 100644 --- a/t/db_dependent/lib/KohaTest.pm +++ b/t/db_dependent/lib/KohaTest.pm @@ -572,16 +572,12 @@ sub add_biblios { ok( $biblionumber, "the biblionumber is $biblionumber" ); ok( $biblioitemnumber, "the biblioitemnumber is $biblioitemnumber" ); if ( $param{'add_items'} ) { - # my @iteminfo = AddItem( {}, $biblionumber ); - my @iteminfo = AddItemFromMarc( $marcrecord, $biblionumber ); - is( $iteminfo[0], $biblionumber, "biblionumber is $biblionumber" ); - is( $iteminfo[1], $biblioitemnumber, "biblioitemnumber is $biblioitemnumber" ); - ok( $iteminfo[2], "itemnumber is $iteminfo[2]" ); - push @{ $self->{'items'} }, - { biblionumber => $iteminfo[0], - biblioitemnumber => $iteminfo[1], - itemnumber => $iteminfo[2], - }; + # my $item = AddItem( {}, $biblionumber ); + my $item = AddItemFromMarc( $marcrecord, $biblionumber ); + is( $item->{biblionumber}, "biblionumber is $biblionumber" ); + is( $item->{biblioitemnumber}, "biblioitemnumber is $biblioitemnumber" ); + ok( $item->{itemnumber}, "itemnumber is $item->{itemnumber}" ); + push @{ $self->{'items'} }, $item; } push @{$self->{'biblios'}}, $biblionumber; } diff --git a/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm b/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm index c26e5f2..b42ea9c 100644 --- a/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm +++ b/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm @@ -43,18 +43,11 @@ sub one_parcel : Test( 17 ) { ok( $basketno, "my basket number is $basketno" ); ok( $ordernumber, "my order number is $ordernumber" ); - my $datereceived = ModReceiveOrder( $self->{'biblios'}[0], # biblionumber - $ordernumber, # $ordernumber, - undef, # $quantrec, - undef, # $user, - undef, # $cost, - $invoice, # $invoiceno, - undef, # $freight, - undef, # $rrp, - $self->{'bookfundid'}, # $bookfund, - $today, # $datereceived - ); - is( $datereceived, $today, "the parcel was received on $datereceived" ); + ModReceiveOrder( $self->{'biblios'}[0], # biblionumber + $ordernumber, # $ordernumber, + 1, # $quantrec, + ); + pass( "the parcel was received" ); my @parcel = GetParcel( $self->{'booksellerid'}, $invoice, $today ); is( scalar @parcel, 1, 'we found one (1) parcel.' ) diff --git a/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm b/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm index fd3ad0f..b14095f 100644 --- a/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm +++ b/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm @@ -271,18 +271,12 @@ sub create_order { my ( $basketno, $ordernumber ) = $self->create_new_basket( %param ); - my $datereceived = ModReceiveOrder( $self->{'biblios'}[0], # biblionumber - $ordernumber, # $ordernumber, - undef, # $quantrec, - undef, # $user, - undef, # $cost, - $param{'invoice'}, # $invoiceno, - undef, # $freight, - undef, # $rrp, - $self->{'bookfundid'}, # $bookfund, - $param{'date'}, # $datereceived - ); - is( $datereceived, $param{'date'}, "the parcel was received on $datereceived" ); + ModReceiveOrder( $self->{'biblios'}[0], # biblionumber + $ordernumber, # $ordernumber, + 1, # $quantrec, + ); + # XXX Needs proper tests for partial receiving + pass( "the parcel was received" ); } diff --git a/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm b/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm index 5b29ea8..8a83268 100644 --- a/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm +++ b/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm @@ -31,10 +31,10 @@ sub add_bib_to_modify : Test( startup => 3 ) { $self->{'bib_to_modify'} = $bibnum; # add an item - my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); + my $item = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); - cmp_ok($item_bibnum, '==', $bibnum, "new item is linked to correct biblionumber"); - cmp_ok($item_bibitemnum, '==', $bibitemnum, "new item is linked to correct biblioitemnumber"); + cmp_ok($item->{biblionumber}, '==', $bibnum, "new item is linked to correct biblionumber"); + cmp_ok($item->{biblioitemnumber}, '==', $bibitemnum, "new item is linked to correct biblioitemnumber"); $self->reindex_marc(); -- 1.6.5 From jonathan.druart at biblibre.com Tue Mar 13 10:05:23 2012 From: jonathan.druart at biblibre.com (Jonathan Druart) Date: Tue, 13 Mar 2012 10:05:23 +0100 Subject: [Koha-patches] [PATCH 1/1] Bug 7167: Followup: FIX conflicts with Bug 5347 Message-ID: <1331629523-7858-1-git-send-email-jonathan.druart@biblibre.com> - Fix sql syntax error - Fix Encoding - SendAlerts must return an error if no email is defined - Get error if no email in memberentry --- C4/Letters.pm | 19 ++++++++++--------- .../prog/en/modules/members/memberentrygen.tt | 11 +++++++++++ members/memberentry.pl | 14 ++++++++++++-- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index ce21a5d..6bbdb51 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -295,8 +295,8 @@ sub SendAlerts { my %mail = ( To => $email, From => $email, - Subject => "" . $letter->{title}, - Message => "" . $letter->{content}, + Subject => Encode::encode( "utf8", "" . $letter->{title} ), + Message => Encode::encode( "utf8", "" . $letter->{content} ), 'Content-Type' => 'text/plain; charset="utf8"', ); sendmail(%mail) or carp $Mail::Sendmail::error; @@ -323,8 +323,8 @@ sub SendAlerts { LEFT JOIN biblio ON serial.biblionumber=biblio.biblionumber LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id WHERE serial.serialid IN ( - } - . join( ",", @$externalid ) . ")"; + }; + $strsth .= join( ",", @$externalid ) . ")"; my $sthorders = $dbh->prepare($strsth); $sthorders->execute; my $dataorders = $sthorders->fetchall_arrayref( {} ); @@ -339,7 +339,7 @@ sub SendAlerts { push @email, $databookseller->{contemail} if $databookseller->{contemail}; unless (@email) { warn "Bookseller $dataorders->[0]->{booksellerid} without emails"; - return; + return { error => "no_email" }; } my $userenv = C4::Context->userenv; @@ -359,8 +359,8 @@ sub SendAlerts { my %mail = ( To => join( ','. @email), From => $userenv->{emailaddress}, - Subject => "" . $letter->{title}, - Message => "" . $letter->{content}, + Subject => Encode::encode( "utf8", "" . $letter->{title} ), + Message => Encode::encode( "utf8", "" . $letter->{content} ), 'Content-Type' => 'text/plain; charset="utf8"', ); sendmail(%mail) or carp $Mail::Sendmail::error; @@ -392,11 +392,12 @@ sub SendAlerts { want_librarian => 1, ) or return; + return { error => "no_email" } unless $externalid->{'emailaddr'}; my %mail = ( To => $externalid->{'emailaddr'}, From => $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"), - Subject => $letter->{'title'}, - Message => $letter->{'content'}, + Subject => Encode::encode( "utf8", $letter->{'title'} ), + Message => Encode::encode( "utf8", $letter->{'content'} ), 'Content-Type' => 'text/plain; charset="utf8"', ); sendmail(%mail) or carp $Mail::Sendmail::error; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index d2ca4af..c364f85 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -82,6 +82,17 @@
    + [% IF error_alert %] + [% IF ( error_alert == "no_email" ) %] +
    This member has no email
    + [% ELSE %] +
    [% error_alert %]
    + [% END %] + [% END %] + [% IF info_alert %] +
    Email has been sent.
    + [% END %] + [% IF ( no_add ) %]

    Cannot add patron

    [% IF ( no_branches ) %]

    There are no libraries defined. [% IF ( CAN_user_parameters ) %]Please add a library.[% ELSE %]An administrator must define at least one library.[% END %]

    [% END %] [% IF ( no_categories ) %]

    There are no patron categories defined. [% IF ( CAN_user_parameters ) %]Please add a patron category.[% ELSE %]An administrator must define at least one patron category.

    [% END %][% END %]
    [% END %] diff --git a/members/memberentry.pl b/members/memberentry.pl index c474a66..d53f7f1 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -347,9 +347,19 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ # if we manage to find a valid email address, send notice if ($emailaddr) { $newdata{emailaddr} = $emailaddr; - SendAlerts ( 'members', \%newdata, "ACCTDETAILS" ); + my $err; + eval { + $err = SendAlerts ( 'members', \%newdata, "ACCTDETAILS" ); + }; + if ( $@ ) { + $template->param(error_alert => $@); + } elsif ( defined $err->{error} and $err->{error} eq "no_email" ) { + $template->{VARS}->{'error_alert'} = "no_email"; + } else { + $template->{VARS}->{'info_alert'} = 1; + } } - } + } if ($data{'organisations'}){ # need to add the members organisations -- 1.7.7.3 From jonathan.druart at biblibre.com Wed Mar 14 14:40:05 2012 From: jonathan.druart at biblibre.com (Jonathan Druart) Date: Wed, 14 Mar 2012 14:40:05 +0100 Subject: [Koha-patches] [PATCH 1/1] Bug 5180: FIX autocomplete on overdues report Message-ID: <1331732405-21996-1-git-send-email-jonathan.druart@biblibre.com> - Switch off the CircAutocompl syspref - Set a (one or more) patron attr type searchable - go on the overdues page Firebug crash and a layout problem appears on the left. Firebug error is "YAHOO.widget.DS_XHR is not a constructor" retry with this patch. --- .../intranet-tmpl/prog/en/modules/circ/overdue.tt | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt index e196399..4310a4f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt @@ -24,7 +24,9 @@ var attrcode = $("script", clone).attr("x-code"); var newsuffix = parts[1] + appendid; - create_auto_completion_responder(newsuffix,attrcode); + [% IF ( CircAutocompl ) %] + create_auto_completion_responder(newsuffix,attrcode); + [% END %] } parent.parentNode.insertBefore(clone, parent.nextSibling); @@ -33,6 +35,7 @@ var parent = node.parentNode; parent.parentNode.removeChild(parent); } + [% IF ( CircAutocompl ) %] function create_auto_completion_responder(uniqueid,attrcode) { YAHOO.util.Event.onContentReady("pattrodue-getready-"+uniqueid, function() { new function() { @@ -64,6 +67,7 @@ } }); } + [% END %] //]]>