[Koha-cvs] koha/intranet htdocs/intranet-tmpl/default/en/s... [rel_TG]

Tumer Garip tgarip at neu.edu.tr
Fri Mar 16 17:18:43 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_TG
Changes by:	Tumer Garip <tgarip1957>	07/03/16 16:18:37

Removed files:
	intranet/htdocs/intranet-tmpl/default/en/serials: routing.tmpl 
	                                                  serial-issues-full.tmpl 
	                                                  serial-issues.tmpl 
	                                                  serials-home.tmpl 
	                                                  serials-receive.tmpl 
	                                                  subscription-add.tmpl 
	                                                  subscription-bib-search.tmpl 
	                                                  subscription-detail.tmpl 
	                                                  subscription-renew.tmpl 
	                                                  viewalerts.tmpl 
	intranet/htdocs/intranet-tmpl/default/en/sms: sms-home.tmpl 
	intranet/htdocs/intranet-tmpl/default/en/suggestion: 
	                                                     acceptorreject.tmpl 
	                                                     mail_suggestion_ACCEPTED.tmpl 
	                                                     mail_suggestion_AVAILABLE.tmpl 
	                                                     mail_suggestion_ORDERED.tmpl 
	                                                     mail_suggestion_REJECTED.tmpl 
	intranet/htdocs/intranet-tmpl/default/en/tools: barcodes.tmpl 
	                                                export.tmpl 
	                                                holidays.tmpl 
	                                                import.tmpl 
	                                                koha-news.tmpl 
	                                                letter.tmpl 
	                                                overduerules.tmpl 
	                                                printerConfig.tmpl 
	                                                tools-home.tmpl 
	intranet/htdocs/intranet-tmpl/default/en/value_builder: 
	                                                        marc21_008_holdings.tmpl 
	                                                        marc21_field_006.tmpl 
	                                                        marc21_field_007.tmpl 
	                                                        marc21_field_008.tmpl 
	                                                        marc21_leader.tmpl 
	                                                        marc21_leader_authorities.tmpl 
	                                                        marc21_leader_holdings.tmpl 
	                                                        unimarc_field_100.tmpl 
	                                                        unimarc_field_105.tmpl 
	                                                        unimarc_field_225a.tmpl 
	                                                        unimarc_field_60X.tmpl 
	                                                        unimarc_field_700-4.tmpl 
	                                                        unimarc_field_700_701_702.tmpl 
	intranet/htdocs/intranet-tmpl/default/en/z3950: 
	                                                searchresult.tmpl 
	intranet/htdocs/intranet-tmpl/default/images: 1downarrow.png 
	                                              1leftarrow.png 
	                                              1rightarrow.png 
	                                              1uparrow.png 
	                                              2downarrow.png 
	                                              2leftarrow.png 
	                                              2rightarrow.png 
	                                              2uparrow.png 
	                                              AB.gif AC.gif 
	                                              AF.gif AV.gif 
	                                              AVJ.gif AVJN.gif 
	                                              AVJNF.gif AVNF.gif 
	                                              `Audiobook (cassette).gif' 
	                                              Audiobook.gif 
	                                              BCD.gif BIO.gif 
	                                              BOOK.gif 
	                                              Biography.gif 
	                                              `Book on Tape.gif' 
	                                              CD-R.GIF CD.gif 
	                                              CD_.GIF CHD.gif 
	                                              DVD.gif FIC.gif 
	                                              Fleche.jpg 
	                                              GoogleG.gif JF.gif 
	                                              JNF.gif JRNL.gif 
	                                              POEM.gif REF.gif 
	                                              RES.gif STO.gif 
	                                              VCD.gif VCD_.GIF 
	                                              VHS.gif add.gif 
	                                              addtobasket.gif 
	                                              addtoshelf.gif 
	                                              arrow-big.gif 
	                                              arrow.gif back.gif 
	                                              background-mem.gif 
	                                              background-opac.gif 
	                                              bar.gif basket.gif 
	                                              basket01.gif 
	                                              bg.jpg bg2.jpg 
	                                              blue_down.gif 
	                                              blue_right.gif 
	                                              blue_up.gif 
	                                              book1.gif 
	                                              book2.gif 
	                                              checkall.gif 
	                                              clip.gif cross.gif 
	                                              edittrash.png 
	                                              erase.gif exit.gif 
	                                              filefind.png 
	                                              fileimport.png 
	                                              filenew.png 
	                                              fileopen.gif 
	                                              fileopen.png 
	                                              fileprint.png 
	                                              filesave.png 
	                                              front-arrow.gif 
	                                              front-background-med.gif 
	                                              front-background-small.gif 
	                                              gohome.png 
	                                              help.gif 
	                                              historial.gif 
	                                              imageKoha.jpg 
	                                              key.gif 
	                                              koha-logo.gif 
	                                              less.gif 
	                                              logo_ej.jpg 
	                                              logout.gif 
	                                              lupe.gif m_2_s.gif 
	                                              mail_get.png 
	                                              mail_send.png 
	                                              minus.gif 
	                                              money.gif 
	                                              monog.gif more.gif 
	                                              no_zip.gif 
	                                              nophoto.GIF 
	                                              nophoto.jpg 
	                                              password.gif 
	                                              pdf-cacelled.gif 
	                                              pdf.gif plus.gif 
	                                              print.gif rev.gif 
	                                              spacer.gif 
	                                              square-w.gif 
	                                              ths.gif user.gif 
	                                              valid-xhtml10.png 
	                                              warning.gif 
	                                              warning32x32.gif 
	                                              world1.gif 
	                                              world2.gif zip.gif 
	intranet/htdocs/intranet-tmpl/default/images/Science fiction: 
	                                                              Fantasy.gif 
	intranet/htdocs/intranet-tmpl/default/images/numbers: 
	                                                      1-highlight.gif 
	                                                      1.gif 
	                                                      10-highlight.gif 
	                                                      10.gif 
	                                                      11-highlight.gif 
	                                                      11.gif 
	                                                      12-highlight.gif 
	                                                      12.gif 
	                                                      13-highlight.gif 
	                                                      13.gif 
	                                                      14-highlight.gif 
	                                                      14.gif 
	                                                      15-highlight.gif 
	                                                      15.gif 
	                                                      16-highlight.gif 
	                                                      16.gif 
	                                                      17-highlight.gif 
	                                                      17.gif 
	                                                      18-highlight.gif 
	                                                      18.gif 
	                                                      19-highlight.gif 
	                                                      19.gif 
	                                                      2-highlight.gif 
	                                                      2.gif 
	                                                      20-highlight.gif 
	                                                      20.gif 
	                                                      21-highlight.gif 
	                                                      21.gif 
	                                                      22-highlight.gif 
	                                                      22.gif 
	                                                      23-highlight.gif 
	                                                      23.gif 
	                                                      24-highlight.gif 
	                                                      24.gif 
	                                                      25-highlight.gif 
	                                                      25.gif 
	                                                      26-highlight.gif 
	                                                      26.gif 
	                                                      27-highlight.gif 
	                                                      27.gif 
	                                                      28-highlight.gif 
	                                                      28.gif 
	                                                      29-highlight.gif 
	                                                      29.gif 
	                                                      3-highlight.gif 
	                                                      3.gif 
	                                                      30-highlight.gif 
	                                                      30.gif 
	                                                      31-highlight.gif 
	                                                      31.gif 
	                                                      4-highlight.gif 
	                                                      4.gif 
	                                                      5-highlight.gif 
	                                                      5.gif 
	                                                      6-highlight.gif 
	                                                      6.gif 
	                                                      7-highlight.gif 
	                                                      7.gif 
	                                                      8-highlight.gif 
	                                                      8.gif 
	                                                      9-highlight.gif 
	                                                      9.gif 
	                                                      next.gif 
	                                                      placeholder.gif 
	                                                      prev.gif 
	intranet/htdocs/intranet-tmpl/default/images/numbers/images: 
	                                                             background-opac.gif 
	                                                             front-arrow.gif 
	                                                             front-background-med.gif 
	                                                             front-background-small.gif 
	intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers: 
	                                                                     1-highlight.gif 
	                                                                     1.gif 
	                                                                     10-highlight.gif 
	                                                                     10.gif 
	                                                                     11-highlight.gif 
	                                                                     11.gif 
	                                                                     12-highlight.gif 
	                                                                     12.gif 
	                                                                     13-highlight.gif 
	                                                                     13.gif 
	                                                                     14-highlight.gif 
	                                                                     14.gif 
	                                                                     15-highlight.gif 
	                                                                     15.gif 
	                                                                     16-highlight.gif 
	                                                                     16.gif 
	                                                                     17-highlight.gif 
	                                                                     17.gif 
	                                                                     18-highlight.gif 
	                                                                     18.gif 
	                                                                     19-highlight.gif 
	                                                                     19.gif 
	                                                                     2-highlight.gif 
	                                                                     2.gif 
	                                                                     20-highlight.gif 
	                                                                     20.gif 
	                                                                     21-highlight.gif 
	                                                                     21.gif 
	                                                                     22-highlight.gif 
	                                                                     22.gif 
	                                                                     23-highlight.gif 
	                                                                     23.gif 
	                                                                     24-highlight.gif 
	                                                                     24.gif 
	                                                                     25-highlight.gif 
	                                                                     25.gif 
	                                                                     26-highlight.gif 
	                                                                     26.gif 
	                                                                     27-highlight.gif 
	                                                                     27.gif 
	                                                                     28-highlight.gif 
	                                                                     28.gif 
	                                                                     29-highlight.gif 
	                                                                     29.gif 
	                                                                     3-highlight.gif 
	                                                                     3.gif 
	                                                                     30-highlight.gif 
	                                                                     30.gif 
	                                                                     31-highlight.gif 
	                                                                     31.gif 
	                                                                     4-highlight.gif 
	                                                                     4.gif 
	                                                                     5-highlight.gif 
	                                                                     5.gif 
	                                                                     6-highlight.gif 
	                                                                     6.gif 
	                                                                     7-highlight.gif 
	                                                                     7.gif 
	                                                                     8-highlight.gif 
	                                                                     8.gif 
	                                                                     9-highlight.gif 
	                                                                     9.gif 
	                                                                     next.gif 
	                                                                     placeholder.gif 
	                                                                     prev.gif 
	intranet/modules/C4: AcademicInfo.pm Accounts2.pm Acquisition.pm 
	                     Amazon.pm Auth.pm Auth_with_ldap.pm 
	                     AuthoritiesMarc.pm Biblio.pm Biblioadd.pm 
	                     BookShelves.pm Bookfund.pm Bookseller.pm 
	                     Boolean.pm Breeding.pm Context.pm 
	                     Date-new.pm Date.pm Format.pm Input.pm 
	                     Koha.pm Labels.pm Letters.pm Log.pm 
	                     Members.pm NewsChannels.pm Output.pm 
	                     Print.pm Record.pm Reserves2.pm Review.pm 
	                     SMS.pm Search.pm Serials-new.pm Serials.pm 
	                     Stats.pm Suggestions.pm Z3950.pm 
	intranet/modules/C4/Barcodes: PrinterConfig.pm 
	intranet/modules/C4/Calendar: Calendar.pm 
	intranet/modules/C4/Circulation: Circ2.pm Circ3.pm Fines.pm 
	                                 PrinterConfig.pm 
	intranet/modules/C4/Interface/CGI: Output.pm Template.pm 

Log message:
	removing for a fresh commit to cvs folders

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/routing.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/serial-issues-full.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/serial-issues.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/serials-home.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/serials-receive.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/subscription-add.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/subscription-bib-search.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/subscription-detail.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/subscription-renew.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/serials/viewalerts.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/sms/sms-home.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/suggestion/acceptorreject.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ACCEPTED.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ORDERED.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_REJECTED.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/barcodes.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/export.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/holidays.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/import.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/koha-news.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/letter.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/overduerules.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/printerConfig.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/tools/tools-home.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/marc21_008_holdings.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/marc21_field_006.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/marc21_field_007.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/marc21_field_008.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/marc21_leader.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_authorities.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_holdings.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_105.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_225a.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_60X.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700-4.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700_701_702.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/en/z3950/searchresult.tmpl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/1downarrow.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/1leftarrow.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/1rightarrow.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/1uparrow.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/2downarrow.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/2leftarrow.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/2rightarrow.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/2uparrow.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/AB.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/AC.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/AF.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/AV.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/AVJ.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/AVJN.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/AVJNF.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/AVNF.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/Audiobook%32%40cassette%41.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/Audiobook.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/BCD.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/BIO.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/BOOK.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/Biography.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/Book%32on%32Tape.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/CD-R.GIF?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/CD.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/CD_.GIF?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/CHD.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/DVD.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/FIC.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/Fleche.jpg?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/GoogleG.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/JF.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/JNF.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/JRNL.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/POEM.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/REF.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/RES.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/STO.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/VCD.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/VCD_.GIF?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/VHS.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/add.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/addtobasket.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/addtoshelf.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/arrow-big.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/arrow.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/back.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/background-mem.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/background-opac.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/bar.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/basket.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/basket01.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/bg.jpg?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/bg2.jpg?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/blue_down.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/blue_right.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/blue_up.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/book1.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/book2.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/checkall.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/clip.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/cross.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/edittrash.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/erase.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/exit.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/filefind.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/fileimport.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/filenew.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/fileopen.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/fileopen.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/fileprint.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/filesave.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/front-arrow.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/front-background-med.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/front-background-small.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/gohome.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/help.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/historial.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/imageKoha.jpg?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/key.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/koha-logo.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/less.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/logo_ej.jpg?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/logout.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/lupe.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/m_2_s.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/mail_get.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/mail_send.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/minus.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/money.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/monog.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/more.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/no_zip.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/nophoto.GIF?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/nophoto.jpg?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/password.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/pdf-cacelled.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/pdf.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/plus.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/print.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/rev.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/spacer.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/square-w.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/ths.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/user.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/valid-xhtml10.png?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/warning.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/warning32x32.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/world1.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/world2.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/zip.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/Science%32fiction/Fantasy.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/1-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/1.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/10-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/10.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/11-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/11.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/12-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/12.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/13-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/13.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/14-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/14.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/15-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/15.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/16-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/16.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/17-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/17.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/18-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/18.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/19-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/19.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/2-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/2.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/20-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/20.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/21-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/21.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/22-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/22.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/23-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/23.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/24-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/24.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/25-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/25.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/26-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/26.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/27-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/27.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/28-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/28.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/29-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/29.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/3-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/3.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/30-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/30.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/31-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/31.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/4-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/4.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/5-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/5.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/6-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/6.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/7-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/7.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/8-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/8.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/9-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/9.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/next.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/placeholder.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/prev.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/background-opac.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/front-arrow.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/front-background-med.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/front-background-small.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/1-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/1.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/10-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/10.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/11-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/11.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/12-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/12.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/13-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/13.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/14-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/14.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/15-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/15.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/16-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/16.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/17-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/17.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/18-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/18.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/19-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/19.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/2-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/2.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/20-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/20.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/21-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/21.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/22-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/22.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/23-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/23.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/24-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/24.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/25-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/25.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/26-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/26.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/27-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/27.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/28-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/28.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/29-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/29.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/3-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/3.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/30-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/30.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/31-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/31.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/4-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/4.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/5-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/5.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/6-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/6.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/7-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/7.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/8-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/8.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/9-highlight.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/9.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/next.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/placeholder.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/htdocs/intranet-tmpl/default/images/numbers/images/numbers/prev.gif?cvsroot=koha&only_with_tag=rel_TG&rev=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/AcademicInfo.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Accounts2.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Acquisition.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Amazon.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Auth.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Auth_with_ldap.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/AuthoritiesMarc.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Biblio.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Biblioadd.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/BookShelves.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Bookfund.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Bookseller.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Boolean.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Breeding.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Context.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Date-new.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Date.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Format.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Input.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Koha.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Labels.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Letters.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Log.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Members.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/NewsChannels.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Output.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Print.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Record.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Reserves2.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Review.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/SMS.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Search.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Serials-new.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Serials.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Stats.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Suggestions.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Z3950.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Barcodes/PrinterConfig.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Calendar/Calendar.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Circulation/Circ3.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Circulation/Fines.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Circulation/PrinterConfig.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Interface/CGI/Output.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Interface/CGI/Template.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=0

Patches:
Index: htdocs/intranet-tmpl/default/en/serials/routing.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/routing.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/routing.tmpl
--- htdocs/intranet-tmpl/default/en/serials/routing.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
-
-
-
-<script language="javascript" type="text/javascript">
-<!--
-
-function reorder_item(sid,rid,rank){
-    var mylocation = 'reorder_members.pl?subscriptionid='+sid+'&routingid='+rid+'&rank='+rank;
-    window.location.href=mylocation; 
-}
-//-->
-</script>
-
-<div id="main">
-<!-- TMPL_IF NAME="op" -->
-<h1>Create Routing List</h1>
-<!-- TMPL_ELSE -->
-<h1>Edit Routing List</h1>
-<!-- /TMPL_IF -->
-
-<form method="post" action="routing.pl">
-<input type="hidden" name="op" value="save" />
-<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR NAME="subscriptionid" -->" />
-<p><b>Serial Title:</b> <!-- TMPL_VAR NAME="title" --></p>
-<p><b>Issue:</b> 
-
-<select name="date_selected">
-<!-- TMPL_LOOP NAME="dates" -->
-<option value="<!-- TMPL_VAR NAME="serialseq" --> (<!-- TMPL_VAR NAME="planneddate" -->)" <!-- TMPL_IF NAME="selected" --> selected="SELECTED" <!-- /TMPL_IF -->><!-- TMPL_VAR NAME="serialseq" --> (<!-- TMPL_VAR NAME="planneddate" -->)</option>
-<!-- /TMPL_LOOP -->
-</select>
-
-
-<!-- TMPL_VAR NAME="issue" --></p>
-
-<!-- TMPL_IF NAME="memberloop" -->
-<table border="0" cellspacing="0" cellpadding="0">
-<tr valign="top"><td style="padding-top:5px;"><b>List Member:</b>&nbsp;</td>
-    <td><table cellspacing="0" cellpadding="0" border="0" class="collapse">
-        <tr><td class="cell-header">Name</td>
-            <td class="cell-header">Location</td>
-            <td class="cell-header">Rank</td>
-            <td class="cell-header">Delete</td></tr>
-<!-- TMPL_LOOP NAME="memberloop" -->
-        <tr><td class="cell"><!-- TMPL_VAR NAME="name" --></td>
-            <td class="cell"><!-- TMPL_VAR NAME="location" --></td>
-            <td class="cell"><!-- TMPL_VAR NAME="routingbox" --></td>
-            <td class="cell"><a href="/cgi-bin/koha/serials/routing.pl?routingid=<!-- TMPL_VAR NAME="routingid" -->&amp;subscriptionid=<!-- TMPL_VAR NAME="subscriptionid" -->&amp;op=delete">Delete</a></td></tr>
-<!-- /TMPL_LOOP -->
-        <tr><td colspan="4"><br /><a onclick="search_member(<!-- TMPL_VAR
-NAME="subscriptionid" -->); return false"
-href="/cgi-bin/koha/serials/member-search.pl?subscriptionid=<!-- TMPL_VAR
-NAME="subscriptionid" -->" class="button">Add List Member</a> &nbsp; <a
-href="/cgi-bin/koha/serials/routing.pl?subscriptionid=<!-- TMPL_VAR NAME="subscriptionid" -->&amp;op=delete" class="button">Delete All</a></td></tr>
-        </table></td></tr>
-
-<!-- TMPL_ELSE -->
-<table border="0" cellspacing="0" cellpadding="0">
-<tr><td><b>List Member:&nbsp;</b></td>
-    <td><p><a onclick="search_member(<!-- TMPL_VAR NAME="subscriptionid"
--->); return false" href="/cgi-bin/koha/serials/member-search.pl?subscriptionid=<!-- TMPL_VAR NAME="subscriptionid" -->" class="button">Add List Member</a></p></td></tr>
-<!-- /TMPL_IF -->
-<tr><td valign="top" colspan="2">&nbsp;</td></tr>
-<tr><td valign="top"><b>Notes:</b></td>
-    <td><textarea name="notes" rows="3" cols="50"><!-- TMPL_VAR NAME="routingnotes" --></textarea></td></tr>
-<tr><td></td>
-    <td><input type="submit" name="submit" class="button" value="Save" /></td></tr>
-</table>
-</form>
-</div>
-<script type="text/javascript">
-<!--
-
-function search_member(subscriptionid){
-    var myurl = 'member-search.pl?subscriptionid='+subscriptionid; window.open(myurl,'FindAMember','width=500,height=400,toolbar=no,scrollbars=yes');
-}
-//-->
-</script>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/serials/serial-issues-full.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/serial-issues-full.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/serial-issues-full.tmpl
--- htdocs/intranet-tmpl/default/en/serials/serial-issues-full.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
-
-
-<div id="main">
-<!-- TMPL_UNLESS name="popup" -->
-	<h1 class="serial">Subscription information for biblio #<!-- TMPL_VAR NAME="biblionumber" --> with title : <!-- TMPL_VAR name="bibliotitle" --></h1>
-	<p>
-	<a href="opac-detail.pl?bib=<!-- TMPL_VAR name="biblionumber" -->" class="button serial">Back to biblio</a>
-<!-- /TMPL_UNLESS -->
-	<!-- TMPL_LOOP NAME="years" -->
-		<!-- TMPL_IF NAME="year" -->
-			<a  class="button serial" href="javascript:active(<!-- TMPL_VAR NAME="year" -->)"><!-- TMPL_VAR NAME="year" --></a>
-		<!-- /TMPL_IF -->
-	<!-- /TMPL_LOOP -->
-	<a class=" button serial" href="serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->&selectview=small">Compact view</a>
-	</p>
-	<!-- TMPL_LOOP NAME="years" -->
-	<div name="<!-- TMPL_VAR NAME="year" -->" id="<!-- TMPL_VAR NAME="year" -->" style="position:absolute; visibility:hidden; margin-top:0px; border:4px;" <!--TMPL_IF Name="first" -->style="visibility:visible"<!--/TMPL_IF -->>
-		<table>
-			<tr>
-				<th class="serial">Information
-				</th>
-				<th class="serial">Date
-				</th>
-				<th class="serial">Number
-				</th>
-				<th class="serial">Status
-				</th>
-			</tr>
-			<!-- TMPL_LOOP Name="serials" -->
-			<tr>
-				<td>
-					<!-- TMPL_VAR name="notes" -->
-				</td>
-				<td>
-					<!-- TMPL_VAR Name="planneddate" -->
-				</td>
-				<td>
-					<!-- TMPL_VAR Name="serialseq" -->
-				</td>
-				<td>
-					<!-- TMPL_IF Name="status1" -->Arrived<!-- /TMPL_IF -->
-					<!-- TMPL_IF Name="status2" -->Waited<!-- /TMPL_IF -->
-					<!-- TMPL_IF Name="status3" -->Late<!-- /TMPL_IF -->
-					<!-- TMPL_IF Name="status4" -->Missing<!-- /TMPL_IF -->
-				</td>
-			</tr>
-			<!-- /TMPL_LOOP -->
-		</table>
-	</div>
-</div>
-	<!--/TMPL_LOOP -->
-<script language="JavaScript" type="text/javascript">
-active(<!-- TMPL_VAR name="yearmin" -->);
-function active(numlayer)
-{
-	for (i=<!--TMPL_VAR Name="yearmin"-->; i<=<!--TMPL_VAR Name="yearmax"-->; i++ ) {
-		ong = i;
-		link = "link"+i;
-		if (numlayer==i) {
-			document.getElementById(ong).style.visibility="visible";
-		} else {
-			document.getElementById(ong).style.visibility="hidden";
-		}
-	}
-}
-
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/serials/serial-issues.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/serial-issues.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/serial-issues.tmpl
--- htdocs/intranet-tmpl/default/en/serials/serial-issues.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,109 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
-
-<div id="main">
-
-<h1>Issues for a subscription</h1>
-<!-- TMPL_LOOP name="subscription_LOOP" -->
-	<div id="serials_serial_issue_<!-- TMPL_VAR name="subscriptionid" -->">
-		<h2>Subscription information for <!-- TMPL_VAR name="bibliotitle" --></h2>
-		<p>It began on <b><!-- TMPL_VAR name="histstartdate" --></b> and is issued every
-		<b>
-		<!--TMPL_IF name="periodicity1" -->
-				day
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity2" -->
-				week
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity3" -->
-				2 weeks
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity4" -->
-				3 weeks
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity5" -->
-				month
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity6" -->
-				2 months
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity7" -->
-				3 months
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity8" -->
-				quarter
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity9" -->
-				2 quarters
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity10" -->
-				year
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity11" -->
-				2 years
-		<!-- /TMPL_IF -->
-		</b>
-		<!--TMPL_IF name="arrival1" -->
-			on <b>monday</b>
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="arrival2" -->
-			on <b>tuesday</b>
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="arrival3" -->
-			on <b>wednesday</b>
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="arrival4" -->
-			on <b>thursday</b>
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="arrival5" -->
-			on <b>friday</b>
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="arrival6" -->
-			on <b>saturday</b>
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="arrival7" -->
-			on <b>sunday</b>
-		<!-- /TMPL_IF -->
-		for <b>
-			<!-- TMPL_IF name="numberlength" --><!-- TMPL_VAR name="numberlength" --> issues<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="weeklength" --><!-- TMPL_VAR name="weeklength" --> weeks<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="monthlength" --><!-- TMPL_VAR name="monthlength" --> months<!-- /TMPL_IF -->
-			</b>
-		</p>
-		<p>Last renewal of subscription was <b><!-- TMPl_VAR name="startdate" --></b></p>
-		<!-- TMPL_IF name="enddate" --><p><b>This subscription is now ended. The last issue was received on <!-- TMPL_VAR name="enddate" --></b></p><!-- /TMPL_IF name="enddate" -->
-	<!--TMPL_UNLESS Name=fullinfo -->
-		<p><!-- TMPL_VAR name="notes" --></p>
-		<!-- TMPL_IF name="opacnote" -->
-			<h3 class="serial">Issues summary</h2>
-			<p>
-				<!-- TMPL_VAR name="opacnote" -->
-			</p>
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="receivedlist" -->
-			<h3 class="serial">received issues</h2>
-			<p>
-				<!-- TMPL_VAR name="receivedlist" -->
-			</p>
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="missinglist" -->
-			<h3 class="serial">Missing issues</h2>
-			<p>
-				<!-- TMPL_VAR name="missinglist" -->
-			</p>
-		<!-- /TMPL_IF -->
-	</div>
-	<!-- /TMPL_UNLESS -->
-<!-- /TMPL_LOOP -->
-
-<div id="action">
-	
-	<form action="/cgi-bin/koha/serials/serial-issues.pl">
-		<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->">
-		<input type="hidden" name="selectview" value="full">
-		<input type="submit" value="Complete view">
-	</form>
-</div>
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/serials/serials-home.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/serials-home.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/serials-home.tmpl
--- htdocs/intranet-tmpl/default/en/serials/serials-home.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
-
-<div id="main">
-
-<h1>Serials</h1>
-<div id="serials_home">
-	<h2>Serials subscriptions</h2>
-<!-- TMPL_IF NAME="routing" -->
-        <h3>Search for Serial Routing List</h3>
-<!-- /TMPL_IF -->
-
-    <table>
-        <tr><th>Supplier Id</th>
-<th>Biblionumber</th>
-            <th>ISSN</th>
-            <th>Title</th>
-            <th>
-                Note
-            </td>
-            <th colspan=2>&nbsp;</th>
-        </tr>
-        <tr>
-            <form action="serials-home.pl" method="post">
-            <!-- TMPL_IF NAME="routing" -->
-                <input type="hidden" name="routing" value="<!-- TMPL_VAR NAME="routing" -->" />
-            <!-- /TMPL_IF -->
-            <input type="hidden" name="searched" value="1" />
-	<td>
-                <input type="text" size=10 maxlength=15 name="supplierid" value="<!-- TMPL_VAR name="supplierid" -->" title="type biblionumber here to filter subscription">
-            </td>
-	<td>
-                <input type="text" size=10 maxlength=15 name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->" title="type biblionumber here to filter subscription">
-            </td>
-            <td>
-                <input type="text" size=10 maxlength=11 name="ISSN" value="<!-- TMPL_VAR name="ISSN" -->" title="type ISSN here to filter subscription">
-            </td>
-            <td>
-                <input type="text" size=40 maxlength=40 name="title" value="<!-- TMPL_VAR name="title" -->" title="type a title -complete or partial- to filter subscription">
-            </td>
-            <td>
-                &nbsp;
-            </td>
-            <td colspan=2>
-                <input type="submit" value="filter" class="button serial" title="set a filter on ISSN / title">
-            </td>
-        </tr>
-        <!-- TMPL_LOOP name="subscriptions" -->
-	 <!-- TMPL_IF name="toggle" -->
-            <tr class="hilighted">
-                <!-- TMPL_ELSE -->
-	<tr>
-	          <!-- /TMPL_IF -->
-                 <td><!-- TMPL_VAR name="aqbooksellerid" --></td>   
-               <td><a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->" class="button serial" title="Biblio"><!-- TMPL_VAR name="biblionumber" --></a></td>
-       <td>
-                <!-- TMPL_IF name="ISSN" -->
-                   <a href="serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->" class="button serial" title="Issues history"><!-- TMPL_VAR name="ISSN" --></a>   
-                <!-- /TMPL_IF -->
-             </td>
-               
-                    <td>
-            
-                <!-- TMPL_IF name="title" -->
-                    <!-- TMPL_VAR name="title" -->
-                <!-- TMPL_ELSE -->
-                    |
-                <!-- /TMPL_IF -->
-                </td>
-                
-                    <td>
-             
-                <!-- TMPL_IF name="notes" -->(<!-- TMPL_VAR name="notes" -->)<!-- /TMPL_IF -->
-                </td>
-                <!-- TMPL_IF NAME="routing" -->
-                        <td>
-                        <a href="routing.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" --><!-- TMPL_UNLESS NAME="routingedit" -->&op=new<!-- /TMPL_UNLESS -->">Routing List</a>
-                    </td>
-                <!-- TMPL_ELSE -->
-                            <td>
-                            <a href="subscription-detail.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->" class="button serial" title="subscription detail">Detail</a>
-                        </td>
-                            <td>
-                            <a href="serials-receive.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->" class="button serial" title="receive issues for this subscription">Receive</a>
-                        </td>
-                <!-- /TMPL_IF -->
-
-            </tr>
-        <!-- /TMPL_LOOP -->
-    </table>
-    
-    <!-- TMPL_IF NAME="routing" -->
-    <!-- TMPL_ELSE -->
-        <!-- TMPL_IF NAME="alt_links" -->
-            <a href="/cgi-bin/koha/serials/alt_subscription-add.pl" class="button serial">Add subscription</a>	      
-        <!-- TMPL_ELSE -->      
-            <a href="/cgi-bin/koha/serials/subscription-add.pl" class="button serial">Add subscription</a>
-        <!-- /TMPL_IF -->
-    <!-- /TMPL_IF -->
-</div>
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
-

Index: htdocs/intranet-tmpl/default/en/serials/serials-receive.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/serials-receive.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/serials-receive.tmpl
--- htdocs/intranet-tmpl/default/en/serials/serials-receive.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,187 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
-
-
-
-<!--------------------------MAIN BODY OF PAGE-------------------------->
-<div id="main">
-<h1 class="serial">Subscription for <!-- TMPL_VAR name="bibliotitle" --></h1>
-<a href="subscription-detail.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->" class="button serial" title="detail of the subscription">Subscription</a>
-<a href="/cgi-bin/koha/serials/serials-home.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->" class="button serial" title="all subscriptions on <!-- TMPL_VAR name="title" -->">Subscriptions</a>
-<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->" class="button serial" title="go to <!-- TMPL_VAR name="title" -->">Back to biblio</a>
-
-<div id="bloc25">
-<h2 class="serial">waited or late numbers</h2>
-    <form method="post" name="f" id="f" action="serials-receive.pl">
-        <input type="hidden" name="op" value="serialchangestatus">
-        <input type="hidden" name="serial" value="<!-- TMPL_VAR name="serial" -->">
-        <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->">
-        <input type="hidden" name="user" value="<!-- TMPL_VAR name="user" -->">
-    <table class="small">
-    <tr>
-        <th class="serial">
-            Numbered
-        </th>
-       <th class="serial">
-            Published on
-        </th>	
-        <th class="serial">
-            Planned for
-        </th>
-        <th class="serial">
-            Status
-        </th>
-        <th class="serial">
-            Notes
-        </th>
-    </tr>
-    <!-- TMPL_LOOP name="serialslist" -->
-        <tr>
-            <td>
-                <input type="text" name="serialseq" value="<!-- TMPL_VAR name="serialseq" -->" size=30 maxlength=100>
-            </td>
-	  <td>
-                <input type="text" name="publisheddate" value="<!-- TMPL_VAR name="publisheddate" -->" size=10 maxlength=15>
-            </td>
-            <td>
-                <input type="text" name="planneddate" value="<!-- TMPL_VAR name="planneddate" -->" size=10 maxlength=15>
-            </td>
-            <td>
-                <input type="hidden" id="serialidnumber" name="serialid" value="<!-- TMPL_VAR name="serialid" -->">
-                <select name="status" size="1"   <!--TMPL_IF name="serialsadditems" -->onChange="javascript:AddItemRefresh();"<!--/TMPL_IF-->>
-                    <!--TMPL_IF name="status1" -->
-                        <option value="1" selected>Waited</option>
-                    <!-- /TMPL_IF -->
-                    <!--TMPL_IF name="status2" -->
-                        <option value="2" selected>Arrived</option>
-                    <!-- TMPL_ELSE -->
-                        <option value="2">Arrived</option>
-                    <!-- /TMPL_IF -->
-                    <!--TMPL_IF name="status3" -->
-                        <option value="3" selected>Late</option>
-                    <!-- TMPL_ELSE -->
-                        <option value="3">Late</option>
-                    <!-- /TMPL_IF -->
-                    <!--TMPL_IF name="status4" -->
-                        <option value="4" selected>Missing</option>
-                    <!-- TMPL_ELSE -->
-                        <option value="4">Missing</option>
-                    <!-- /TMPL_IF -->
-                    <!--TMPL_IF name="status5" -->
-                        <option value="5" selected>Not published</option>
-                    <!-- TMPL_ELSE -->
-                        <option value="5">Not published</option>
-                    <!-- /TMPL_IF -->
-                    <!--TMPL_IF name="status6" -->
-                        <option value="6" selected>Delete</option>
-                    <!-- TMPL_ELSE -->
-                        <option value="6">Delete</option>
-                    <!-- /TMPL_IF -->
-                </select>
-            </td>
-            <td>
-                <input type="text" name="notes" value="<!-- TMPL_VAR name="notes" -->" size=20 maxlength=255>
-            </td>
-<!--TMPL_IF name="serialsadditems" -->
-	<td>    <input type="hidden" id="serial<!-- TMPL_VAR name="serialid" -->" name="itemnumber" value="<!-- TMPL_VAR name="itemnumber" -->" />
-		<input type="hidden" id="holdingbranch<!-- TMPL_VAR name="serialid" -->" name="holdingbranch" value="" />
-	             <a  style="display:none;" href="javascript:AddItem('<!-- TMPL_VAR name="scriptaddserials" -->',<!-- TMPL_VAR name="serialid" -->)" name="addbutton" class="button serial" onblur="javascript:AddItemRefresh();">Add item</a>
-	</td>
-<!--/TMPL_IF-->     
-            <td>
-                <a href="javascript:PrintList(<!-- TMPL_VAR name="subscriptionid" -->,'<!-- TMPL_VAR name="serialseq" -->')" class="button serial">print</a>
-            </td>
-        </tr>
-    <!-- /TMPL_LOOP -->
-    <!-- TMPL_UNLESS name="hassubscriptionexpired" -->
-        <tr>
-            <td>
-                Manual issue <input type="text" name="serialseq" size=30 maxlength=100>
-            </td>
- <td>
-                <input type="text" name="publisheddate" size=10 maxlength=15>
-            </td>
-            <td>
-                <input type="text" name="planneddate" size=10 maxlength=15>
-            </td>
-            <td>
-                <input type="hidden" name="serialid" value="0">
-                <select name="status" size="1" <!--TMPL_IF name="serialsadditems" -->onChange="javascript:AddItemRefresh();"<!--/TMPL_IF-->>
-                        <option value="2">Arrived</option>
-                        <option value="3" selected>Late</option>
-                        <option value="4">Missing</option>
-                </select>
-            </td>
-      <!--TMPL_IF name="serialsadditems" -->
-	<td>    <input type="hidden" id="serial0" name="itemnumber" value="0" />
-		<input type="hidden" id="holdingbranch0" name="holdingbranch" value="" />
-	             <a  style="display:none;" href="javascript:AddItem('<!-- TMPL_VAR name="scriptaddserials" -->',0)" name="addbutton" class="button serial" onblur="javascript:AddItemRefresh();">Add item</a>
-	</td>
-<!--/TMPL_IF-->   
-	
-   </tr>
-	
-    <!-- /TMPL_UNLESS -->
-    </table>
-    <input type="submit" value="Save changes" accesskey="w" class="button serial">
-    <!-- TMPL_IF name="hassubscriptionexpired" -->
-        <p>Subscription has expired. Waited last issue status can't be changed. <a href="#" onClick="popup()" class="button serial">Renew</a> your subscription</p>
-    <!-- /TMPL_IF -->
-    </form>
-</div>
-
-<div id="bloc25">
-    <h2 class="serial">Subscription summary</h2>
-    <form method="post" name="f" action="serials-receive.pl">
-        <input type="hidden" name="op" value="modsubscriptionhistory">
-        <input type="hidden" name="serial" value="<!-- TMPL_VAR name="serial" -->">
-        <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->">
-        <input type="hidden" name="user" value="<!-- TMPL_VAR name="user" -->">
-        <p><label>Librarian</label><!-- TMPL_VAR name="user" --></p>
-        <p><label class="label100">Beginning date (*)</label><input type="text" name="histstartdate" value="<!-- TMPL_VAR name="histstartdate" -->"></p>
-        <p><label class="label100">End date</label><input type="text" name="enddate" value="<!-- TMPL_VAR name="enddate" -->"></p>
-        <p>received issues</p>
-        <p>&nbsp;<textarea name="receivedlist" COLS=60 ROWS=5><!-- TMPL_VAR name="receivedlist" --></textarea></p>
-        <p>Missing issues</p>
-        <p>&nbsp;<textarea name="missinglist" COLS=60 ROWS=2><!-- TMPL_VAR name="missinglist" --></textarea></p>
-        <!--TMPL_IF Name="notissuedlist"-->
-        <p>Not issued</p>
-        <p>&nbsp;<textarea name="notissuedlist" COLS=60 ROWS=2><!-- TMPL_VAR name="notissuedlist" --></textarea></p>
-        <!--/TMPL_IF-->
-        <p>Opac's note</p>
-        <p>&nbsp;<textarea name="opacnote" COLS=60 ROWS=5><!-- TMPL_VAR name="opacnote" --></textarea></p>
-        <input type="submit" value="Save changes" class="button serial">
-    </form>
-</div>
-
-</table>
-<script language="JavaScript" type="text/javascript">
-
-function popup() {
-     window.open("subscription-renew.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid">","subscription_renewal",'width=700,height=400,toolbar=false,scrollbars=yes');
-}
-function AddItem(itemscript,serial) {
-     window.open(itemscript+serial,"AddItem",'width=700,height=400,toolbar=no,scrollbars=yes,status=yes');
-
-}
-function PrintList(subscriptionid,serialseq) {
-
-    window.open("printlist.pl?subscriptionid="+subscriptionid+"&serialseq="+serialseq);
-}
-function AddItemRefresh(){
-var subf=document.getElementsByName('status');
-var adder=document.getElementsByName('addbutton');
-var itemnos=document.getElementsByName('itemnumber');
-     for (var s=0; s<subf.length; s++ ){
-	if (subf.item(s).value == 2 && itemnos.item(s).value==0){
-	adder.item(s).style.display = 'block';
-	}else{
-	adder.item(s).style.display = 'none';
-	}
-     }
-}
-
-</script>
-<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/serials/subscription-add.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/subscription-add.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/subscription-add.tmpl
--- htdocs/intranet-tmpl/default/en/serials/subscription-add.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,1023 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscription edit<!--TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
-
-
-<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-system.css">
-
-
-<script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/includes/calendar/calendar.js"></script>
-<script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/includes/calendar/calendar-en.js"></script>
-<script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/includes/calendar/calendar-setup.js"></script>
-<!-- **************************************************** -->
-
-
-<script type="text/javascript" language="javascript">
-// the english words used in display purposes
-var text = new Array('Number','Volume','Issue','Month','Week','Starting with:','Rollover at:','Choose Hemisphere:','Northern','Southern',
-'Autumn','Winter','Spring','Summer','Fall','Season','Year');
-var is_season = 0;
-var is_hemisphere = 1;
-
-// common pre defined number patterns
-function num_pattern() {
-var patternchoice = document.getElementById("numberpattern").value;
-	switch(patternchoice){
-	case "2":
-	 	document.f.add1.value=1;
-	 	document.f.add2.value=1;
-	 	document.f.add3.value=1;
-		document.f.every1.value=12;
-		document.f.every2.value=1;
-		document.f.every3.value=1;
-		document.f.whenmorethan1.value=9999999;
-		document.f.whenmorethan2.value=12;
-		document.f.whenmorethan3.value=4;
-		document.f.setto1.value=0;
-		document.f.setto2.value=1;
-		document.f.setto3.value=1;
-		document.f.lastvalue1.value=1;
-		document.f.lastvalue2.value=1;
-		document.f.lastvalue3.value=1;
-		document.f.numberingmethod.value='Vol {X}, No {Y}, Issue {Z}';
-		moreoptions(text[1],text[0],text[2]);
-		display_table(0); // toggle info box on (1) or off (0)
-		break;
-	case "3":
-	 	document.f.add1.value=1;
-	 	document.f.add2.value=1;
-	 	document.f.add3.value='';
-		document.f.every1.value=12;
-		document.f.every2.value=1;
-		document.f.every3.value='';
-		document.f.whenmorethan1.value=9999999;
-		document.f.whenmorethan2.value=12;
-		document.f.whenmorethan3.value='';
-		document.f.setto1.value=0;
-		document.f.setto2.value=1;
-		document.f.setto3.value='';
-		document.f.lastvalue1.value=1;
-		document.f.lastvalue2.value=1;
-		document.f.lastvalue3.value='';
-		document.f.numberingmethod.value='Vol {X}, No {Y}';
-		moreoptions(text[1],text[0]);
-		display_table(0);
-		break;
-	case "4":
-	 	document.f.add1.value=1;
-	 	document.f.add2.value=1;
-	 	document.f.add3.value='';
-		document.f.every1.value=12;
-		document.f.every2.value=1;
-		document.f.every3.value='';
-		document.f.whenmorethan1.value=9999999;
-		document.f.whenmorethan2.value=12;
-		document.f.whenmorethan3.value='';
-		document.f.setto1.value=0;
-		document.f.setto2.value=1;
-		document.f.setto3.value='';
-		document.f.lastvalue1.value=1;
-		document.f.lastvalue2.value=1;
-		document.f.lastvalue3.value='';
-		document.f.numberingmethod.value='Vol {X}, Issue {Y}';
-		moreoptions(text[1],text[2]);
-		display_table(0);
-		break;
-	case "5":
-	 	document.f.add1.value=1;
-	 	document.f.add2.value=1;
-	 	document.f.add3.value='';
-		document.f.every1.value=12;
-		document.f.every2.value=1;
-		document.f.every3.value='';
-		document.f.whenmorethan1.value=9999999;
-		document.f.whenmorethan2.value=12;
-		document.f.whenmorethan3.value='';
-		document.f.setto1.value=0;
-		document.f.setto2.value=1;
-		document.f.setto3.value='';
-		document.f.lastvalue1.value=1;
-		document.f.lastvalue2.value=1;
-		document.f.lastvalue3.value='';
-		document.f.numberingmethod.value='No {X}, Issue {Y}';
-		moreoptions(text[0],text[2]);
-		display_table(0);
-		break;
-	case "6":
-		var d = new Date();
-		var sYear = d.getFullYear();
-	 	document.f.add1.value=1;
-	 	document.f.add2.value='1';
-	 	document.f.add3.value='';
-		document.f.every1.value=4;
-		document.f.every2.value='1';
-		document.f.every3.value='';
-		document.f.whenmorethan1.value=9999999;
-		document.f.whenmorethan2.value='4';
-		document.f.whenmorethan3.value='';
-		document.f.setto1.value=0;
-		document.f.setto2.value='1';
-		document.f.setto3.value='';
-		document.f.lastvalue1.value=sYear;
-		document.f.lastvalue2.value='1';
-		document.f.lastvalue3.value='';
-		document.f.periodicity.value='8';
-		document.f.numberingmethod.value='{Y} {X}';
-		moreoptions_seasons(text[15],sYear);
-		display_table(0);
-		is_season = 1;
-		break;
-	case "7":
-		display_table(1);
-		document.f.irreg_check.value=1; 
-		break;
-	default:
-	 	document.f.add1.value=1;
-	 	document.f.add2.value='';
-	 	document.f.add3.value='';
-		document.f.every1.value=1;
-		document.f.every2.value='';
-		document.f.every3.value='';
-		document.f.whenmorethan1.value=9999999;
-		document.f.whenmorethan2.value='';
-		document.f.whenmorethan3.value='';
-		document.f.setto1.value=0;
-		document.f.setto2.value='';
-		document.f.setto3.value='';
-		document.f.lastvalue1.value=1;
-		document.f.lastvalue2.value='';
-		document.f.lastvalue3.value='';
-		document.f.numberingmethod.value='{X}';
-		moreoptions_daily_check(text[0]);
-		document.f.irreg_check.value=1;
-		display_table(0);
-		break;
-	}
-}
-
-function display_table(n) {
-	if(n==1){
-		document.getElementById("basetable").style.display = 'block';
-	} else {
-		document.getElementById("basetable").style.display = 'none';
-	}
-}
-
-function modify_num_pattern() {
-	document.getElementById("numberpattern").value = '<!-- TMPL_VAR NAME="numberpattern" -->';
-	num_pattern();
-	
-	document.f.add1.value='<!-- TMPL_VAR NAME="add1" -->';
-	document.f.add2.value='<!-- TMPL_VAR NAME="add2" -->';
-	document.f.add3.value='<!-- TMPL_VAR NAME="add3" -->';
-	document.f.every1.value='<!-- TMPL_VAR NAME="every1" -->';
-	document.f.every2.value='<!-- TMPL_VAR NAME="every2" -->';
-	document.f.every3.value='<!-- TMPL_VAR NAME="every3" -->';
-	document.f.whenmorethan1.value='<!-- TMPL_VAR NAME="whenmorethan1" -->';
-	document.f.whenmorethan2.value='<!-- TMPL_VAR NAME="whenmorethan2" -->';
-	document.f.whenmorethan3.value='<!-- TMPL_VAR NAME="whenmorethan3" -->';
-	document.f.setto1.value='<!-- TMPL_VAR NAME="setto1" -->';
-	document.f.setto2.value='<!-- TMPL_VAR NAME="setto2" -->';
-	document.f.setto3.value='<!-- TMPL_VAR NAME="setto3" -->';
-	document.f.lastvalue1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
-	document.f.lastvalue2.value='<!-- TMPL_VAR NAME="lastvalue2" -->';
-	document.f.lastvalue3.value='<!-- TMPL_VAR NAME="lastvalue3" -->';
-	document.f.numberingmethod.value='<!-- TMPL_VAR NAME="numberingmethod" -->';
-
-	var more_strY;
-	var more_strZ;
-	<!-- TMPL_IF NAME="add2" -->
-	if(<!-- TMPL_VAR NAME="add2" --> > 0){
-		more_strY="Y";
-	}
-	<!-- /TMPL_IF -->
-	<!-- TMPL_IF NAME="add3" -->
-	if(<!-- TMPL_VAR NAME="add3" --> > 0){
-		more_strZ="Z";
-	}
-	<!-- /TMPL_IF -->
-
-	document.f.lastvaluetemp1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
-	if(more_strY){
-		document.f.lastvaluetemp2.value='<!-- TMPL_VAR NAME="lastvalue2" -->';
-	document.f.whenmorethantemp2.value='<!-- TMPL_VAR NAME="whenmorethan2" -->';
-	}
-	if(more_strZ){
-		document.f.lastvaluetemp3.value='<!-- TMPL_VAR NAME="lastvalue3" -->';
-	document.f.whenmorethantemp3.value='<!-- TMPL_VAR NAME="whenmorethan3" -->';
-	}
-}
-
-// a pre check with more options to see if 'number' and '1/day' are chosen
-function moreoptions_daily_check(x) {
-	var periodicity = document.f.periodicity.value;
-	var errortext='';
-	if(periodicity == 1){
-		document.getElementById("irregularity").innerHTML = '';
-		document.getElementById("more_options").innerHTML = '';
-		var daynames = new Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
-		errortext ="Please indicate which days of the week you <b>DO NOT<\/b> expect to receive issues.<br \/>";
-		for(var j=0;j<daynames.length;j++){
-			errortext +="<input type='checkbox' name='irregular' id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+daynames[j]+" &nbsp; ";
-		}
-	var error = errortext;
-	document.getElementById("irregularity").innerHTML = error;
-	} else {
-		document.getElementById("irregularity").innerHTML = '';
-		document.getElementById("more_options").innerHTML = '';
-		moreoptions(x);
-	}
-}
-
-// to dispaly the more options section
-function moreoptions(x,y,z){
-document.getElementById("irregularity").innerHTML = '';
-document.getElementById("more_options").innerHTML = '';
-var textbox = '';
-	// alert("X: "+x+"Y: "+y+"Z: "+z);
-	if(x){
-		textbox +="<table>\n<tr><td>&nbsp;<\/td><td>"+x+"<\/td>";
-		if(y){
-			textbox +="<td>"+y+"<\/td>";
-			if(z){
-				textbox +="<td>"+z+"<\/td>";
-			}
-		}
-		textbox +="<\/tr>\n";
-		textbox +="<tr><td>"+text[5]+"<\/td><td><input type='text' name='lastvaluetemp1' size='4' onkeyup='moreoptionsupdate(\"lastvalue1\")'><\/td>\n";
-		if(y){
-			textbox +="<td><input type='text' name='lastvaluetemp2' size='4' onkeyup='moreoptionsupdate(\"lastvalue2\")'><\/td>\n";
-			if(z){
-				textbox +="<td><input type='text' name='lastvaluetemp3' size='4' onkeyup='moreoptionsupdate(\"lastvalue3\")'><\/td>\n";
-			}
-		}
-		textbox +="<\/tr>\n";
-		if(y){
-			textbox +="<tr><td>"+text[6]+"<\/td>";
-			textbox +="<td><a href='javascript:irregularity_check()'>Irregularity?<\/a><\/td>\n";
-			textbox +="<td><input type='text' name='whenmorethantemp2' size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
-			if(z){
-				textbox +="<td><input type='text' name='whenmorethantemp3' size='4' onkeyup='moreoptionsupdate(\"whenmorethan3\",1)'><\/td>\n";
-			}
-			textbox +="<\/tr>";
-		}
-		textbox +="<\/table>\n";
-	}
-	document.getElementById("more_options").innerHTML = textbox;
-}
-
-function hemispheres(chosen){
-var selbox = document.getElementById("season1");
-    if(selbox){
-	var selboxselected = selbox.options[selbox.selectedIndex].value;
-	selbox.options.length = 0;
-
-	if (chosen == "1") {
-		selbox.options[selbox.options.length] = new Option(text[11],'1');
-		selbox.options[selbox.options.length] = new Option(text[12],'2');
-		selbox.options[selbox.options.length] = new Option(text[13],'3');
-		selbox.options[selbox.options.length] = new Option(text[14],'4');
-		is_hemisphere = 1;
-		selbox.options[selboxselected-1].selected = true;
-	}
-
-	if (chosen == "2") {
-		selbox.options[selbox.options.length] = new Option(text[13],'1');
-		selbox.options[selbox.options.length] = new Option(text[10],'2');
-		selbox.options[selbox.options.length] = new Option(text[11],'3');
-		selbox.options[selbox.options.length] = new Option(text[12],'4');
-		is_hemisphere = 2;
-		selbox.options[selboxselected-1].selected = true;
-	}
-    }
-}
-
-// to dispaly the more options section for seasons
-function moreoptions_seasons(x,y){
-document.getElementById("irregularity").innerHTML = '';
-document.getElementById("more_options").innerHTML = '';
-var textbox = '';
-	// alert("X: "+x+"Year: "+y);
-	if(x){
-		var hemi_select = parseInt('<!-- TMPL_VAR NAME="hemisphere" -->');
-		textbox +="<table>\n<tr><td>"+ text[7]  +"<\/td><td colspan='2'><select name='hemisphere' onchange='hemispheres(this.options[this.selectedIndex].value)'>";
-		for(var i = 1; i <= 2; i++){
-			textbox +="<option value='"+i+"'";
-			if(i == hemi_select){
-				textbox += " selected "
-			}
-			textbox +=">"+text[i+7]+"<\/option>";
-		}
-		textbox +="<\/select><\/td><\/tr>\n";
-		textbox +="<tr><td>&nbsp;<\/td><td>"+x+"<\/td>";
-		textbox +="<td>"+text[16]+"<\/td>";
-		textbox +="<\/tr>\n";
-		textbox +="<tr><td>"+text[5]+"<\/td><td><select name='lastvaluetemp2' id='season1' onchange='moreoptionsupdate(\"lastvalue2\")'>";
-		for(var j = 1; j <= 4; j++){
-			textbox +="<option value='"+j+"'>"+text[j+10]+"<\/option>";
-		}
-		textbox +="<\/select><\/td><td><select name='lastvaluetemp1' onchange='moreoptionsupdate(\"lastvalue1\")'>";
-		for(var k = parseInt(y); k <= parseInt(y)+15; k++){
-			textbox +="<option value='"+k+"'>"+k+"<\/option>";
-		}
-		textbox +="<\/select><\/td><\/tr>\n";
-		textbox +="<tr><td>"+text[6]+"<\/td>";
-		textbox +="<td><a href='javascript:irregularity_check()'>Irregularity?<\/a><\/td>\n";
-		textbox +="<td><input type='text' name='whenmorethantemp2' size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
-    	        textbox +="<\/tr><\/table>\n";
-	}
-	document.getElementById("more_options").innerHTML = textbox;
-}
-
-function irregularity_check(){
-	document.f.irreg_check.value = 1; // Irregularity button now pushed
-	var periodicity = document.f.periodicity.value;
-	var rollover = document.f.whenmorethantemp2.value;
-	if(document.f.whenmorethantemp3){
-		rollover = document.f.whenmorethantemp3.value;
-	}
-	var error='';
-	var toobig;
-	var expected; 
-	var errortext = "<b>Warning irregularity detected<\/b><br \/>";
-	switch(periodicity){
-	case "1":
-		if(rollover < 365) expected =365;
-		if(rollover > 365) {
-			expectedover=365;
-			toobig=1;
-		}
-		break;
-	case "2":
-		if(rollover < 52) expected =52;
-		if(rollover > 52){
-			expectedover=52;
-			toobig=1;
-		}
-		break;
-	case "3":
-		if(rollover < 26) expected =26;
-		if(rollover > 26){
-			expectedover=26;
-			toobig=1;
-		}
-		break;
-	case "4":
-		if(rollover < 17) expected =17;
-		if(rollover > 17){
-			expectedover=17;
-			toobig=1;
-		}
-		break;
-	case "5":
-		if(rollover < 12) expected =12;
-		if(rollover > 12){
-			expectedover=12;
-			toobig=1;
-		}
-		break;
-	case "6":
-		if(rollover < 6) expected =6;
-		if(rollover > 6){
-			expectedover=6;
-			toobig=1;
-		}
-		break;
-	case "7":
-		if(rollover < 4) expected =4;
-		if(rollover > 4){
-			expectedover=4;
-			toobig=1;
-		}
-		break;
-	case "8":
-		if(rollover < 4) expected =4;
-		if(rollover > 4){
-			expectedover=4;
-			toobig=1;
-		}
-		break;
-	case "9":
-		if(rollover < 2) expected =2;
-		if(rollover > 2){
-			expectedover=2;
-			toobig=1;
-		}
-		break;
-	case "10":
-		if(rollover < 1) expected =1;
-		if(rollover > 1){
-			expectedover=1;
-			toobig=1;
-		}
-		break;
-	default:
-		break;
-	}
-	if(expected){
-		if(expected == 365){
-			var daynames = new Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
-			errortext +="Please indicate which days of the week you <b>DO NOT<\/b> expect to receive issues.<br \/>";
-			for(var j=0;j<daynames.length;j++){
-				errortext +="<input type='checkbox' name='irregular' id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+daynames[j]+" &nbsp; ";
-			}
-			error=errortext;
-		} else {
-			errortext +=expected+" issues expected "+rollover+" were entered. <br \/>Please indicate which date(s) an issue is not expected<br \/>";
-			var count=0;
-			for(var i=rollover;i<expected;i++){
-				errortext +="<select name='irregular' id='irregular"+count+"' onchange='display_example(expected)'>\n";
-				errortext +=irregular_options(periodicity);
-				errortext +="<\/select>\n";
-				count++;
-			}
-			error=errortext;
-		}
-	}
-	if(toobig){
-		errortext +=expectedover+" issues expected "+rollover+" were entered.<br \/> You seem to have indicated more issues per year than expected.";
-		error=errortext;
-	}
-	if(error.length ==0){
-		error='No irregularities noticed';
-	}
-	display_example(expected);
-	document.getElementById("irregularity").innerHTML = error;
-}
-
-function irregular_options(periodicity){
-	var titles;
-	var count;
-<!-- TMPL_IF NAME="weekarrayjs" -->
-	var weeks = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
-<!-- /TMPL_IF -->
-	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
-	var seasons = new Array('Autumn','Winter','Spring','Summer','Fall');
-	var errortext='';
-	if(periodicity == 1) {
-		expected = 366;
-		titles = "Day";
-		count = 1;
-	}
-	if(periodicity == 2 || periodicity == 3 || periodicity == 4) { 
-		expected = 52;
-	<!-- TMPL_IF NAME="weekarrayjs" -->
-		titles = weeks;
-		count = <!-- TMPL_VAR NAME="weekno" -->;
-	<!-- TMPL_ELSE -->
-		titles = "Week";
-		count = 1;
-	<!-- /TMPL_IF -->
-	}
-	if(periodicity == 5 || periodicity == 6 || periodicity == 7 || periodicity == 8 || periodicity == 9) {
-		if(periodicity == 8) {
-			is_season = 1; // setting up from edit page
-		} 
-		if(is_season){
-			titles = seasons;
-			expected = 4;
-			if(is_hemisphere == 2){
-				count = 2;
-			} else {
-				count = 1;
-			}
-		} else {
-			titles = months;
-			expected = 12;
-			count = 1;
-		}
-	}
-	for(var j=1;j<=expected;j++){
-		if(isArray(titles)){
-			if(count>expected){
-				count = count-expected;
-			}
-			if(is_season && is_hemisphere == 1){
-				errortext +="<option value='"+((count*3)-2)+"'>"+titles[j]+"<\/option>\n";
-// alert("value: "+((count*3)-2)+" title: "+titles[j]);
-			} else if(is_season && is_hemisphere == 2){
-				errortext +="<option value='"+((count*3)-2)+"'>"+titles[j-1]+"<\/option>\n";
-// alert("value: "+((count*3)-2)+" title: "+titles[j-1]);
-			} else {
-				errortext +="<option value='"+count+"'>"+titles[j-1]+"<\/option>\n";
-			}
-			count++;
-		} else {
-			errortext +="<option value='"+j+"'>"+titles+" "+j+"<\/option>\n";
-		}
-	}
-	return errortext;
-}
-
-function irregular_order(){
-	var irregular = '<!-- TMPL_VAR NAME="irregularity" -->';
-	var periodicity = document.f.periodicity.value;
-	var irregarray = irregular.split('|');
-	if(periodicity ==1){
-		for(j=0;j<irregarray.length;j++){
-		document.getElementById("irregular"+irregarray[j]).checked = true; 
-		}
-	} else {
-		for(i=0;i<irregarray.length;i++){    
-			document.getElementById("irregular"+i).value = irregarray[i];
-		}
-	}
-}
-
-function display_example(expected){
-	var startfrom1 = parseInt(document.f.lastvalue1.value);
-	var startfrom2 = parseInt(document.f.lastvalue2.value);
-	var startfrom3 = parseInt(document.f.lastvalue3.value);
-	var every1 = parseInt(document.f.every1.value);
-	var every2 = parseInt(document.f.every2.value);
-	var every3 = parseInt(document.f.every3.value);
-	var numberpattern = document.f.numberingmethod.value;
-	var whenmorethan2 = parseInt(document.f.whenmorethan2.value);
-	var whenmorethan3 = parseInt(document.f.whenmorethan3.value);
-	var setto2 = parseInt(document.f.setto2.value);
-	var setto3 = parseInt(document.f.setto3.value);
-	var displaytext = 'Based on the information<br \/>entered the Numbering Pattern<br \/>will look like this<br \/>\n';
-	if(startfrom3>0){
-		var count=startfrom3-1;
-		var count2=startfrom2;
-		for(var i=0;i<12;i++){
-			if(count>=whenmorethan3){
-				count=setto3;
-				if(count2>=whenmorethan2){
-					startfrom1++;
-					count2=setto2;
-				} else {
-					count2++;
-				}
-			} else {
-				count++;
-			}
-			displaytext += numberpattern.replace(/{Z}/,count)+'\n';
-			displaytext = displaytext.replace(/{Y}/,count2)+'<br \/>\n';
-			displaytext = displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
-
-		}
-	}
-	if(startfrom2>0 && !startfrom3){
-		var count=startfrom2-1;
-		for(var i=0;i<12;i++){
-			if(count>=whenmorethan2){
-				startfrom1++;
-				count=setto2;
-			} else {
-				count++;
-			}
-
-			if(is_season){
-				if(is_hemisphere == 2){
-					if(count == 1) {
-						displaytext += numberpattern.replace(/{Y}/,text[count+12])+'\n';
-					} else {
-						displaytext += numberpattern.replace(/{Y}/,text[count+8])+'\n';
-					}
-				} else {
-				displaytext += numberpattern.replace(/{Y}/,text[count+10])+'\n';
-				}
-			} else {
-				displaytext += numberpattern.replace(/{Y}/,count)+'\n';
-			}
-			displaytext = displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
-		}
-	}
-	if(startfrom1>0 && !startfrom2 && !startfrom3){
-		for(var i=startfrom1;i<(startfrom1+12);i=i+(1*every1)){
-			startfrom1 = i;
-			displaytext += numberpattern.replace(/{X}/,startfrom1)+'<br \/>\n';
-		}
-	}
-	displaytext = "<div style='padding: 5px; background-color: #CCCCCC'>"+displaytext+"<\/div>";
-	document.getElementById("displayexample").innerHTML = displaytext;
-}
-
-function isArray(obj) {
-   if (obj.constructor.toString().indexOf("Array") == -1)
-      return false;
-   else
-      return true;
-}
-
-function moreoptionsupdate(fieldnames,rollover){
-	fieldname = fieldnames;
-	fld = fieldname.length;
-	fld = fld-1;
-	fieldnametempnumber = fieldname.substr(fld);
-	//alert(fieldnametempnumber);
-	fieldnametemp = fieldname.slice(0,-1)+"temp"+fieldnametempnumber;
-	// alert(fieldnametemp);
-	eval("document.f."+fieldname+".value = document.f."+fieldnametemp+".value");
-	if(rollover){
-		eval("document.f.every"+(fieldnametempnumber-1)+".value = document.f."+fieldnametemp+".value");
-	}
-}
-
-
-function check_input(e){
-	var unicode=e.charCode? e.charCode : e.keyCode
-	if (unicode!=8 && unicode !=46){ // if key isn't backspace or delete
-		if (unicode<48||unicode>57) { // if not a number
-			alert("Needs to be entered in digit form -eg 10");
-			return false // disable key press
-		}
-	}
-}
-
-</script>
-
-<div id="main">
-<!-- TMPL_IF name="mod" -->
-	<h1>Modify subscription</h1>
-	<form method="post" name="f" action="subscription-detail.pl">
-		<input type="hidden" name="op" value="modsubscription">
-		<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->">
-<!-- TMPL_ELSE -->
-	<h1>Add a subscription (Serial Holdings Record)</h1>
-	<form method="post" name="f">
-		<input type="hidden" name="op" value="addsubscription">
-<!-- /TMPL_IF -->
-		<input type="hidden" name="user" value="<!-- TMPL_VAR name="loggedinusername" -->">
-		<input type="hidden" name="irreg_check" value="0">
-
-
-<div id="bloc25">
-	<h2>Subscription information</h2>
-	<table border="0" cellspacing="5" cellpadding="0">
-	<tr><td>Librarian:</td>
-	    <td><!-- TMPL_VAR name="loggedinusername" --></td></tr>
-	<tr><td><label>Supplier:</label></td>
-	    <td><input type="text" name="aqbooksellerid" value="<!-- TMPL_VAR name="aqbooksellerid" -->" size="4"> (<input type="text" name="aqbooksellername" value="<!-- TMPL_VAR name="aqbooksellername" -->" disabled readonly>) <a href="#" onClick="FindAcqui(f)">Search for a Supplier</a></td>
-	<tr><td><label>Biblio</label></td>
-	    <td><input type="text" id="biblionumber"  name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->" size="4"> (<input type="text" id="title" name="title" value="<!-- TMPL_VAR name="title" -->" disabled readonly>) <a href="#" onClick="Plugin(f)">Search for Biblio</a> | <a href="#" onClick="AddBiblio()">Create Biblio</a></td>
-	<tr><td><label>Call Number</label></td>
-	    <td><input type="text" name="callnumber" value="<!-- TMPL_VAR name="callnumber" -->" size="20"></td></tr>
-	<tr><td><label>Notes</label></td>
-	    <td><textarea name="notes" cols="30" rows="2"><!-- TMPL_VAR name="notes" --></textarea></td></tr>
-		<!-- TMPL_IF name="letters" -->
-			<tr><td><label>Enable issue alert</label>
-				<select name="letter">
-					<option value=""></option>
-					<!-- TMPL_LOOP name="letters" -->
-						<!-- TMPL_IF name="selected" -->
-							<option value="<!-- TMPL_VAR name="code" -->" selected><!-- TMPL_VAR name="name" --></option>
-						<!-- TMPL_ELSE -->
-							<option value="<!-- TMPL_VAR name="code" -->"><!-- TMPL_VAR name="name" --></option>
-						<!-- /TMPL_IF -->
-					<!-- /TMPL_LOOP -->
-				</select>
-			</td>
-		<!-- /TMPL_IF -->
-		<td><label>Distributed to </label><a href="#" onClick="DistributedTo()">...</a></td><tr>
-
-
-
-
-
-
-
-
-
-	<tr><td><b>Warning:</b></td>
-	    <td>
-		<ul>
-			<li>Remember you <b>must</b> have created a biblio <b>before</b> creating a subscription</li>
-			<li>You also must have selected a supplier if you want to ask for late issues</li>
-		</ul></td></tr>
-	</table>
-</div>
-<div id="bloc25">
-	<h2>Planning</h2>
-	<table border="0" cellspacing="5" cellpadding="0">
-	<tr><td><label class="label100">This issue publishes on:</label></td>
-	    <td> <img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" id="button2" style="cursor: pointer;"  />
-
-<input type="text" name="publisheddate" value="<!-- TMPL_VAR name="publisheddate" -->" size=13 maxlength=10 id="acqui_date" style="border-width: 0px;">
-<!-- both scripts for calendar must follow the input field --> 
-                                        <script type="text/javascript">
-                                            Calendar.setup({
-                                                inputField:"acqui_date",
-                                                ifFormat       :   "%d/%m/%Y",
-                                                button         :   "button2",
-                                                align          :   "Tl"
-                                            });
-                                        </script>
-                                        <script type="text/javascript">
-                                            Calendar.setup({
-                                                inputField     :   "acqui_date",
-                                                ifFormat       :   "%d/%m/%Y",
-                                                button         :   "acqui_date",
-                                                align          :   "Tl"
-                                            });
-                                        </script></td>
-	    <td rowspan="5"><div id="displayexample"></div></td></tr>
-	<tr><td><label class="label100">Frequency: (*)</label></td>
-	    <td>	<select name="periodicity" size="1">
-				<option value="" selected>-- please choose --</option>
-				
-				<!-- TMPL_IF name="periodicity1" -->
-					<option value="1" selected>1/day</option>
-				<!-- TMPL_ELSE -->
-					<option value="1">1/day</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="periodicity2" -->
-					<option value="2" selected>1/week</option>
-				<!-- TMPL_ELSE -->
-					<option value="2">1/week</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="periodicity3" -->
-					<option value="3" selected>1/2 weeks (2/month)</option>
-				<!-- TMPL_ELSE -->
-					<option value="3">1/2 weeks (2/months)</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="periodicity4" -->
-					<option value="4" selected>1/3 weeks</option>
-				<!-- TMPL_ELSE -->
-					<option value="4">1/3 weeks</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="periodicity5" -->
-					<option value="5" selected>1/month</option>
-				<!-- TMPL_ELSE -->
-					<option value="5">1/month</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="periodicity6" -->
-					<option value="6" selected>1/2 months (6/year)</option>
-				<!-- TMPL_ELSE -->
-					<option value="6">1/2 months (6/year)</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="periodicity7" -->
-					<option value="7" selected>1/3 months (1/quarter)</option>
-				<!-- TMPL_ELSE -->
-					<option value="7">1/3 months (1/quarter)</option>
-				<!-- /TMPL_IF -->
-				<!-- periodicity8 is 1/quarter, exactly like periodicity7 but will use it for seasonal option -->
-				<!-- TMPL_IF name="periodicity8" -->
-					<option value="8" selected>1/quarter (seasonal)</option>
-				<!-- TMPL_ELSE -->
-					<option value="8">1/quarter (seasonal)</option>
-				<!-- /TMPL_IF -->
-
-				<!-- TMPL_IF name="periodicity9" -->
-					<option value="9" selected>2/years</option>
-				<!-- TMPL_ELSE -->
-					<option value="9">2/year</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="periodicity10" -->
-					<option value="10" selected>1/year</option>
-				<!-- TMPL_ELSE -->
-					<option value="10">1/year</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="periodicity11" -->
-					<option value="11" selected>1/2 years</option>
-				<!-- TMPL_ELSE -->
-					<option value="11">1/2 years</option>
-				<!-- /TMPL_IF -->
-			</select>
-	</td></tr>
-	<tr><td><label class="label100">Numbering Pattern:</label></td>
-	    <td><select name="numbering_pattern" size="1" id="numberpattern" onchange="num_pattern()">
-		<option value="" selected>-- please choose --</option>
-		<!-- TMPL_IF name="numberpattern1" -->
-			<option value="1" selected>Number</option>
-		<!-- TMPL_ELSE -->
-			<option value="1">Number</option>
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern2" -->
-			<option value="2" selected>Volume, Number, Issue</option>
-		<!-- TMPL_ELSE -->
-			<option value="2">Volume, Number, Issue</option>
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern3" -->
-			<option value="3" selected>Volume, Number</option>
-		<!-- TMPL_ELSE -->
-			<option value="3">Volume, Number</option>
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern4" -->
-			<option value="4" selected>Volume, Issue</option>
-		<!-- TMPL_ELSE -->
-			<option value="4">Volume, Issue</option>
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern5" -->
-			<option value="5" selected>Number, Issue</option>
-		<!-- TMPL_ELSE -->
-			<option value="5">Number, Issue</option>
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern6" -->
-			<option value="6" selected>Seasonal only</option>
-		<!-- TMPL_ELSE -->
-	 		<option value="6">Seasonal only</option>
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern7" -->
-			<option value="7" selected>None of the above</option>
-		<!-- TMPL_ELSE -->
-	 		<option value="7">None of the above</option>
-		<!-- /TMPL_IF -->
-
-		</select>
-<div id="more_options"></div>
-<div id="irregularity"></div></td></tr>
-	<tr><td><label class="label100">Planned to arrive on: (*)</label></td>
-	    <td><img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" id="button1" style="cursor: pointer;"  />
-<input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->" size=13 maxlength=10 id="beginning_date" style="border-width: 0px;">
-<!-- both scripts for calendar must follow the input field --> 
-                                        <script type="text/javascript">
-                                            Calendar.setup({
-                                                inputField   : "beginning_date",
-                                                ifFormat     : "%d/%m/%Y",
-                                                button       : "button1",
-                                                align        : "Tl"
-                                            });
-                                        </script>
-                                        <script type="text/javascript">
-                                            Calendar.setup({
-                                                inputField   : "beginning_date",
-                                                ifFormat     : "%d/%m/%Y",
-                                                button       : "beginning_date",
-                                                align        : "Tl"
-                                            });
-                                        </script></td></tr>
-</table> 
-</div>
-
-<!--	<tr><td><label class="label100">Arrives on</label></td>
-	    <td>	<select name="dow" size="1">
-				<option value="">None</option>
-				<!-- TMPL_IF name="dow1" -->
-					<option value="1" selected>Monday</option>
-				<!-- TMPL_ELSE -->
-					<option value="1">Monday</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="dow2" -->
-					<option value="2" selected>Tuesday</option>
-				<!-- TMPL_ELSE -->
-					<option value="2">Tuesday</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="dow3" -->
-					<option value="3" selected>Wednesday</option>
-				<!-- TMPL_ELSE -->
-					<option value="3">Wednesday</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="dow4" -->
-					<option value="4" selected>Thursday</option>
-				<!-- TMPL_ELSE -->
-					<option value="4">Thursday</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="dow5" -->
-					<option value="5" selected>Friday</option>
-				<!-- TMPL_ELSE -->
-					<option value="5">Friday</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="dow6" -->
-					<option value="6" selected>Saturday</option>
-				<!-- TMPL_ELSE -->
-					<option value="6">Saturday</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="dow7" -->
-					<option value="7" selected>Sunday</option>
-				<!-- TMPL_ELSE -->
-					<option value="7">Sunday</option>
-				<!-- /TMPL_IF -->
-			</select></td></tr> -->
-
-<div id="bloc25">
-	<h2>Subscription length</h2>
-		<p><select name="subtype">
-<!-- TMPL_LOOP NAME="subtype" -->
-<option value="<!-- TMPL_VAR NAME="name" -->" <!-- TMPL_IF NAME="selected" --> selected="SELECTED" <!-- /TMPL_IF -->><!-- TMPL_VAR NAME="name" --></option>
-<!-- /TMPL_LOOP -->
-</select> <input type="text" name="sublength" value="<!-- TMPL_VAR name="sublength" -->" size="3" onkeypress="return check_input(event)"> (*) (enter amount in numerals)</p>
-
-</div>
-<div id="bloc25">
-	<h2>Numbering calculation</h2>
-	<p>Numbering formula: <input type="text" name="numberingmethod" value="<!-- TMPL_VAR name="numberingmethod" -->"></p>
-	<div id="basetable" style="display: none;">
-		<table class="small">
-			<tr>
-				<th>&nbsp;</th>
-				<th>X</th>
-				<th>Y</th>
-				<th>Z</th>
-			</tr>
-			<tr>
-				<td>Add</td>
-				<td>
-					<input type="text" name="add1" value="<!-- TMPL_VAR name="add1" -->">
-				</td>
-				<td>
-					<input type="text" name="add2" value="<!-- TMPL_VAR name="add2" -->">
-				</td>
-				<td>
-					<input type="text" name="add3" value="<!-- TMPL_VAR name="add3" -->">
-				</td>
-			</tr>
-			<tr>
-				<td>once every</td>
-				<td><input type="text" name="every1" value="<!-- TMPL_VAR name="every1" -->"></td>
-				<td><input type="text" name="every2" value="<!-- TMPL_VAR name="every2" -->"></td>
-				<td><input type="text" name="every3" value="<!-- TMPL_VAR name="every3" -->"></td>
-			</tr>
-			<tr>
-				<td>When more than</td>
-				<td><input type="text" name="whenmorethan1" value="<!-- TMPL_VAR name="whenmorethan1" -->"></td>
-				<td><input type="text" name="whenmorethan2" value="<!-- TMPL_VAR name="whenmorethan2" -->"></td>
-				<td><input type="text" name="whenmorethan3" value="<!-- TMPL_VAR name="whenmorethan3" -->"></td>
-			</tr>
-			<!-- TMPL_IF name="mod" -->
-			<tr>
-				<td>The loop is for instance</td>
-				<td><input type="text" name="innerloop1" value="<!-- TMPL_VAR name="innerloop1" -->"></td>
-				<td><input type="text" name="innerloop2" value="<!-- TMPL_VAR name="innerloop2" -->"></td>
-				<td><input type="text" name="innerloop3" value="<!-- TMPL_VAR name="innerloop3" -->"></td>
-			</tr>
-			<!-- /TMPL_IF -->
-			<tr>
-				<td>Set back to</td>
-				<td><input type="text" name="setto1" value="<!-- TMPL_VAR name="setto1" -->"></td>
-				<td><input type="text" name="setto2" value="<!-- TMPL_VAR name="setto2" -->"></td>
-				<td><input type="text" name="setto3" value="<!-- TMPL_VAR name="setto3" -->"></td>
-			</tr>
-			<tr>
-				<td>
-					<!-- TMPL_IF name="mod" -->
-						Last value
-					<!-- TMPL_ELSE -->
-						Begins with
-					<!-- /TMPL_IF -->
-				</td>
-				<td><input type="text" name="lastvalue1" value="<!-- TMPL_VAR name="lastvalue1" -->"></td>
-				<td><input type="text" name="lastvalue2" value="<!-- TMPL_VAR name="lastvalue2" -->"></td>
-				<td><input type="text" name="lastvalue3" value="<!-- TMPL_VAR name="lastvalue3" -->"></td>
-			</tr>
-		</table> </div>
-</div>
-<!-- TMPL_IF name="mod" -->
-	<input type="button" value="Save subscription" onclick="Check(this.form)" accesskey="w" class="button">
-<!-- TMPL_ELSE -->
-	<input type="button" value="Add subscription" onclick="Check(this.form)" accesskey="w" class="button">
-<!-- /TMPL_IF -->
-</form>
-</div>
-
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
-
-<script language="JavaScript" type="text/javascript">
-
-function Plugin(f)
-{
-	 window.open('subscription-bib-search.pl','FindABibIndex','width=500,height=400,toolbar=no,scrollbars=yes');
-}
-
-function FindAcqui(f)
-{
-	 window.open('acqui-search.pl','FindASupplier','width=500,height=400,toolbar=no,scrollbars=yes');
-}
-
-function Find_ISSN(f)
-{
-	 window.open('issn-search.pl','FindABibIndex','width=500,height=400,toolbar=no,scrollbars=yes');
-}
-
-
-function Check(f) {
-	if (f.startdate.value.length != 0 && f.sublength.value > 0) {
-		if (f.irreg_check.value == 1) {
-			document.f.submit();
-		} else {
-			if(f.numbering_pattern.value == ''){
-				alert("need to choose a numbering pattern");
-			} else {
-				alert("need to check for irregularity by clicking 'Irregularity?'");
-			}
-		}
-	} else {
-	 	alert('field marked with * are mandatory');
-	}
-	return false;
-}
-function DistributedTo()
-{
-	newwin= window.open('distributedto.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->',"Distributed_to",'width=800,height=600,toolbar=false,scrollbars=yes');
-}
-function AddBiblio() {
-     window.open("/cgi-bin/koha/cataloguing/addbiblio.pl?fromserials=1&popup=1","AddBiblio",'width=700,height=400,toolbar=no,scrollbars=yes,status=yes');
-
-}
-</script>
-<!-- TMPL_IF name="mod" -->
-<script language="JavaScript" type="text/javascript">
-window.onload = modify_num_pattern();
-	<!-- TMPL_IF name="hemisphere" -->
-	window.onload = hemispheres(<!-- TMPL_VAR NAME="hemisphere" -->);
-	<!-- /TMPL_IF -->
-</script>
-<!-- /TMPL_IF -->
-<!-- TMPL_IF name="irregularity" -->
-<script language="JavaScript"  type="text/javascript">
-window.onload = irregularity_check();
-window.onload = irregular_order();
-</script>
-<!-- /TMPL_IF -->
\ No newline at end of file

Index: htdocs/intranet-tmpl/default/en/serials/subscription-bib-search.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/subscription-bib-search.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/subscription-bib-search.tmpl
--- htdocs/intranet-tmpl/default/en/serials/subscription-bib-search.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,74 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Catalog Search<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<div id="main-compact">
-
-<h1>Catalogue search</h1>
-
-<form name="f" action="/cgi-bin/koha/serials/subscription-bib-search.pl" method="post">
-	<input type="hidden" name="op" value="do_search" />
-	<input type="hidden" name="type" value="intranet" />
-	<input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->" />
-	<div class="data">
-		<table>
-		<caption>Search on</caption>
-		<tr><th scope="row"><label for="keyword">Search</label></th><td>
-			
-			<input type="hidden" name="and_or" value="@and" />
-			<input type="hidden" name="relation" value="@attr 5=1" /> 
-			<input type="text" id="keyword" name="value"> 
-		</td><td><select align="right" id="kohafield" name="kohafield" size="1">
-				<option value="any">Any field</option>
-				<option value="title">Title</option>
-				<option value="Author">Author</option>
-				<option value="ISSN">ISSN</option>
-			</select></td></tr>
-		<tr><th scope="row"><label for="itemtype">Itemtype</label></th><td>
-			<!-- TMPL_VAR name="CGIitemtype" -->
-			<input type="hidden" name="kohafield" value="itemtype" />
-			<input type="hidden" name="value" value="<!-- TMPL_VAR name="category" -->">
-		
-			<input type="hidden" name="and_or" value="@and" />
-			<input type="hidden" name="relation" value="@attr 5=1" />
-
-			<input type="hidden" name="index" value="<!-- TMPL_VAR name="index" -->" />
-		</td></tr>
-	</div>
-	<div class="data">
-		<tr><th scope="row"><label for="resultsperpage">Results per page :</label></th><td>
-			<select align="right" id="resultsperpage" name="resultsperpage" size="1">
-				<option value="10">10</option>
-				<option value="20">20</option>
-				<option value="50">50</option>
-			</select></td><td>
-		<label for="orderby">Ordered by</label>
-			<select id="orderby" name="order" size="1">
-				<option value="title i>">Title</option>
-				<option value="author i>">Author</option>
-					</select>
-		</td></tr>
-		</table>
-		<p>
-			<input type="submit" value="Start search" class="submit" />
-			
-		</p>
-	</div>
-</form>
-
-<script language="Javascript" type="text/javascript">
-function AddStatement() {
-
-	document.forms['f'].op.value="AddStatement";
-	document.f.submit();
-}
-
-function PopupSuggestion() {
-    var strQuery="";
-	for (i=0 ; i<document.f.marclist.length ; i++) {
-		if (document.f.value[i].value.length>0) {
-		    strQuery += " "+document.f.value[i].value;
-		}
-	}
-	newin=window.open("suggest.pl?Q="+strQuery,"Suggestions",'width=500,height=400,toolbar=false,scrollbars=yes');
-}
-
-</script>
-</div>

Index: htdocs/intranet-tmpl/default/en/serials/subscription-detail.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/subscription-detail.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/subscription-detail.tmpl
--- htdocs/intranet-tmpl/default/en/serials/subscription-detail.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,420 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscription edit<!--
-TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
-<script language="Javascript" type="text/javascript">
-<!--
-// the english words used in display purposes
-var text = new Array('Number','Volume','Issue','Month','Week','Starting with:','Rollover at:','Choose Hemisphere:','Northern','Southern',
-'Autumn','Winter','Spring','Summer','Fall','Season','Year');
-
-// common pre defined number patterns
-function num_pattern() {
-var patternchoice = '<!--TMPL_VAR NAME='numberpattern'-->';
-	switch(patternchoice){
-	case "2":
-		options(text[1],text[0],text[2]);
-		irregularity();
-		display_table(0);
-		break;
-	case "3":
-		options(text[1],text[0]);
-		irregularity();
-		display_table(0);
-		break;
-	case "4":
-		options(text[1],text[2]);
-		irregularity();
-		display_table(0);
-		break;
-	case "5":
-		options(text[0],text[2]);
-		irregularity();
-		display_table(0);
-		break;
-	case "6":
-		var d = new Date();
-		var sYear = d.getFullYear();
-		// options_seasons(text[15],sYear);
-		irregularity();
-		is_season = 1;
-		display_table(0);
-		break;
-	case "7":
-		display_table(1);
-		irregularity();
-		break;
-	default:
-		options(text[0]);
-		irregularity();
-		display_table(0);
-		break;
-	}
-}
-
-function display_table(n) {
-	if(n==1){
-		document.getElementById("basetable").style.display = 'block';
-	} else {
-		document.getElementById("basetable").style.display = 'none';
-	}
-}
-
-// to dispaly the options section
-function options(x,y,z){
-var textbox = '';
-	// alert("X: "+x+"Y: "+y+"Z: "+z);
-	if(x){
-		document.f.xfield.value = x;
-		if(y){
-			document.f.yfield.value = y;
-			if(z){
-				document.f.zfield.value = z;
-			}
-		}
-	}
-}
-
-function irregularity(){
-	var periodicity = '<!-- TMPL_VAR NAME="periodicity"-->';
-	switch(periodicity){
-	case "1":
-		var names = new Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
-		break;
-	case "2":
-		<!-- TMPL_IF NAME="weekarrayjs" -->
-		var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
-		<!-- /TMPL_IF -->
-		break;
-	case "3":
-		<!-- TMPL_IF NAME="weekarrayjs" -->
-		var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
-		<!-- /TMPL_IF -->
-		break;
-	case "4":
-		<!-- TMPL_IF NAME="weekarrayjs" -->
-		var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
-		<!-- /TMPL_IF -->
-		break;
-	case "5":
-		var names = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
-		break;
-	case "6":
-		var names = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
-		break;
-	case "7":
-		var names = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
-		break;
-	case "8":
-		var names = new Array('Autumn','Winter','Spring','Summer','Fall');
-		break;
-	case "9":
-		var names = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
-		break;
-	case "10":
-		expected =1;
-		break;
-	default:
-		break;
-	}
-
-	<!-- TMPL_IF NAME="irregularity" -->
-	var irregular = '<!-- TMPL_VAR NAME="irregularity" -->';
-	var irregarray = irregular.split('|');
-	var irregtext = '<p>';
-	for(var i=0;i<irregarray.length;i++){
-		irregtext += names[i]+' &nbsp;';
-	}
-	irregtext += '</p>';
-	document.getElementById("irreg").innerHTML = irregtext;
-	<!-- /TMPL_IF -->
-}
-
--->
-</script>
-
-<div id="main">
-
-<h1>Subscription Details for biblio :  <!-- TMPL_VAR name="biblionumber" --></h1>
-<form class="inline" method="get" action="subscription-add.pl">
-<input type="hidden" name="op" value="mod" />
-<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
-<input type="submit" class="submit" title="Modify subscription" value="Edit" /></form>
-
-<form class="inline" method="get" action="serials-receive.pl">
-<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
-<input type="submit" class="submit" value="Receive Issues" /></form>
-
-<form class="inline" method="get" action="serial-issues.pl">
-<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->" />
-<input type="submit" class="submit"  title="All issues on this title" value="Issue History" /></form>
-
-<form class="inline" method="get" action="/cgi-bin/koha/serials/serials-home.pl">
-<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->" />
-<input type="submit" class="submit"  title="all subscriptions on <!-- TMPL_VAR name="bibliotitle" -->" value="Subscriptions" /></form>
-
-<form class="inline" method="get" action="/cgi-bin/koha/catalogue/MARCdetail.pl">
-<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->" />
-<input type="submit" class="submit"  title="go to <!-- TMPL_VAR name="bibliotitle" -->" value="View Biblio Record" /></form>
-
-<form class="inline"><input type="submit" class="cancel" value="Delete Subscription" onclick="confirm_deletion(); return false;" /></form>
-<!-- TMPL_IF NAME="routing" -->
-<form class="inline" method="get" action="/cgi-bin/koha/serials/routing.pl">
-<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
-<input type="submit"  class="submit" value="Edit Routing List"/></form>
-<!-- TMPL_ELSE -->
-<form class="inline" method="get" action="/cgi-bin/koha/serials/routing.pl">
-<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
-<input type="hidden" name="op" value="new" />
-<input type="submit"  class="submit" value="Create Routing List"/></form>
-<!-- /TMPL_IF -->
-
-<table>
-<tr valign="top"><td>
-
-<div class="bloc25">
-	<h2>Subscription information</h2>
-	<p><label class="label100">Librarian identity:</label> <!-- TMPL_VAR name="librarian" --></p><br />
-
-	<p><label class="label100">Supplier:</label> <!-- TMPL_VAR name="aqbooksellername" -->&nbsp;</p>
-
-	<p><label class="label100">Cost:</label> <!-- TMPL_VAR name="cost" -->&nbsp;</p>
-
-	<p><label class="label100">Budget:</label> <!-- TMPL_VAR name="bookfundid" -->&nbsp;</p>
-
-	<p><label class="label100">Biblio:</label> <i>(<!-- TMPL_VAR name="biblionumber" -->)</i> <!-- TMPL_VAR name="bibliotitle" --></p><br />
-	<p><label class="label100">Call Number:</label> <!-- TMPL_VAR name="callnumber" -->&nbsp;</p>
-
-	<p><label class="label100">Notes:</label> <!-- TMPL_VAR name="notes" --></p>
-</div>
-
-<div class="bloc25">
-	<form name="f">
-	<h2>Planning</h2>
-	<p><label class="label100">Beginning date:</label> <!-- TMPL_VAR name="publisheddate" -->
-	</p>
-	<p><label class="label100">Frequency (*):</label>
-		<!--TMPL_IF name="periodicity1" -->
-				1/day
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity2" -->
-				1/week
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity3" -->
-				1/2 weeks
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity4" -->
-				1/3 weeks
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity5" -->
-				1/Month
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity6" -->
-				1/2 Months (6/year)
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity7" -->
-				1/quarter
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity8" -->
-				1/quarter
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity9" -->
-				2/year
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity10" -->
-				1/year
-		<!-- /TMPL_IF -->
-		<!--TMPL_IF name="periodicity11" -->
-				1/2 years
-		<!-- /TMPL_IF -->
-	</p>
-	<p><label class="label100">Number Pattern:</label>
-		<!-- TMPL_IF name="numberpattern1" -->
-			Number
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern2" -->
-			Volume, Number, Issue
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern3" -->
-			Volume, Number
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern4" -->
-			Volume, Issue
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern5" -->
-			Number, Issue
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern6" -->
-			Seasonal only
-		<!-- /TMPL_IF -->
-		<!-- TMPL_IF name="numberpattern7" -->
-			None of the above
-		<!-- /TMPL_IF -->
-	</p>
-	<table cellpadding="0" cellspacing="0">
-	<tr><td>&nbsp;</td>
-	    <td align="right"><input type="text" name="xfield" style="border:0px solid #FFFFFF; text-align:center;"></td>
-	<!--TMPL_IF NAME="lastvalue2"-->
-	    <td align="right"><input type="text" name="yfield" style="border:0px solid #FFFFFF; text-align:center;"></td>
-	<!--/TMPL_IF-->
-	<!--TMPL_IF NAME="lastvalue3"-->
-	    <td align="right"><input type="text" name="zfield" style="border:0px solid #FFFFFF; text-align:center;"></td>
-	<!--/TMPL_IF-->
-	</tr>
-	<tr><td><p><label class="label100">Starting with:</label></p></td>
-	    <td align="center"><!--TMPL_VAR NAME="lastvalue1"--></td>
-	<!--TMPL_IF NAME="lastvalue2"-->
-	    <td align="center">&nbsp; 
-			<!--TMPL_VAR NAME="lastvalue2"-->
-	    </td>
-	<!--/TMPL_IF-->
-	<!--TMPL_IF NAME="lastvalue3"-->
-	    <td align="center">&nbsp; 
-			<!--TMPL_VAR NAME="lastvalue3"-->
-	    </td>
-	<!--/TMPL_IF-->
-	</tr>
-	<tr><td><p><label class="label100">Rollover:</label></p></td>
-	    <td align="center">&nbsp;</td>
-	<!--TMPL_IF NAME="whenmorethan2"-->
-	    <td align="center">&nbsp; 
-			<!--TMPL_VAR NAME="whenmorethan2"-->
-	    </td>
-	<!--/TMPL_IF-->
-	<!--TMPL_IF NAME="whenmorethan3"-->
-	    <td align="center">&nbsp; 
-			<!--TMPL_VAR NAME="whenmorethan3"-->
-	    </td>
-	<!--/TMPL_IF-->
-	</tr>
-	</table>
-	<!-- TMPL_IF NAME="irregularity" -->
-	<p><label class="label100">Irregularity:</label>
-		<div id="irreg"></div>
-	</p>
-	<!-- /TMPL_IF -->
-	<p><label class="label100">Begins on:</label>
-		<!--TMPL_VAR name="startdate" -->
-	</p>
-	</form>
-</div>
-<div class="bloc25">
-	<h2>Subscription length</h2>
-	<!-- TMPL_IF name="numberlength" --><p><label>Number of issues:</label> <!-- TMPL_VAR name="numberlength" --></p><!-- /TMPL_IF -->
-	<!-- TMPL_IF name="weeklength" --><p><label>Number of weeks:</label> <!-- TMPL_VAR name="weeklength" --></p><!-- /TMPL_IF -->
-	<!-- TMPL_IF name="monthlength" --><p><label class="label100">Number of months:</label> <!-- TMPL_VAR name="monthlength" --></p><!-- /TMPL_IF -->
-
-</div>
-<div class="bloc25">
-	<h2>Numbering calculation</h2>
-	<p><label class="label100">Numbering formula:</label> <!-- TMPL_VAR name="numberingmethod" --></p>
-</div>
-<div class="bloc25" id="basetable">
-	<table cellpadding="0" cellspacing="0" border="0" class="collapse">
-		<tr>
-			<th class="cell-header">&nbsp;</th>
-			<th class="cell-header">X</th>
-			<th class="cell-header">Y</th>
-			<th class="cell-header">Z</th>
-			</tr>
-			<tr>
-				<td class="cell">Add</td>
-				<td class="cell">
-					<!-- TMPL_VAR name="add1" -->
-				</td>
-				<td class="cell">
-					<!-- TMPL_VAR name="add2" -->
-				</td>
-				<td class="cell">
-					<!-- TMPL_VAR name="add3" -->
-				</td>
-			</tr>
-			<tr>
-				<td class="cell">once every</td>
-				<td class="cell"><!-- TMPL_VAR name="every1" --></td>
-				<td class="cell"><!-- TMPL_VAR name="every2" --></td>
-				<td class="cell"><!-- TMPL_VAR name="every3" --></td>
-			</tr>
-			<tr>
-				<td class="cell">When more than</td>
-				<td class="cell"><!-- TMPL_VAR name="whenmorethan1" --> <!-- TMPL_IF name="innerloop1" --><br/>
-					<i>(is <!-- TMPL_VAR name="innerloop1" -->)</i><!-- /TMPL_IF --></td>
-				<td class="cell"><!-- TMPL_VAR name="whenmorethan2" --> <!-- TMPL_IF name="innerloop2" --><br/>
-					<i>(is <!-- TMPL_VAR name="innerloop2" -->)</i><!-- /TMPL_IF --></td>
-				<td class="cell"><!-- TMPL_VAR name="whenmorethan3" --> <!-- TMPL_IF name="innerloop3" --><br/>
-					<i>(is <!-- TMPL_VAR name="innerloop3" -->)</i><!-- /TMPL_IF --></td>
-			</tr>
-			<tr>
-				<td class="cell">Set back to</td>
-				<td class="cell"><!-- TMPL_VAR name="setto1" --></td>
-				<td class="cell"><!-- TMPL_VAR name="setto2" --></td>
-				<td class="cell"><!-- TMPL_VAR name="setto3" --></td>
-			</tr>
-			<tr>
-				<td class="cell">
-						Last value
-				</td>
-				<td class="cell"><!-- TMPL_VAR name="lastvalue1" --></td>
-				<td class="cell"><!-- TMPL_VAR name="lastvalue2" --></td>
-				<td class="cell"><!-- TMPL_VAR name="lastvalue3" --></td>
-			</tr>
-		</table>
-</div>
-</td><td>
-<div class="bloc25">
-	<h2>Issues</h2>
-	<table cellpadding="0" cellspacing="0" border="0" class="collapse">
-	<tr>
-		<th class="cell-header">Issue number</th>
-		<th class="cell-header">Planned date</th>
-		<th class="cell-header">Status</th>
-	</tr>
-	<!-- TMPL_LOOP name="serialslist" -->
-		<tr>
-			<td class="cell">
-				<!-- TMPL_VAR name="serialseq" -->
-			</td>
-			<td class="cell">
-				<!-- TMPL_VAR name="planneddate" -->
-			</td>
-			<td class="cell">
-					<!--TMPL_IF name="status1" -->
-						Waited
-					<!-- /TMPL_IF -->
-					<!--TMPL_IF name="status2" -->
-						Arrived
-					<!-- /TMPL_IF -->
-					<!--TMPL_IF name="status3" -->
-						Late
-					<!-- /TMPL_IF -->
-					<!--TMPL_IF name="status4" -->
-						Missing
-					<!-- /TMPL_IF -->
-					<!--TMPL_IF name="status5" -->
-						Not Published
-					<!-- /TMPL_IF -->
-			</td>
-		</tr>
-	<!-- /TMPL_LOOP -->
-	</table>
-</div>
-</td></tr>
-</table>
-
-</div>
-<script type="text/javascript">
-function _(s) { return s } // dummy function for gettext
-function confirm_deletion() {
-	<!-- TMPL_IF name="totalissues" -->
-		var is_confirmed = confirm(_('You already made <!-- TMPL_VAR name="totalissues"--> receipts. Do you confirm deletion?'));
-	<!-- TMPL_ELSE -->
-		var is_confirmed = confirm(_('Are you sure you want to delete this subscription?'));
-	<!-- /TMPL_IF -->	
-	if (is_confirmed) {
-		window.location="subscription-detail.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->&biblionumber=<!-- TMPL_VAR name="biblionumber" -->&op=del";
-	}
-}
-window.onload = num_pattern();
-</script>
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/serials/subscription-renew.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/subscription-renew.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/subscription-renew.tmpl
--- htdocs/intranet-tmpl/default/en/serials/subscription-renew.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-<!-- TMPL_INCLUDE NAME="popup-top.inc" -->
-<div id="main">
-
-<h1 class="serial">subscription renewal for <!-- TMPL_VAR name="bibliotitle" --></h1>
-
-<form name="f" action="/cgi-bin/koha/serials/subscription-renew.pl" method="post">
-	<div id="bloc25">
-		<input type="hidden" name="op" value="renew">
-		<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->">
-		<p><label class="label100">start date</label><input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->"></p>
-		<p>Subscription length :</p>
-		<p><label class="label100">Number of num</label><input type="text" name="numberlength" value="<!-- TMPL_VAR name="numberlength" -->"></p>
-		<p><label class="label100">Number of weeks</label><input type="text" name="weeklength" value="<!-- TMPL_VAR name="weeklength" -->"></p>
-		<p><label class="label100">Number of months</label><input type="text" name="monthlength" value="<!-- TMPL_VAR name="monthlength" -->"></p>
-		<p>Note for the librarian that will manage your renewal request</p>
-		<ul><textarea name="note" rows="10" cols="60"></textarea></ul>
-		<input type="submit" value="Request a renewal" class="button serial">
-	</div>
-</form>
-</div>
-
-        <!-- TMPL_IF NAME="done" -->
-	<script type="text/javascript">
-	<!--
-	opener.document.location.reload();
-	self.close();
-	//-->
-	</script>
-	<!-- /TMPL_IF -->
-
-<!-- TMPL_INCLUDE NAME="popup-bottom.inc" -->
-

Index: htdocs/intranet-tmpl/default/en/serials/viewalerts.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/serials/viewalerts.tmpl
diff -N htdocs/intranet-tmpl/default/en/serials/viewalerts.tmpl
--- htdocs/intranet-tmpl/default/en/serials/viewalerts.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,28 +0,0 @@
-<!-- TMPL_INCLUDE NAME="serials-top.inc" -->
-
-<div id="main">
-		<h1 class="serial">Alert subscribers for <!-- TMPL_VAR name="bibliotitle" --></h1>
-		<a href="subscription-detail.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->" class="button serial">subscription</a>
-		<div class="bloc25">
-		<!-- TMPL_IF name="alertloop" -->
-			<table>
-			<tr>
-				<th class="serial">Borrower name</th>
-				<th class="serial">&nbsp;</th>
-			</tr>
-
-			<!-- TMPL_LOOP NAME="alertloop" -->
-				<tr>
-					<td><!-- TMPL_VAR name="name" --></td>
-					<td><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR name="borrowernumber">" class="button serial">View</a></td>
-				</tr>
-			<!-- /TMPL_LOOP -->
-			</table>
-		<!-- TMPL_ELSE -->
-			Nobody
-		<!-- /TMPL_IF -->
-		</div>
-
-	
-</div>
-<!-- TMPL_INCLUDE NAME="serials-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/sms/sms-home.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/sms/sms-home.tmpl
diff -N htdocs/intranet-tmpl/default/en/sms/sms-home.tmpl
--- htdocs/intranet-tmpl/default/en/sms/sms-home.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->System Administration<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
-
-<div id="main">
-<h1>NEULIS SMS Administration</h1>
-
-
-<table>
-<caption>SMS Messaging </caption>
-<!--TMPL_IF NAME="error"--><div class="error"><!--TMPL_VAR NAME="error"--> </div><!--/TMPL_IF-->
-<form action="/cgi-bin/koha/sms/sms.pl" method="post">
-<tr><input type="hidden" value="sendsms" name="operation"/>
-	<td >Your Message<textarea name="message"  cols="35" rows="4"><!--TMPL_VAR NAME="message"--></textarea></td>
-</tr>
-<tr>
-	<td>Phone:<input type="text" name="phone" value="<!--TMPL_VAR NAME="phone"-->"/>5338644143</th>
-	
-</tr>
-	<tr>
-	
-	<td><input type="submit" value="Send SMS"></td>
-</tr>
-</form>
-
-<th>Şu anda sadece KTcell abonelerine mesaj gönderilebilir. Rezervasyonu gelenler için kullanın!</th>
-
-</table>
-
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/suggestion/acceptorreject.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/suggestion/acceptorreject.tmpl
diff -N htdocs/intranet-tmpl/default/en/suggestion/acceptorreject.tmpl
--- htdocs/intranet-tmpl/default/en/suggestion/acceptorreject.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Suggestion Management
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
-<div id="main">
-
-
-<!-- TMPL_IF name="op_else" -->
-	<h1>Suggestions Management</h1>
-	<form method="post" action="/cgi-bin/koha/suggestion/acceptorreject.pl">
-	<input type="hidden" name="op" value="aorr_confirm">
-	<table>
-		<tr>
-			<th>Status</th>
-			<th>Suggestion</th>
-			<th>Suggested by</th>
-		</tr>
-		<!-- TMPL_LOOP NAME="suggestions_loop" -->
-			<tr<!-- TMPL_IF name="even" --> class="highlight"<!-- /TMPL_IF -->>
-				<td>
-					<select name="aorr">
-						<option value=""> -- Choose Action --</option>
-						<option value="R<!--TMPL_VAR name="suggestionid" -->">Reject</option>
-						<option value="A<!--TMPL_VAR name="suggestionid" -->">Accept</option>
-					</select>
-				</td>
-				<td><!-- TMPL_VAR NAME="title" --><!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --><br>
-					<!-- TMPL_IF name="copyrightdate" -->&copy <!-- TMPL_VAR name="copyrightdate" --> <!-- /TMPL_IF -->
-						<!-- TMPL_IF name="volumedesc" -->; Volume:<i><!-- TMPL_VAR name="volumedesc" --></i> <!-- /TMPL_IF -->
-						<!-- TMPL_IF name="isbn" -->; ISBN :<i><!-- TMPL_VAR name="isbn" --></i> <!-- /TMPL_IF --><!-- TMPL_IF name="publishercode" -->; Published by <!-- TMPL_VAR name="publishercode" --> <!-- /TMPL_IF --><!-- TMPL_IF name="publicationyear" --> in <i><!-- TMPL_VAR name="publicationyear" --></i> <!-- /TMPL_IF --><!-- TMPL_IF name="place" --> in <i><!-- TMPL_VAR name="place" --></i> <!-- /TMPL_IF --><br><!-- TMPL_IF name="note" --><!-- TMPL VAR NAME="note" --><!-- /TMPL_IF -->
-
-				</td>
-				<td>
-					<!-- TMPL_VAR name="surnamesuggestedby" --><!-- TMPL_IF name="firstnamesuggestedby" -->,<!-- /TMPL_IF --> <!-- TMPL_VAR name="firstnamesuggestedby" -->
-				</td>
-			</tr>
-		<!-- /TMPL_LOOP -->
-		</table>
-		<input type="submit" value="Change Status">
-</form>
-	
-<!-- /TMPL_IF -->
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ACCEPTED.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ACCEPTED.tmpl
diff -N htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ACCEPTED.tmpl
--- htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ACCEPTED.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-Dear <!-- TMPL_VAR NAME="LibraryName" --> user,
-
-You have suggested that the library acquire <!-- TMPL_VAR name="title" --><!-- TMPL_IF name="author" --> by <!-- TMPL_VAR name="author" --><!-- /TMPL_IF -->.
-
-<!-- TMPL_VAR name="lib.surname" --> <!-- TMPL_VAR lib.firstname --> reviewed your suggestion today, and found it interesting. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the book arrives at the library.
-
-If you have any questions, please email us at <!-- TMPL_VAR name="libemail" -->.
-
-Thank you,
-
-<!-- TMPL_VAR NAME="LibraryName" -->
\ No newline at end of file

Index: htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl
diff -N htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl
--- htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-Dear <!-- TMPL_VAR NAME="LibraryName" --> user,
-
-You have suggested that the library acquire <!-- TMPL_VAR name="title" --><!-- TMPL_IF name="author" --> by <!-- TMPL_VAR name="author" --><!-- /TMPL_IF -->.
-
-We are pleased to inform you that the item is now part of the collection of the <!-- TMPL_VAR NAME="LibraryName" -->.
-
-If you have any questions, please email us at <!-- TMPL_VAR name="libemail" -->.
-
-Thank you,
-
-<!-- TMPL_VAR NAME="LibraryName" -->
\ No newline at end of file

Index: htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ORDERED.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ORDERED.tmpl
diff -N htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ORDERED.tmpl
--- htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_ORDERED.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-Dear <!-- TMPL_VAR NAME="LibraryName" --> user,
-
-You have suggested that the library acquire <!-- TMPL_VAR name="title" --><!-- TMPL_IF name="author" --> by <!-- TMPL_VAR name="author" --><!-- /TMPL_IF -->.
-
-We are pleased to inform you that the book has now been ordered. It should arrive soon, at which time it will be processed for addition to the collection.
-
-You will be notified again when the book is available.
-
-If you have any questions, please email us at <!-- TMPL_VAR name="libemail" -->
-
-Thank you,
-
-<!-- TMPL_VAR NAME="LibraryName" -->
\ No newline at end of file

Index: htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_REJECTED.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_REJECTED.tmpl
diff -N htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_REJECTED.tmpl
--- htdocs/intranet-tmpl/default/en/suggestion/mail_suggestion_REJECTED.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-Dear <!-- TMPL_VAR NAME="LibraryName" --> user,
-
-You have suggested that the library acquire <!-- TMPL_VAR name="title" --><!-- TMPL_IF name="author" --> by <!-- TMPL_VAR name="author" --><!-- /TMPL_IF -->.
-
-<!-- TMPL_VAR name="lib.surname" --> <!-- TMPL_VAR lib.firstname --> reviewed your request today, and has decided not to accept the suggestion at this time.
-
-If you have any questions, please email us at <!-- TMPL_VAR name="libemail" -->.
-
-Thank you,
-
-<!-- TMPL_VAR NAME="LibraryName" -->
\ No newline at end of file

Index: htdocs/intranet-tmpl/default/en/tools/barcodes.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/barcodes.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/barcodes.tmpl
--- htdocs/intranet-tmpl/default/en/tools/barcodes.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,80 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-barcodes.inc" -->
-
-<!--   START OF ADD COUNTRY CODE PANEL  -->
-<div class="countryPanel" id="addCountryCode">
- 	<form action="/cgi-bin/koha/barcodes/barcodes.pl" method="post" style="display:inline">
-		<input type="hidden" name="addCode" value="1" />
-<h4>Add a new Country Code</h4>
-<ul>
-	<li><label for="countryName">Country Name:</label> <input type="text" size="10" id="countryName" name="countryName" /></li>
-	<li><label for="countryCode">Country Code:</label> <input type="text" size="3" id="countryCode" name="countryCode" /></li>
-</ul>
-<input type="submit" name="submit" id="submit" value="Save Code"/>
-<input type="button" name="cancel" id="cancel" value="Cancel" onclick="document.getElementById('addCountryCode').style.display = 'none'" />
-	</form>
-</div>
-
-<!--   END OF ADD COUNTRY CODE PANEL  -->
-
-	<h1>Barcodes Generator</h1>
-	<h3>Generate barcodes from inventory codes</h3>
-	<ul>
-		<li>Select a range of inventary codes. You can choose a continuous range or individual inventory codes</li>
-		<li>Select the standard type to generate barcodes.</li>
-		<li>Define the page size for output the PDF.</li>
-		<li>Depending on page size, Koha will show you how the page is arranged
-		    for each barcode. You can define wich point to start printing the page.
-		</li>
-	</ul>
-	
-<!-- TMPL_IF NAME="ERROR" -->Can't find inventory codes in that range. Please try again.<!-- /TMPL_IF -->
-
-	<form id="formulario" method="POST" action="<!-- TMPL_VAR NAME="SCRIPT_NAME" -->" name="form1" onsubmit="return checkFields(this);" target="_blank">
-		<label for="rangeType">Type of Interval: </label><!-- TMPL_VAR NAME="RANGE_TYPE" -->
-
-<div id="continuous" class="panel" style="display:inline">
-	<ul>
-		<li><label for="from">From:</label><input id="from" type="text" name="from" size="20" /></li>
-		<li><label for="to">To:</label><input id="to" type="text" name="to" size="20" /></li>
-	</ul>
-</div>
-
-					 
- <div id="individuals" class="panel" style="display:none; background-color: #ffffff;">
-<label for="inventaryCode">Inventory Code: </label><input id="inventaryCode" type="text" name="inventaryCode" size="20" />
-<a href="#" onclick="addItem(); return false;">[+]</a>	
-<a href="#" onclick="removeItem(); return false;">[-]</a>
-<select id="inventaryList" size="5" style="width:150px">
-</select>
-<input type="hidden" id="individualCodes" name="individualCodes">																						
-</div>						
-
-<p>
-<label for="numbersystem">Country Code: </label><!-- TMPL_VAR NAME="NUMBER_SYSTEM" --><a href="#" onClick="addCountryCode(); return false;">[+]</a></p>
-
-<p>								<label for="pageType">Page Size</label><input type="text" id="pageType" name="pageType" readonly="readonly" disabled="disabled" value="<!-- TMPL_VAR NAME="PAGES" -->"  size="10" /><a href="/cgi-bin/koha/barcodes/printerConfig.pl">[Go to Printer Configuration]</a></p>
-								
-
-<p><label for="text_under_label">Text under label</label>
-					<input type="text" id="text_under_label" name="text_under_label" size="40" value="<!-- TMPL_VAR name="text_under_label -->" /> If this field is empty, author and title will be used instead</p>
-
-			    	<table>
-						<tr>
-							<th colspan="<!-- TMPL_VAR NAME="COL_SPAN" -->">Label number to start printing</th>
-						</tr>
-						<!-- TMPL_LOOP NAME="LABEL_TABLE" -->
-							<tr>
-								<!-- TMPL_LOOP NAME="columns" -->
-									<td>
-										<input type="radio" id="label" value="<!-- TMPL_VAR NAME="tagname" -->" name="label" <!-- TMPL_VAR NAME="check" -->>  Label  <!-- TMPL_VAR NAME="labelname" --></td>
-								<!-- /TMPL_LOOP -->
-							</tr>
-						<!-- /TMPL_LOOP -->  			    
-					</table>
-
-<input type="submit" value="Generate Barcodes" name="B1">
-<input type="reset" value="Clear Fields" name="B2">
-</form>
-
-<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
-

Index: htdocs/intranet-tmpl/default/en/tools/export.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/export.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/export.tmpl
--- htdocs/intranet-tmpl/default/en/tools/export.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Cataloging: MARC Export<!-- TMPL_INCLUDE NAME="doc-head-close-addbiblio.inc" -->
-<!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-admin.inc" -->
-<h1>MARC Export</h1>
-<div class="details"><h4>Export in MARC format the following biblios (bibliographic records only):</h4>
-<form method="post">
-<p>From biblio number: <input type="text" name="start_bib" />
-to biblio number: <input type="text" name="end_bib" /></p>
-<p>(leave blank to export every biblio)</p>
-<input type="hidden" name="op" value="export" />
-<input type="submit" value="Export" class="submit" />
-</form></div>
-<p>Note : Exporting all by this tool may take some time</p>
-
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/tools/holidays.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/holidays.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/holidays.tmpl
--- htdocs/intranet-tmpl/default/en/tools/holidays.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,347 +0,0 @@
-<!-- TMPL_INCLUDE NAME="holidays-top.inc" -->Holiday Management<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="intranet-nav-brief.inc" -->
-
-
-<div id="main">
-	<div id="bloctitle">Calendars</div>
-	<table bgcolor="#ffcc00" width="80%" cellpadding="3">
-		<tr valign="center">
-			<td><font size="4">Define the holidays</font></td>
-		</tr>
-	</table>
-	<ul>
-		<li>Search in the calendar the day you want to set as holiday.</li>
-		<li>Complete the information in the right area.</li>
-		<li>Once you finish the steps above, click Save.</li>
-	</ul>
-
-<!-- *************************************** FLAT PANELS **************************************************** -->
-<!-- *****                      Makes all the flat panel to deal with holidays                          ***** -->
-<!-- ******************************************************************************************************** -->
-
-<!-- *************************** Panel for showing already loaded holidays ********************************** -->
-<div class="panel" style="position:absolute" id="showHoliday">
- 	<form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post" style="display:inline">
-			<table style="background-color:#EFEFEF;border:1px" align="center">
-			<tr>
-				<th colspan="2">
-					<p onclick="javascript: hidePanel('showHoliday');hidePanel('information')" style="cursor:pointer">
-					   Hide Details
-					   <img src="<!-- TMPL_VAR NAME="themelang" -->/images/signClose.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle">
-					</p>
-				</th>
-			</tr>
-			<tr>
-				<td>
-					Day name
-				</td>
-				<td>
-					Library
-				</td>
-			<tr>
-			</tr>
-				<td>
-					<input type="text" size="20" id="showDayname" name="showDayname" readonly
-						   style="background-color:#FFFFFF;color:Black"/>
-					
-				</td>
-				<td>
-					<input type="text" size="20" id="showBranchName" name="showBranchName" readonly style="background-color:#FFFFFF;color:Black"/>
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2">
-					<div style="display:inline">
-						Day&nbsp;<input type="text" size="4" id="showDay" name="showDay" readonly
-						       style="background-color:#FFFFFF;color:Black"/>Month&nbsp<input type="text" size="4" id="showMonth" name="showMonth" readonly
-						        style="background-color:#FFFFFF;color:Black"/> Year<input type="text" size="4" id="showYear" name="showYear" readonly
-						       style="background-color:#FFFFFF;color:Black"/>
-						Day of the week<input type="text" size="4" id="showWeekday" name="showWeekday" readonly
-						       style="background-color:#FFFFFF;color:Black"/>		
-					</div>
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2">
-					<div style="display:inline">				
-						Day title
-					</div>
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2">
-				    Add a description to holiday day.
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2" align="center">
-					<textarea rows="4" cols="40" id="showDescription" name="showDescription"></textarea>	
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2" align="left">
-					<div id="exceptionPosibility" style="position:static;display:none">
-						<input type="radio" name="showOperation" value="exception"> Generate an exception to this holiday
-						<img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0"   style="vertical-align:middle;cursor:pointer"
-						     onclick="javascript: additionalInformation('You can make an exception for this holiday rule. This means that you will be able to say for a repeatable holiday, that there is one of those days that is going to be an exception.')">
-						<br>
-					</div>
-					<input type="radio" name="showOperation" value="delete" checked> Delete this holiday.
-					<img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle;cursor:pointer"
-						     onclick="javascript: additionalInformation('This will delete this holiday rule. In case it is a repeatable holiday, this option checks for posible exceptions. In case those exists, this option take care of set this exceptions to regular holidays.')">
-				</td>
-			</tr>
-			<tr>
-				<td align="right">
-					<input type="submit" name="submit" id="submit" value="Save">
-				</td>
-				<td align="left">
-					<input type="button" name="cancel2" id="cancel2" value="Cancel" onclick="javascript: hidePanel('showHoliday');hidePanel('information')">
-				</td>
-			</tr>
-		</table>
-	</form>
-</div>
-
-<!-- ********************************** Panel to deal with new holidays **********************************  -->
-<div class="panel" style="position:absolute" id="newHoliday">
- 	<form action="/cgi-bin/koha/tools/newHolidays.pl" method="post" style="display:inline">
-		<table style="background-color:#EFEFEF" align="center">
-			<tr>
-				<th colspan="2">
-					<p onclick="javascript: hidePanel('newHoliday');hidePanel('information')"
-					   style="cursor:pointer">
-					   Add new holiday - Hide details
-					   <img src="<!-- TMPL_VAR NAME="themelang" -->/images/signClose.gif" hspace="0" vspace="0" border="0"     
-				        style="vertical-align:middle">
-					</p>
-				</th>
-			</tr
-			><tr>
-				<td>
-					Day name
-				</td>
-				<td>
-					Library
-				</td>
-			<tr>
-			</tr>
-				<td>
-					<input type="text" size="20" id="newDayname" name="newDayname" readonly
-						   style="background-color:#FFFFFF;color:Black"/>
-					<input type="text" size="20" id="newWeekday" name="newWeekday" readonly
-						   style="background-color:#FFFFFF;color:Black"/>
-					
-				</td>
-				<td>
-					<input type="text" size="20" id="newBranchName" name="newBranchName" readonly
-						   style="background-color:#FFFFFF;color:Black"/>
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2">
-					<div style="display:inline">
-						Day&nbsp<input type="text" size="4" id="newDay" name="newDay" readonly style="background-color:#FFFFFF;color:Black"/>Month&nbsp<input type="text" size="4" id="newMonth" name="newMonth"  readonly style="background-color:#FFFFFF;color:Black"/> Year&nbsp<input type="text" size="4" id="newYear" name="newYear" readonly style="background-color:#FFFFFF;color:Black"/>
-					</div>
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2">
-					<div style="display:inline">				
-						Title day
-					</div>
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2">
-					Add a description to holiday day.
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2" align="center">
-					<textarea rows="4" cols="40" id="newDescription" name="newDescription"></textarea>	
-				</td>
-			</tr>
-			<tr>
-				<td colspan="2" align="left">
-					<input type="radio" name="newOperation" value="holiday" checked> Holiday only on this day.
-						<img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle;cursor:pointer"
-						     onclick="javascript: additionalInformation('This will take this date to make it holiday just for this time. Through this option, you can set a single holiday. For example, suppose you are in August 1st, and only for this year you want to make it holiday.')">
-					<br>
-					<input type="radio" name="newOperation" value="weekday"> Holiday repeated every same day of the week
-						<img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle;cursor:pointer"
-						     onclick="javascript: additionalInformation('This will take this week day and make it holiday. No matter what date it is, this option will repeat this rule for every week. For example, if this date correspond to a saturday, every saturdays will be holidays.')">
-					<br>
-					<input type="radio" name="newOperation" value="repeatable">Holiday repeated yearly on the same date.
-						<img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle;cursor:pointer"
-						     onclick="javascript: additionalInformation('This will take this day and month as a reference to make it holiday. Through this option, you can repeat this rule for every year. For example, if this date correspond to a August 1st, every August 1st will be holiday, no matter what year you are.')">
-				</td>
-			</tr>
-			<tr>
-				<td align="right">
-					<input type="submit" name="submit" id="submit" value="Save"/>
-				</td>
-				<td align="left">
-					<input type="button" name="cancel2" id="cancel2" value="Cancel" onclick="javascript: hidePanel('newHoliday');hidePanel('information')">
-				</td>
-			</tr>
-		</table>
- 	</form>
-</div>
-
-
-<!-- ******************************************************************************************************** -->
-<!-- ******                                END OF FLAT PANELS                                          ****** -->
-<!-- ******************************************************************************************************** -->
-
-
-
-<!-- ******************************************************************************************************** -->
-<!-- ******                             START OF INFORMATION PANEL                                     ****** -->
-<!-- ******************************************************************************************************** -->
-
-<div class="information" style="position:absolute" id="information" onclick="javascript: hidePanel('information')" onblur="javascript: hidePanel('information')">
-	<table>
-		<tr>
-			<td valign="top">
-				<img src="<!-- TMPL_VAR NAME="themelang" -->/images/info.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle">
-			</td>
-			<td valign="top">
-				<p id="explanation" style="display:inline;align:justify"></p>
-			</td>
-		</tr>
-	</table>
-</div>
-
-<!-- ******************************************************************************************************** -->
-<!-- ******                              END OF INFORMATION PANEL                                      ****** -->
-<!-- ******************************************************************************************************** -->
-
-<h1>Define the holidays for branch <!-- TMPL_VAR name="BRANCHES" --></h1>
-
-
-
-<!-- ******************************************************************************************************** -->
-<!-- ******                                 MAIN SCREEN CODE                                           ****** -->
-<!-- ******************************************************************************************************** -->
-			
-			<center>
-				<fieldset align="center" style="width:50%">
-					<legend></legend>
-						<table style="width:50%;border:0px" align="left">
-							<tr>
-								
-							</tr>
-						</table>	
-				</fieldset>	
-			</center>
-
-			<br>
-			<br>
-			<table align="center" style="width:50%">
-				<tr>
-					<th colspan="2">Calendar information<th>
-				</tr>
-				<tr valign="top" align="center">
-					<td align="center" valign="top" style="padding:2%">
-						<div id="calendar-container" align="center"></div>
-						<script type="text/javascript">
-							/* Creates all the structures to deal with all diferents kinds of holidays */
-							var week_days = new Array();
-							var holidays = new Array();
-							var exception_holidays = new Array();
-							var day_month_holidays = new Array();
-							var hola= "<!-- TMPL_VAR NAME="code" -->";
-							<!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
-							week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
-							<!-- /TMPL_LOOP -->
-							<!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
-							holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
-							<!-- /TMPL_LOOP -->
-							<!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
-							exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
-							<!-- /TMPL_LOOP -->
-							<!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
-							day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
-							<!-- /TMPL_LOOP -->
-
-							/* This function gives css clases to each kind of day */
-							function dateStatusHandler(date) {
-								var day = date.getDate();
-								var month = date.getMonth() + 1;
-								var year = date.getFullYear();
-								var weekDay = date.getDay();
-								var dayMonth = month + '/' + day;
-								var dateString = year + '/' + month + '/' + day;
-								if (exception_holidays[dateString] != null) {
-									return 'exception';
-								} else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
-									return 'repeatableday';
-								} else if (holidays[dateString] != null) {
-									return 'holiday';
-								} else {
-									return 'normalday';
-								}
-							}
-	
-							/* This function is in charge of showing the correct panel considering the kind of holiday */
-							function dateChanged(calendar) {
-								var day = calendar.date.getDate();
-								var month = calendar.date.getMonth() + 1;
-								var year = calendar.date.getFullYear();
-								var weekDay = calendar.date.getDay();
-								var dayName = calendar.date.print('%A');
-								var dayMonth = month + '/' + day;
-								var dateString = year + '/' + month + '/' + day;
-								if (calendar.dateClicked) {
-									if (holidays[dateString] != null) {
-										showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, 	holidays[dateString].description);
-									} else if (exception_holidays[dateString] != null) {
-										showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description);
-									} else if (week_days[weekDay] != null) {
-										showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, 	week_days[weekDay].description);
-									} else if (day_month_holidays[dayMonth] != null) {
-										showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description);
-									} else {
-										newHoliday(dayName, day, month, year, weekDay);
-									}
-								}
-							};
-							Calendar.setup(
-								{
-									flat : "calendar-container",
-									flatCallback : dateChanged,
-									dateStatusFunc : dateStatusHandler
-								}
-							);
-						</script>						
-					</td>
-					<td align="left" style="padding:2%">
-						<fieldset>
-							<legend>Legend</legend>
-							<div style="display:inline">
-								<img src="<!-- TMPL_VAR NAME="themelang" -->/images/regularDay.jpg" hspace="0" vspace="0" border="0" style="vertical-align:middle">
-								Working day
-							</div>
-							<br>
-							<div style="display:inline">
-								<img src="<!-- TMPL_VAR NAME="themelang" -->/images/regularHoliday.jpg" hspace="0" vspace="0" 	border="0" style="vertical-align:middle">
-								Holiday
-							</div>
-							<br>
-							<div style="display:inline">
-								<img src="<!-- TMPL_VAR NAME="themelang" -->/images/repeatable.jpg" hspace="0" vspace="0" border="0" style="vertical-align:middle">
-								Repetible holiday
-							</div>
-							<br>
-							<div style="display:inline">
-								<img src="<!-- TMPL_VAR NAME="themelang" -->/images/exception.jpg" hspace="0" vspace="0" border="0" style="vertical-align:middle">
-								Exception
-							</div>
-						</fieldset>
-					</td>
-				</tr>
-		</table>
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/tools/import.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/import.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/import.tmpl
--- htdocs/intranet-tmpl/default/en/tools/import.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,58 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Cataloging: MARC Import<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="acqui-topmenu.inc" -->
-<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
-
-<div id="main">
-
-<h1>MARC acquisition system</h1>
-<h4>Import into the reservoir</h4>
-
-<!-- TMPL_IF name="uploadmarc" -->
-<p>Import results :</p>
-<ul>
-	<li><!-- TMPL_VAR name="imported" --> imported records</li>
-	<li><!-- TMPL_VAR name="alreadyindb" --> not imported because already in catalog</li>
-	<li><!-- TMPL_VAR name="alreadyinfarm" --> not imported because already in the reservoir</li>
-	<li><!-- TMPL_VAR name="notmarcrecord" --> not imported because they seem not to be in MARC format (or ISBN/ISSN missing) !</li>
-	<li><!-- TMPL_VAR name="total" -->  records parsed</li>
-	<li><a href="/cgi-bin/koha/admin-home.pl">Back</a></li>
-</ul>
-<!-- TMPL_ELSE -->
-<ul>
-	<li>Select a file to import into the reservoir. It will be parsed, and for each ISBN found, a new baby will be created in the reservoir.</li>
-	<li>If an ISBN already exists in the reservoir, you can choose whether to ignore the new one or overwrite the old one.</li>
-	<li>You can enter a name for this import. It may be useful, when creating a biblio, to remember where the suggested MARC data comes from!</li>
-	<li>Of course, if the ISBN already exists in the active DB, the biblio will be ignored.</li>
-</ul>
-<form method="post" action="<!-- TMPL_VAR name="SCRIPT_NAME" -->" enctype="multipart/form-data">
-<table>
-	<tr>
-		<th scope="row"><label for="uploadmarc">Select the file to import: </label></th>
-		<td>
-			<input type="file" id="uploadmarc" name="uploadmarc" /><br />
-		</td>
-	</tr>
-	<tr>
-		<th scope="row"><label for="filename">Name of this import: </label></th>
-		<td>
-			<input type="text" id="filename" name="filename" />
-		</td>
-	</tr>
-	<tr>
-		<th scope="row"><label for="syntax">Character encoding: </label></th>
-		<td>
-			<select name="syntax" id="syntax"><option value="MARC21">MARC21</option><option value="UNIMARC">UNIMARC</option></select>
-		</td>
-	</tr>
-	<tr>
-		<th scope="row" rowspan="2">If ISBN is already in the reservoir: </th>
-		<td><input type="radio" name="overwrite_biblio" value="0" checked="checked" />Ignore this one, keep the existing one</td></tr>
-<tr><td>
-			<input type="radio" name="overwrite_biblio" value="1" />Overwrite the existing one with this</td>
-	</tr>
-</table><input type="submit" value="Import" />
-</form>
-<!-- /TMPL_IF -->
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/tools/koha-news.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/koha-news.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/koha-news.tmpl
--- htdocs/intranet-tmpl/default/en/tools/koha-news.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->System Administration<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
-<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
-<div id="main">
-	<h1> OPAC & KOHA News</h1>
-	<!-- TMPL_IF name="add_form" -->
-
-		<form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
-			<input type="hidden" name="op" value="<!-- TMPL_VAR NAME="op" -->">
-			<input type="hidden" name="id" value="<!-- TMPL_VAR NAME="id" -->">
-			<table style="border:0" cellspacing="0" cellpadding="2">
-			    <tr>
-			        <td>Language</td>
-			        </td>
-			        <td>
-						<select name="lang">
-				<option value="">All news</option>
-				<option value="koha">Librarian interface</option>
-				<!-- TMPL_LOOP name="lang_list" -->
-					
-						<option value="<!-- TMPL_VAR name="language" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="language" -->	</option>
-				<!-- /TMPL_LOOP -->
-			</select>
-					</td>
-			    </tr>
-				<tr>
-					<td>Title</td>
-					<td><input size="30" type="text" name="title" value="<!-- TMPL_VAR NAME="title" -->"></td>
-				</tr>
-				<tr>
-					<td>News</td>
-					<td><textarea name="new" cols="35" rows="4"><!-- TMPL_VAR NAME="new" --></textarea></td>
-				</tr>
-				<tr>
-					<td  colspan="2">
-						<input class="button" type="submit" value="Save">
-						<input class="button" type="button" value="Cancel" onclick="window.location.href='/cgi-bin/koha/tools/koha-news.pl'">
-					</td>
-				</tr>
-			</table>
-		</form>
-
-
-	<!-- TMPL_ELSE -->
-
-		<!-- TMPL_IF NAME="opac_news_count" -->
-
-            <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
-			Language:
-			
-			<select name="lang">
-				<option value="">All news</option>
-				<option value="koha">Librarian interface</option>
-				<!-- TMPL_LOOP name="lang_list" -->
-					
-						<option value="<!-- TMPL_VAR name="language" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="language" -->	</option>
-				<!-- /TMPL_LOOP -->
-			</select>
-		
-			<input type="submit" class="button" value="Filter">
-			</form>
-
-			<form name="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" onsubmit="return confirm('¿Are you sure you want to delete the selected news?')">
-				<table border="0" cellspacing="0" cellpadding="3">
-					<tr bgcolor="#99cc33">
-						<th></td>
-						<th style="padding-left:3px;padding-right:3px">Language</th>
-						<th>Date</th>
-						<th  width="20%">Title</th>
-						<th>News</th>
-						<th></th>
-					</tr>
-
-					<!-- TMPL_LOOP NAME="opac_news" -->
-						<tr>
-							<td width="5%"><input type="checkbox" name="ids" value="<!-- TMPL_VAR NAME="idnew" -->"</td>
-							<td align="center"><!-- TMPL_VAR NAME="lang" --></td>
-							<td><!-- TMPL_VAR NAME="newdate" --></td>
-							<td align="center"><!-- TMPL_VAR NAME="title" --></td>
-							<td><!-- TMPL_VAR NAME="new" --></td>
-							<td width="5%">
-								<a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=<!-- TMPL_VAR NAME="idnew" -->">Edit</a>
-							</td>
-						</tr>
-					<!-- /TMPL_LOOP -->
-
-				</table>
-					<input type="hidden" name="op" value="del">
-					<input type="submit" class="button" value="Delete selected">
-			</form>
-		<!-- TMPL_ELSE -->
-			<h5>No news loaded</h5>
-		<!-- /TMPL_IF -->
-
-		<form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
-			<input type="hidden" name="op" value="add_form">
-			<input type="submit" class="button" value="Add  news">
-		</form>
-	
-	
-	<!-- /TMPL_IF -->
-
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/tools/letter.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/letter.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/letter.tmpl
--- htdocs/intranet-tmpl/default/en/tools/letter.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,290 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-	Letters admin
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-tools.inc" -->
-
-	<!-- TMPL_IF NAME="else" -->
-		<form action="/cgi-bin/koha/tools/letter.pl" method="post">
-		<input type="text" name="searchfield" value="">
-		<input type="submit" class="button" value="Filter"></form>
-		<!-- TMPL_IF NAME="search" -->
-		<br>You Searched for <b><!-- TMPL_VAR NAME="searchfield" --></b><p><br>
-		<!-- /TMPL_IF -->
-		<table>
-		<tr>
-			<th>Module</th>
-			<th>Code</th>
-			<th>Name</th>
-			<th>&nbsp;</th>
-			<th>&nbsp;</th>
-		</tr>
-		<!-- TMPL_LOOP NAME="letter" -->
-			<tr bgcolor=<!-- TMPL_VAR NAME="toggle" --> >
-				<td><!-- TMPL_VAR NAME="module" --></td>
-				<td><!-- TMPL_VAR NAME="code" --></td>
-				<td><!-- TMPL_VAR NAME="name" --></td>
-				<td>
-					<a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=<!-- TMPL_VAR name="module" -->&amp;code=<!-- TMPL_VAR NAME="code" -->">
-						<img src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/fileopen.png"  width="32" hspace="0" vspace="0" border="0">
-					</a>
-				</td>
-				<td>
-					<a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&amp;module=<!-- TMPL_VAR name="module"-->&amp;code=<!-- TMPL_VAR NAME="code" -->">
-						<img src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/edittrash.png" width="32" hspace="0" vspace="0" border="0">
-					</a>
-				</td>
-			</tr>
-		<!-- /TMPL_LOOP -->
-		</table>
-		<form action="/cgi-bin/koha/tools/letter.pl" method="post">
-			<input type="hidden" name="op" value="add_form">
-			<br>
-			<input type="submit" class="button" value="Add Letter" title="Add Letter" alt="Add Letter">
-			<br>
-		</form>
-		<br clear="all">
-	<!-- /TMPL_IF -->
-	
-	<!-- TMPL_IF NAME="add_form" -->
-	<script language="javascript" type="text/javascript">
-		function _(s) { return s } // dummy function for gettext
-		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-		function isNotNull(f,noalert) {
-			if (f.value.length ==0) {
-	return false;
-			}
-			return true;
-		}
-		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-		function toUC(f) {
-			var x=f.value.toUpperCase();
-			f.value=x;
-			return true;
-		}
-		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-		function isNum(v,maybenull) {
-		var n = new Number(v.value);
-		if (isNaN(n)) {
-			return false;
-			}
-		if (maybenull==0 && v.value=='') {
-			return false;
-		}
-		return true;
-		}
-		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-		function isDate(f) {
-			var t = Date.parse(f.value);
-			if (isNaN(t)) {
-				return false;
-			}
-		}
-		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-		function Check(f) {
-			var ok=1;
-			var _alertString="";
-			var alertString2;
-/*			if (!(isNotNull(window.document.Aform.code))) {
-				_alertString += "\n- " + _("Code missing");
-			}*/
-/*			if (!(isNotNull(window.document.Aform.name))) {
-				_alertString += "\n- " + _("Name missing");
-			}*/
-			if (_alertString.length==0) {
-				document.Aform.submit();
-			} else {
-				alertString2  = _("Form not submitted because of the following problem(s)");
-				alertString2 += "\n------------------------------------------------------------------------------------\n";
-				alertString2 += _alertString;
-				alert(alertString2);
-			}
-		}
-		// GPL code coming from PhpMyAdmin
-		function insertValueQuery() {
-			var myQuery = document.Aform.content;
-			var myListBox = document.Aform.SQLfieldname;
-		
-			if(myListBox.options.length > 0) {
-				var chaineAj = "";
-				var NbSelect = 0;
-				for(var i=0; i<myListBox.options.length; i++) {
-					if (myListBox.options[i].selected){
-						NbSelect++;
-						if (NbSelect > 1)
-							chaineAj += ", ";
-						chaineAj += myListBox.options[i].value;
-					}
-				}
-		
-				//IE support
-				if (document.selection) {
-					myQuery.focus();
-					sel = document.selection.createRange();
-					sel.text = chaineAj;
-					document.Aform.insert.focus();
-				}
-				//MOZILLA/NETSCAPE support
-				else if (document.Aform.content.selectionStart || document.Aform.content.selectionStart == "0") {
-					var startPos = document.Aform.content.selectionStart;
-					var endPos = document.Aform.content.selectionEnd;
-					var chaineSql = document.Aform.content.value;
-					myQuery.value = chaineSql.substring(0, startPos) +'<<'+ chaineAj+'>>' + chaineSql.substring(endPos, chaineSql.length);
-				} else {
-					myQuery.value += chaineAj;
-				}
-			}
-		}
-		
-		</script>
-	<div id="bloc25">
-		<!-- TMPL_IF name="modify" -->
-			<h2 class="parameters">Modify letter</h2>
-		<!-- TMPL_ELSE -->
-			<h2 class="parameters">Add letter</h2>
-		<!-- /TMPL_IF -->
-		<form action="/cgi-bin/koha/tools/letter.pl" name="Aform" method="post">
-		<input type="hidden" name="op" value="add_validate">
-		<input type="hidden" name="checked" value="0">
-		<!-- TMPL_IF NAME="modify" -->
-			<p>
-				<label class="label100">Koha module:</label>
-				<select name="module">
-					<!-- TMPL_IF name="acquisition" -->
-						<option value="acquisition" selected>Acquisition</option>
-					<!-- TMPL_ELSE -->
-						<option value="acquisition">Acquisition</option>
-					<!-- /TMPL_IF -->
-					<!-- TMPL_IF name="catalogue" -->
-						<option value="catalogue" selected>Catalogue</option>
-					<!-- TMPL_ELSE -->
-						<option value="catalogue">Catalogue</option>
-					<!-- /TMPL_IF -->
-					<!-- TMPL_IF name="serial" -->
-						<option value="serial" selected>Serial</option>
-					<!-- TMPL_ELSE -->
-						<option value="serial">Serial</option>
-					<!-- /TMPL_IF -->
-					<!-- TMPL_IF name="circulation" -->
-						<option value="circulation" selected>Circulation</option>
-					<!-- TMPL_ELSE -->
-						<option value="circulation">Circulation</option>
-					<!-- /TMPL_IF -->
-					<!-- TMPL_IF name="members" -->
-						<option value="members" selected>Members</option>
-					<!-- TMPL_ELSE -->
-						<option value="members">Members</option>
-					<!-- /TMPL_IF -->
-					<!-- TMPL_IF name="authorities" -->
-						<option value="authorities" selected>Authorities</option>
-					<!-- TMPL_ELSE -->
-						<option value="authorities">Authorities</option>
-					<!-- /TMPL_IF -->
-					<!-- TMPL_IF name="reports" -->
-						<option value="reports" selected>Reports</option>
-					<!-- TMPL_ELSE -->
-						<option value="reports">Reports</option>
-					<!-- /TMPL_IF -->
-					<!-- TMPL_IF name="parameters" -->
-						<option value="parameters" selected>Parameters</option>
-					<!-- TMPL_ELSE -->
-						<option value="parameters">Parameters</option>
-					<!-- /TMPL_IF -->
-				</select>
-			</p>
-			<p>
-				<label class="label100">Code:</label><input type="hidden" name="code" value="<!-- TMPL_VAR NAME="code" -->"><!-- TMPL_VAR NAME="code" -->
-			</p>
-		<!-- /TMPL_IF -->
-		
-		<!-- TMPL_IF NAME="adding" -->
-			<p>
-				<label class="label100">Koha module:</label>
-				<select name="module">
-						<option value="acquisition">Acquisition</option>
-						<option value="catalogue">Catalogue</option>
-						<option value="serial">Serial</option>
-						<option value="circulation">Circulation</option>
-						<option value="members">Members</option>
-						<option value="authorities">Authorities</option>
-						<option value="reports">Reports</option>
-						<option value="parameters">Parameters</option>
-				</select>
-			</p>
-			<p>
-				<label class="label100">Code:</label><input type="text" name="code" size="20" maxlength="20">
-			</p>
-		<!-- /TMPL_IF -->
-		
-		<p>
-			<label class="label100">Name:</label><input type="text" name="name" size="100" value="<!-- TMPL_VAR NAME="name" -->">
-		</p>
-		<p>
-			<label class="label100">Title (mail subject):</label><input type="text" name="title" size="100" value="<!-- TMPL_VAR NAME="title" -->">
-		</p>
-		<p>
-			<label class="label100">Content (mail content):</label>
-		</p>
-		<p><textarea name="content" cols="80" rows="10"><!-- TMPL_VAR NAME="content" --></textarea>
-		<input type="button" name="insert" value="&lt;&lt;" onclick="insertValueQuery()" title="Insert" />
-		<select name="SQLfieldname" size=10>
-			<!-- TMPL_LOOP name="SQLfieldname" -->
-				<option value="<!-- TMPL_VAR name="value"-->"><!-- TMPL_VAR name="text"--></option>
-			<!-- /TMPL_LOOP -->
-		</select>
-		</p>
-		<p><input type="button" value="OK" onclick="Check(this.form)" class="button"></p>
-		</form>
-	</div>
-	<!-- /TMPL_IF -->
-	
-	<!-- TMPL_IF NAME="add_validate" -->
-	Data recorded
-	<form action="<!-- TMPL_VAR NAME="action" -->" method="post">
-	<input type="submit" value="OK">
-	</form>
-	<!-- /TMPL_IF -->
-	
-	<!-- TMPL_IF NAME="delete_confirm" -->
-	<table border="0" cellspacing="0" cellpadding="5">
-		<tr valign="top" bgcolor="#99cc33">
-			<td background="<!-- TMPL_VAR NAME="themelang" -->/images/background-mem.gif">
-				<b>module / Code</b>
-			</td>
-			<td background="<!-- TMPL_VAR NAME="themelang" -->/images/background-mem.gif">
-				<b><!-- TMPL_VAR name="module"--> / <!-- TMPL_VAR NAME="code" --></b>
-			</td>
-		</tr>
-	
-		<form action="<!-- TMPL_VAR NAME="action" -->" method="post"><input type="hidden" name="op" value="delete_confirmed">
-		<input type="hidden" name="code" value="<!-- TMPL_VAR NAME="code" -->">
-		<input type="hidden" name="module" value="<!-- TMPL_VAR NAME="module" -->">
-		<tr>
-			<td>Name</td>
-			<td><!-- TMPL_VAR NAME="Name" --></td>
-		</tr>
-		<tr>
-			<td colspan="2" align="center">CONFIRM DELETION</td>
-		</tr>
-		<tr>
-			<td>
-				<input type="submit" value="YES">
-				</form>
-			</td>
-			<td>
-				<form action="<!-- TMPL_VAR NAME="action" -->" method="post">
-					<input type="submit" value="NO">
-				</form>
-			</td>
-		</tr>
-	</table>
-	<!-- /TMPL_IF -->
-	
-	<!-- TMPL_IF NAME="delete_confirmed" -->
-	Data deleted
-	<form action="<!-- TMPL_VAR NAME="action" -->" method="post">
-	<input type="submit" value="OK">
-	</form>
-	<!-- /TMPL_IF -->
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
\ No newline at end of file

Index: htdocs/intranet-tmpl/default/en/tools/overduerules.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/overduerules.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/overduerules.tmpl
--- htdocs/intranet-tmpl/default/en/tools/overduerules.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,107 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- System Administration: Overdue Rules<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-
-<!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-admin.inc" -->
-
-	<h1>Defining <!-- TMPL_IF NAME="branch" -->overdue rules for <!-- TMPL_VAR NAME="branch" --><!-- TMPL_ELSE -->default overdue rules<!-- /TMPL_IF --></h1>
-	<div class="help">
-		<p>Overdue will be taken into account provided that you input delays as numbers only.</p>
-		<p>Delay is a number of days for the older issue to be taken into account before doing an action (Sending a letter)</p>
-		<p>If you want Koha to do an action (send a letter or debar member), delay is needed.</p>
-		<p>Column 1 is supposed to be filled in first, then Second one then Third one.</p>
-	</div>
-		<form method="post" action="/cgi-bin/koha/tools/overduerules.pl">
-		<label for="branch">Select a branch :</label>
-			<select id="branch" name="branch">
-				<option value="">Default</option>
-			<!-- TMPL_LOOP NAME="branchloop" -->
-				<option value="<!-- TMPL_VAR NAME="value" -->"<!-- TMPL_IF NAME="selected" --> selected="selected"<!-- /TMPL_IF -->><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_LOOP --></select>
-			<input type="submit" value="Select" />
-		</form>
-		<!--TMPL_IF Name="ERROR"-->
-		<h3>Data error</h3>
-			<p>The following fields have a forbidden value. Correct them and press OK again :</p><ul>
-			<!-- TMPL_IF NAME="ERRORDELAY" -->
-				<li>Delay <!--TMPL_VAR Name="ERRORDELAY"--> for <!--TMPL_VAR Name="bor"--> borrower category have some unexpected characters. There should be only numerical characters. </li>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF NAME="ERRORORDER" -->
-				<li>Delay1 should be less than Delay2 which should be less than Delay3 for <!--TMPL_VAR Name="bor"--> borrower category </li>
-			<!-- /TMPL_IF -->
-			</ul>
-		<!--/TMPL_IF -->
-		<form method="post" action="/cgi-bin/koha/tools/overduerules.pl">
-			<input type="hidden" name="op" value="save" />
-			
-			<table>
-			<caption>Defining Overdue rules for <!--TMPL_IF Name="branch"--><!-- TMPL_VAR NAME="branch" --><!--TMPL_ELSE--> default branch <!--/TMPL_IF-->		<!--TMPL_IF Name="datasaved"-->
-		<br /><h3 align="center">INPUT SAVED</h3>
-		<!--/TMPL_IF -->
-			</caption>
-			<tr>
-				<th>&nbsp;</th><th colspan="3" scope="col">First</th><th colspan="3" scope="col">Second</th><th colspan="3" scope="col">Third</th>
-			</tr>
-			<tr>
-				<th>&nbsp;</th><th scope="col">Delay</th><th scope="col">Letter</th><th scope="col">Debarred</th><th scope="col">Delay</th><th scope="col">Letter</th><th scope="col">Debarred</th><th scope="col">Delay</th><th scope="col">Letter</th><th scope="col">Debarred</th>
-			</tr>
-			<!-- TMPL_LOOP NAME="table" -->
-				<tr>
-					<th><!-- TMPL_VAR NAME="line" --></th>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<input name="delay1-<!-- TMPL_VAR NAME="overduename" -->" size="5" value="<!-- TMPL_VAR NAME="delay1" -->" />
-					</td>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<!--TMPL_IF Name="noletter" --><input type="text" name="letter1-<!-- TMPL_VAR NAME="overduename" -->" value="<!--TMPL_VAR Name="letter1"-->"/>
-						<!--TMPL_ELSE -->
-							<select name="letter1-<!-- TMPL_VAR NAME="overduename" -->">
-								<option value="">Default</option>
-								<!-- TMPL_LOOP name="letterloop1" -->
-									<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="lettername" --></option>
-								<!-- /TMPL_LOOP -->
-							</select>
-						<!--/TMPL_IF -->
-					</td>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<input type="checkbox" name="debarred1-<!-- TMPL_VAR NAME="overduename" -->" <!-- TMPL_IF NAME="debarred1" -->checked<!-- /TMPL_IF --> value="1" />
-					</td>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<input name="delay2-<!-- TMPL_VAR NAME="overduename" -->" size="5" value="<!-- TMPL_VAR NAME="delay2" -->" />
-					</td>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<!--TMPL_IF Name="noletter" --><input type="text" name="letter2-<!-- TMPL_VAR NAME="overduename" -->" value="<!--TMPL_VAR Name="letter2"-->"/>
-						<!--TMPL_ELSE -->
-							<select name="letter2-<!-- TMPL_VAR NAME="overduename" -->">
-								<option value="">Default</option>
-								<!-- TMPL_LOOP name="letterloop2" -->
-									<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="lettername" --></option>
-								<!-- /TMPL_LOOP -->
-							</select>
-						<!--/TMPL_IF -->
-					</td>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<input type="checkbox" name="debarred2-<!-- TMPL_VAR NAME="overduename" -->" <!-- TMPL_IF NAME="debarred2" -->checked<!-- /TMPL_IF --> value="1" />
-					</td>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<input name="delay3-<!-- TMPL_VAR NAME="overduename" -->" size="5" value="<!-- TMPL_VAR NAME="delay3" -->" />
-					</td>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<!--TMPL_IF Name="noletter" --><input type="text" name="letter3-<!-- TMPL_VAR NAME="overduename" -->" value="<!--TMPL_VAR Name="letter3"-->"/>
-						<!--TMPL_ELSE -->
-							<select name="letter3-<!-- TMPL_VAR NAME="overduename" -->">
-								<option value="">Default</option>
-								<!-- TMPL_LOOP name="letterloop3" -->
-									<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="lettername" --></option>
-								<!-- /TMPL_LOOP -->
-							</select>
-						<!--/TMPL_IF -->
-					</td>
-					<td<!-- TMPL_IF NAME="toggle" --> class="highlight"<!-- /TMPL_IF -->>
-						<input type="checkbox" name="debarred3-<!-- TMPL_VAR NAME="overduename" -->" <!-- TMPL_IF NAME="debarred3" -->checked<!-- /TMPL_IF --> value="1" />
-					</td>
-				</tr>
-			<!-- /TMPL_LOOP -->
-			</table>
-			
-			<input type="submit" value="Save Changes" />
-		</form>
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/tools/printerConfig.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/printerConfig.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/printerConfig.tmpl
--- htdocs/intranet-tmpl/default/en/tools/printerConfig.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,83 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-barcodes.inc" -->
-
-	<h1>Printer Configuration</h1>
-	<h3>Set printer configuration corresponding to your environment</h3>
-	<ul>
-		<li>Set width and height of the label that you are going to work with.</li>
-		<li>Set your system's default DPI.</li>
-		<li>Set the page type.</li>
-		<li>Select how many columns and rows are in your page type.</li>
-		<li>Set left- and bottom-margins of the page that you are going to use. This parameter will help to center the barcodes on the labels.</li>
-	</ul>
-	<br>
-	<form id="formulario" method="POST" action="<!-- TMPL_VAR NAME="SCRIPT_NAME" -->" name="form1">
-		<input type="hidden" name="saveSettings" value="1" />
-		<table>
-			<tr>
-				<th scope="row">
-					Label width (Expressed in mm)
-				</th><td> 
-					<input id="labelWidth" type="text" name="labelWidth" size="5"
-					       value="<!-- TMPL_VAR NAME="LABEL_WIDTH" -->">
-				</td></tr>
-				<th scope="row">
-					Label heigth (Expressed in mm)
-				</th><td> 
-					<input id="labelHeigth" type="text" name="labelHeigth" size="5"
-					       value="<!-- TMPL_VAR NAME="LABEL_HEIGTH" -->">
-				</td></tr>
-				<th scope="row">
-					System dpi
-				</th><td>
-					<input id="systemDpi" type="text" name="systemDpi" size="5"
-					       value="<!-- TMPL_VAR NAME="SYSTEM_DPI" -->">
-				</td></tr>
-				<th scope="row">
-					Page Type
-				</th>	<td>
-					<select name="pageType" id="pageType" size="1">
-						<!-- TMPL_IF name="A4" -->
-							<option value="A4" selected>A4</option>
-				        <!-- TMPL_ELSE -->
-							<option value="A4">A4</option>
-						<!-- /TMPL_IF -->
-						<!-- TMPL_IF name="Letter" -->
-							<option value="Letter" selected>Letter</option>
-				        <!-- TMPL_ELSE -->
-							<option value="Letter">Letter</option>
-						<!-- /TMPL_IF -->
-						<!-- TMPL_IF name="Legal" -->
-							<option value="Legal" selected>Legal</option>
-				        <!-- TMPL_ELSE -->
-							<option value="Legal">Legal</option>
-						<!-- /TMPL_IF -->
-		            </select>
-				</td></tr>
-				<th scope="row">
-					Columns
-				</th>  <td>
-					<input id="columns" type="text" name="columns" size="5"
-					       value="<!-- TMPL_VAR NAME="COLUMNS" -->">
-				</td></tr>
-				<th scope="row">
-					Rows
-				</th>   <td>
-					<input id="rows" type="text" name="rows" size="5"
-					       value="<!-- TMPL_VAR NAME="ROWS" -->">
-				</td></tr>
-				<th scope="row">
-					Margin Bottom (Expressed in mm)
-				</th>   <td>
-					<input id="marginBottom" type="text" name="marginBottom" size="5"
-					       value="<!-- TMPL_VAR NAME="MARGIN_TOP" -->">
-				</td></tr>
-				<th scope="row">
-					Margin Left (Expressed in mm)
-				</th>   <td>
-					<input id="marginLeft" type="text" name="marginLeft" size="5"
-					       value="<!-- TMPL_VAR NAME="MARGIN_LEFT" -->">
-				</td></tr>
-			</table><input type="submit" value="Save Settings" />
-	</form>
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/tools/tools-home.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/tools/tools-home.tmpl
diff -N htdocs/intranet-tmpl/default/en/tools/tools-home.tmpl
--- htdocs/intranet-tmpl/default/en/tools/tools-home.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- System Administration<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-
-<!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-tools.inc" -->
-
-<h1>Koha tools</h1>
-
-<table>
-<caption>Various tools</caption>
-	<tr>
-		<th><a href="/cgi-bin/koha/z3950/zebraqueue_windows_start.pl">ZEBRA queue starter--for Windows</a></th>
-		<td> Starts Zebra queue if stopped or system restarted. ZEBRA queue is required for the system to update ZEBRA</td>
-	</tr>
-<tr>
-	<th><a href="/cgi-bin/koha/tools/barcodes.pl">Barcode generator</a></th>
-	<td>Generate your barcodes</td>
-</tr>
-<tr>
-	<th><a href="/cgi-bin/koha/tools/holidays.pl">Holidays</a></th>
-	<td>Define holidays (days where the library is closed)</td>
-</tr>
-<tr>
-	<th><a href="/cgi-bin/koha/tools/export.pl">Export</a></th>
-	<td>Export datas</td>
-</tr>
-<tr>
-	<th><a href="/cgi-bin/koha/tools/import.pl">Import</a></th>
-	<td>Import datas in the reservoir</td>
-</tr>
-<tr>
-	<th><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></th>
-	<td>A basic news system for OPAC & librarian interfaces</td>
-</tr>
-<tr>
-	<th><a href="/cgi-bin/koha/tools/letter.pl">Letters</a></th>
-	<td>Define letters </td>
-</tr>
-<tr>
-	<th><a href="/cgi-bin/koha/tools/overduerules.pl">overdue rules</a></th>
-	<td>Rules for overdue books</td>
-</tr>
-<th><a href="/cgi-bin/koha/barcodes/cbarcodes.pl">Membership cards</a></th>
-		<td>create membership cards from member cardnumbers
-		</td>
-</table>
-
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: htdocs/intranet-tmpl/default/en/value_builder/marc21_008_holdings.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/marc21_008_holdings.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/marc21_008_holdings.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/marc21_008_holdings.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,688 +0,0 @@
-<html>
-<head>
-<title>Leader builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>0-5 Date entered on file</td>
-		<td>(auto-filled)</td>
-		<td><input type="text" name="f1" maxlength=6 size=7 value="<!-- TMPL_VAR name="f1" -->"></td>
-	</tr>
-	<tr>
-		
-		<td>06- Receive Status</td>
-		<td>
-			
-			<select name="f6" size="1">
-			<!-- TMPL_IF name="f60" -->
-                                <option value="0" SELECTED>0- Unknown</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="0">0- Unknown</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f61" -->
-				<option value="1" SELECTED>1- Other receipt status</option>
-			<!-- TMPL_ELSE -->
-				<option value="1">1- Other receipt status</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f62" -->
-				<option value="2" SELECTED>2- Complete or ceased</option>
-			<!-- TMPL_ELSE -->
-				<option value="2">2- Complete or ceased</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f63" -->
-				<option value="3" SELECTED>3- On order</option>
-			<!-- TMPL_ELSE -->
-				<option value="3">3- On order</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f64" -->
-				<option value="4" SELECTED>4-Currently Received</option>
-			<!-- TMPL_ELSE -->
-				<option value="4">4- Currently Received</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f65" -->
-				<option value="5" SELECTED>5- Not currently received</option>
-			<!-- TMPL_ELSE -->
-				<option value="5">3- Not currently</option>
-			<!-- /TMPL_IF -->
-
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>7- Method of acquisition </td>
-		<td>
-			<select name="f7" size="1">
-			<!-- TMPL_IF name="f7c" -->
-                                <option value="c" SELECTED>c- Coop/consotial purch.</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="c">0- Coop/consotial purch.</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f7d" -->
-				<option value="d" SELECTED>d- Deposit</option>
-			<!-- TMPL_ELSE -->
-				<option value="d">1- Deposit</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f7e" -->
-				<option value="e" SELECTED>e-Exchange</option>
-			<!-- TMPL_ELSE -->
-				<option value="e">2- Exchange</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f7f" -->
-				<option value="f" SELECTED>f- Free</option>
-			<!-- TMPL_ELSE -->
-				<option value="f">f- Free</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f7g" -->
-				<option value="g" SELECTED>g- Gift</option>
-			<!-- TMPL_ELSE -->
-				<option value="g">g- Gift</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f7m" -->
-				<option value="m" SELECTED>m- Membership</option>
-			<!-- TMPL_ELSE -->
-				<option value="m">m- Membership</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f7n" -->
-				<option value="n" SELECTED>n- Non library Purchase</option>
-			<!-- TMPL_ELSE -->
-				<option value="n">n-Non library Purchase</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f7p" -->
-				<option value="p" SELECTED>p- Purchase</option>
-			<!-- TMPL_ELSE -->
-				<option value="p">p- Purchase</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f7u" -->
-				<option value="u" SELECTED>u- Unknown</option>
-			<!-- TMPL_ELSE -->
-				<option value="u">u- Unknown</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f7z" -->
-				<option value="z" SELECTED>z- Other method</option>
-			<!-- TMPL_ELSE -->
-				<option value="z">z- Other method</option>
-			<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	<tr>
-                <td>08-11 Expected acquisition end date (yymm)</td>
-                <td><input type="text" name="f81" size="4"  maxlength="4" value="<!-- TMPL_VAR NAME="f81" -->"/>
- 
-	<select name="f8" size="4">
-			<!-- TMPL_IF name="f8uuuu" -->
-                                <option value="uuuu" SELECTED>uuuu-Intent to cancel</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="uuuu">uuuu- Intent to cancel</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f8||||" -->
-				<option value="||||" SELECTED>N/A</option>
-			<!-- TMPL_ELSE -->
-				<option value="||||">N/A</option>
-			<!-- /TMPL_IF -->
-			</select>                    
-        </td>
-        </tr>
-
-	<tr>
-                <td>12- General retention Policy</td>
-                <td>
-  	<select name="f12" size="1">
-			<!-- TMPL_IF name="f120" -->
-                                <option value="0" SELECTED>0- Unknown</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="0">0- Unknown</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f121" -->
-				<option value="1" SELECTED>1- Other general retention policy</option>
-			<!-- TMPL_ELSE -->
-				<option value="1">1- Other general retention policy</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f122" -->
-				<option value="2" SELECTED>2- Retained except as replaced by updates</option>
-			<!-- TMPL_ELSE -->
-				<option value="2">2- Retained except as replaced by updates</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f123" -->
-				<option value="3" SELECTED>3-  Sample issue retained</option>
-			<!-- TMPL_ELSE -->
-				<option value="3">3-  Sample issue retained</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f124" -->
-				<option value="4" SELECTED>4-Currently Received</option>
-			<!-- TMPL_ELSE -->
-				<option value="4">4- Currently Received</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f125" -->
-				<option value="5" SELECTED>5- Retained until replaced by microform</option>
-			<!-- TMPL_ELSE -->
-				<option value="5">3- Retained until replaced by microform</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f126" -->
-				<option value="6" SELECTED>6 - Retained for a limited period</option>
-			<!-- TMPL_ELSE -->
-				<option value="6">6 - Retained for a limited period</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f127" -->
-				<option value="7" SELECTED>7-Not retained</option>
-			<!-- TMPL_ELSE -->
-				<option value="7">7-Not retained</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f128" -->
-				<option value="8" SELECTED>8- Permanently reatined</option>
-			<!-- TMPL_ELSE -->
-				<option value="8">8-Permanently reatined</option>
-			<!-- /TMPL_IF -->
-			</select>              
-		 </td>
-        </tr>
-	 <tr>
-                <td>18-21 Illustrations </td>
-		<td>(auto-filled from 300)<input type="hidden" name="f1821" size="4"  maxlength="4" value="<!-- TMPL_VAR NAME="f1821" -->"/></td>
-        </tr>
-	<tr>
-                <!-- 22 Target Audience -->
-                <td>22- Target Audience</td>
-                <td>                        
-                <select name="f22" size="1">
-
-                        <!-- TMPL_IF name="f22|" -->
-                        <option value="|" SELECTED>|- Default</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="|">|- Default</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f220" -->
-                        <option value=" " SELECTED>#- Unknown or not specified</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- Unknown or not specified</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f22a" -->
-                         <option value="a" SELECTED>a- Preschool</option>
-	                <!-- TMPL_ELSE -->
-			<option value="a">a- Preschool</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22b" -->
-                         <option value="b" SELECTED>b- Primary</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="b">b- Primary</option>
-                        <!-- /TMPL_IF -->	
-
-			<!-- TMPL_IF name="f22c" -->
-                         <option value="c" SELECTED>c- Elementary and junior high</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Elementary and junior high</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22d" -->
-                         <option value="d" SELECTED>d- Secondary (senior high)</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Secondary (senior high)</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22e" -->
-                         <option value="e" SELECTED>e- Adult</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="e">e- Adult</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22f" -->
-                         <option value="f" SELECTED>f- Specialized</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Specialized</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22g" -->
-                         <option value="g" SELECTED>g- General</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="g">g- General</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22j" -->
-                         <option value="j" SELECTED>j- Juvenile</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="j">j- Juvenile</option>
-                        <!-- /TMPL_IF -->
-		</select>
-		</td>
-	<tr>
-	<tr>
-                <!-- 23 Form of an item -->
-                <td>23- Form of an item</td>
-                <td>
-                <select name="f23" size="1">
-
-                        <!-- TMPL_IF name="f230" -->
-                        <option value=" " SELECTED>#- None of the following</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- None of the following</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23a" -->
-                        <option value="a" SELECTED>a- Microfilm</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Microfilm</option>
-                        <!-- /TMPL_IF -->
-			
-			<!-- TMPL_IF name="f23b" -->
-                        <option value="b" SELECTED>b- Microfiche</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="b">b- Microfiche</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23c" -->
-                        <option value="c" SELECTED>a- Microopaque</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">a- Microopaque</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23d" -->
-                        <option value="d" SELECTED>d- Large Print</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Large Print</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23f" -->
-                        <option value="f" SELECTED>f- Braille</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Braille</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23r" -->
-                        <option value="r" SELECTED>r- Regular print reproduction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="r">r- Regular print reproduction</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23s" -->
-                        <option value="s" SELECTED>s- Electronic</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- Electronic</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23!" -->
-                        <option value="!" SELECTED>!- No attempt to code</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="!">!- No attempt to code</option>
-                        <!-- /TMPL_IF -->
-		</select>
-		</td>
-	</tr>
-	<tr>
-                <td>24-27 Nature of contents </td>
-                <td>(Derived value)
-                        <input type="hidden" name="f2427" size="4" maxlength="4" value="<!-- TMPL_VAR NAME="f2427" -->"/>                </td>
-        </tr>
-        <tr>
-                <td>28- Government Publication</td>
-                <td>
-                <select name="f28" size="1">                                    
-                        <!-- TMPL_IF name="f280" -->
-                        <option value=" " SELECTED>#- Not a government publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- Not a government publication</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28a" -->
-                        <option value="a" SELECTED>a- Autonomous or semi-autonomous component</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Autonomous or semi-autonomous component</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f28c" -->
-                        <option value="c" SELECTED>c- Multilocal</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Multilocal</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28f" -->
-                        <option value="f" SELECTED>f- Federal/national</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Federal/national</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f28i" -->
-                        <option value="i" SELECTED>i- International intergovernmental</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="i">i- International intergovernmental</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f28l" -->
-                        <option value="l" SELECTED>l- Local</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="l">l- Local</option>
-                        <!-- /TMPL_IF -->
-
-			
-                        <!-- TMPL_IF name="f28m" -->
-                        <option value="m" SELECTED>m- Multistate</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="m">m- Multistate</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28o" -->
-                        <option value="o" SELECTED>o- Government publication - level undetermined</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="o">o- Government publication - level undetermined</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28s" -->
-                        <option value="s" SELECTED>s- State, provincial,territorial,dependent,etc.</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- State,provincial,territorial,dependent,etc.</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28u" -->
-                        <option value="u" SELECTED>u- Unknown if item is government publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="u">u- Unknown if item is government publication</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28z" -->
-                        <option value="z" SELECTED>z- Other</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="z">z- Other</option>
-                        <!-- /TMPL_IF -->
-		</select>
-		</td>
-	</tr>
-        <tr>
-                <td>29- Conference publication</td>
-                <td>
-                <select name="f29" size="1">
-                        <!-- TMPL_IF name="f290" -->
-                        <option value="0" SELECTED>0- Not a conference publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not a conference publication</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f291" -->
-                        <option value="1" SELECTED>1- Conference publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Conference publication</option>
-                        <!-- /TMPL_IF -->
-
-		</select>
-		</td>
-	</tr>
-	<tr>
-                <td>30- Festschrift</td>
-                <td>
-                <select name="f30" size="1">
-                        <!-- TMPL_IF name="f300" -->
-                        <option value="0" SELECTED>0- Not a festschrift</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not a festschrift</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f301" -->
-                        <option value="1" SELECTED>1- Festschrift</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Festschrift</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        </tr>
-
-        <tr>
-                <td>31- Index</td>
-                <td>
-                <select name="f31" size="1">
-                        <!-- TMPL_IF name="f31|" -->
-                        <option value="|" SELECTED>|- Default</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="|">|- Default</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f310" -->
-                        <option value="0" SELECTED>0- No Index</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- No Index</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f311" -->
-                        <option value="1" SELECTED>1- Index present</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Index present</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        	</tr>
-		<tr><td>32 Undefined</td><td></td>
-		</tr>
-		<tr>
-                <td>33- Literary form</td>
-                <td>
-                <select name="f33" size="1">
-                        <!-- TMPL_IF name="f330" -->
-                        <option value="0" SELECTED>0- Not fiction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not fiction</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f331" -->
-                        <option value="1" SELECTED>1- Fiction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Fiction</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f33c" -->
-                        <option value="c" SELECTED>c- Comic strips</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Comic stripts</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33d" -->
-                        <option value="d" SELECTED>d- Dramas</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Dramas</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f33e" -->
-                        <option value="e" SELECTED>e- Essays</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="e">e- Essays</option>
-                        <!-- /TMPL_IF -->
-
-			
-                        <!-- TMPL_IF name="f33f" -->
-                        <option value="f" SELECTED>f- Novels</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Novels</option>
-                        <!-- /TMPL_IF -->
-
-			
-                        <!-- TMPL_IF name="f33h" -->
-                        <option value="h" SELECTED>h- Humor,satires,etc.</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="h">h- Humor,satires,etc.</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33i" -->
-                        <option value="i" SELECTED>i- Letters</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="i">i- Letters</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33j" -->
-                        <option value="j" SELECTED>j- Short stories</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="j">j- Short stories</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33m" -->
-                        <option value="m" SELECTED>m- Mixed forms</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="m">m- Mixed forms</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f33p" -->
-                        <option value="p" SELECTED>p- Poetry</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="p">p- Poetry</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f33s" -->
-                        <option value="s" SELECTED>s- Speeches</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- Speeches</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33u" -->
-                        <option value="u" SELECTED>u- Unknown</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="u">u- Unknown</option>
-                        <!-- /TMPL_IF -->
-
-
-
-                </select>
-                </td>
-        </tr>
-	<tr>
-                <td>34- Biography</td>
-                <td>
-                <select name="f34" size="1">
-                        <!-- TMPL_IF name="f340" -->
-                        <option value=" " SELECTED>#- No biographical material</option>                              <!-- TMPL_ELSE -->
-                        <option value=" ">#- No biographical material</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f34a" -->
-                        <option value="a" SELECTED>a- Autobiography</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Autobiography</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f34b" -->
-                        <option value="b" SELECTED>b- Individual biography</option>                              <!-- TMPL_ELSE -->
-                        <option value="b">b- Individual biography</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f34c" -->
-                        <option value="c" SELECTED>c- Collective biography</option>                              <!-- TMPL_ELSE -->
-                        <option value="c">c- Collective biographyl</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f34d" -->
-                        <option value="d" SELECTED>d- Contains bibliographic information</option>                              <!-- TMPL_ELSE -->
-                        <option value="d">d- Contains bibliographic information</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        </tr>
-
-	 <tr>
-
-                <td>35-37 Language see <a href="http://www.itsmarc.com/crs/lang0098.htm">MARC Code List for Languages</a></td>
-                <td>
-                        <input type="text" name="f3537" size="4"  maxlength="4" value="<!-- TMPL_VAR NAME="f3537" -->"/>
-                </td>
-        </tr>
-	<tr>
-                <td>38- Modified Record</td>
-                <td>                
-		<select name="f38" size="1">                        			
-			<!-- TMPL_IF name="f380" -->
-                        <option value=" " SELECTED>#- Not Modified</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- Not Modified</option>
-                        <!-- /TMPL_IF -->
-			
-			<!-- TMPL_IF name="f38s" -->
-                        <option value="s" SELECTED>s- Shortened</option>
-			<!-- TMPL_ELSE -->
-                        <option value="s">s- Shortened</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f38d" -->
-                        <option value="d" SELECTED>d- Dashed-on information omitted</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Dashed-on information omitted</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f38x" -->
-                        <option value="x" SELECTED>x- Missing characters</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="x">x- Missing characters</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f38r" -->
-                        <option value="r" SELECTED>r- Completely romanized/printed cards in script</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="r">r- Completely romanized/printed cards in script</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f38o" -->
-                        <option value="o" SELECTED>o- Completely romainzed/printed cards romanized</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="o">o- Completely romanized/printed cards romanized</option>
-                        <!-- /TMPL_IF -->
-		</select>
-
-                </td>
-        </tr>
-<tr>
-                <td>39- Cataloging source</td>
-                <td>
-                <select name="f39" size="1">                                    
-                        <!-- TMPL_IF name="f390" -->
-                        <option value=" " SELECTED>#- National bibliographic agency</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- National bibliographic agency</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f39c" -->
-                        <option value="c" SELECTED>c- Cooperative cataloging program</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Cooperative cataloging program</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f39d" -->
-                        <option value="d" SELECTED>d- Other</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Other</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f39u" -->
-                        <option value="u" SELECTED>u- Unknown</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="u">u- Unknown</option>
-                        <!-- /TMPL_IF -->
-		</select>
-                </td>
-        </tr>
-
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-function report() {
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value = 
-			document.f_pop.f1.value+
-			document.f_pop.f6.value+
-			document.f_pop.f710.value+
-			document.f_pop.f1114.value+
-			document.f_pop.f1517.value+
-			document.f_pop.f1821.value+
-			document.f_pop.f22.value+
-			document.f_pop.f23.value+
-			document.f_pop.f2427.value+
-			document.f_pop.f28.value+
-			document.f_pop.f29.value+
-			document.f_pop.f30.value+
-			document.f_pop.f31.value+ ' '+
-			document.f_pop.f33.value+
-			document.f_pop.f34.value+
-			document.f_pop.f3537.value+
-			document.f_pop.f38.value+
-			document.f_pop.f39.value;
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/marc21_field_006.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/marc21_field_006.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/marc21_field_006.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/marc21_field_006.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,449 +0,0 @@
-<html>
-<head>
-<title>Leader builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>0 Form of material</td>
-                <td>
-                        <select name="f0" size="1">
-                        <!-- TMPL_IF name="f0a" -->
-                                <option value="a" SELECTED>a- Language material</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="a">a- Language material</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f0b" -->
-                                <option value="b" SELECTED>b- Manuscript language material</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="b">b- Manuscript language material</option>
-                        <!-- /TMPL_IF -->
-        		</select>
-		</td>
-	</tr>
-	<tr>
-                <td>01-04 Illustrations </td>
-                <td>(auto-filled from 300)<input type="hidden" name="f014" size="4"  maxlength="4" value="<!-- TMPL_VAR NAME="f014" -->"/></td>
-        </tr>
-	        <tr>
-                <!-- 5 Target Audience -->
-                <td>5- Target Audience</td>
-                <td>
-                <select name="f5" size="1">
-
-                        <!-- TMPL_IF name="f5|" -->
-                        <option value="|" SELECTED>|- Default</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="|">|- Default</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f50" -->
-                        <option value=" " SELECTED>#- Unknown or not specified</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- Unknown or not specified</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f5a" -->
-                         <option value="a" SELECTED>a- Preschool</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Preschool</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f5b" -->
-                         <option value="b" SELECTED>b- Primary</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="b">b- Primary</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f5c" -->
-                         <option value="c" SELECTED>c- Elementary and junior high</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Elementary and junior high</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f5d" -->
-                         <option value="d" SELECTED>d- Secondary (senior high)</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Secondary (senior high)</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f5e" -->
-                         <option value="e" SELECTED>e- Adult</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="e">e- Adult</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f5f" -->
-                         <option value="f" SELECTED>f- Specialized</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Specialized</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f5g" -->
-                         <option value="g" SELECTED>g- General</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="g">g- General</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f5j" -->
-                         <option value="j" SELECTED>j- Juvenile</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="j">j- Juvenile</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        <tr>
-	 <tr>
-                <!-- 06 Form of an item -->
-                <td>06- Form of an item</td>
-                <td>
-                <select name="f6" size="1">
-
-                        <!-- TMPL_IF name="f60" -->
-                        <option value=" " SELECTED>#- None of the following</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- None of the following</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f6a" -->
-                        <option value="a" SELECTED>a- Microfilm</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Microfilm</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f6b" -->
-                        <option value="b" SELECTED>b- Microfiche</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="b">b- Microfiche</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f6c" -->
-                        <option value="c" SELECTED>a- Microopaque</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">a- Microopaque</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f6d" -->
-                        <option value="d" SELECTED>d- Large Print</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Large Print</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f6f" -->
-                        <option value="f" SELECTED>f- Braille</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Braille</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f6r" -->
-                        <option value="r" SELECTED>r- Regular print reproduction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="r">r- Regular print reproduction</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f6s" -->
-                        <option value="s" SELECTED>s- Electronic</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- Electronic</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f6!" -->
-                        <option value="!" SELECTED>!- No attempt to code</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="!">!- No attempt to code</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        </tr>
-       <tr>
-                <td>7-10 Nature of contents </td>
-                <td>(Derived value)
-                        <input type="hidden" name="f710" size="4" maxlength="4" value="<!-- TMPL_VAR NAME="f710" -->"/>                </td>
-        </tr>
-        <tr>
-                <td>11- Government Publication</td>
-                <td>
-                <select name="f11" size="1">
-		
-                        <!-- TMPL_IF name="f11|" -->
-                        <option value="|" SELECTED>|- Default</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="|">|- Default</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f110" -->
-                        <option value=" " SELECTED>#- Not a government publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- Not a government publication</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f11a" -->
-                        <option value="a" SELECTED>a- Autonomous or semi-autonomous component</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Autonomous or semi-autonomous component</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f11c" -->
-                        <option value="c" SELECTED>c- Multilocal</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Multilocal</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f11f" -->
-                        <option value="f" SELECTED>f- Federal/national</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Federal/national</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f11i" -->
-                        <option value="i" SELECTED>i- International intergovernmental</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="i">i- International intergovernmental</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f11l" -->
-                        <option value="l" SELECTED>l- Local</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="l">l- Local</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f11m" -->
-                        <option value="m" SELECTED>m- Multistate</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="m">m- Multistate</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f11o" -->
-                        <option value="o" SELECTED>o- Government publication - level undetermined</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="o">o- Government publication - level undetermined</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f11s" -->
-                        <option value="s" SELECTED>s- State, provincial,territorial,dependent,etc.</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- State,provincial,territorial,dependent,etc.</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f11u" -->
-                        <option value="u" SELECTED>u- Unknown if item is government publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="u">u- Unknown if item is government publication</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f11z" -->
-                        <option value="z" SELECTED>z- Other</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="z">z- Other</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        </tr>
-        <tr>
-                <td>12- Conference publication</td>
-                <td>
-                <select name="f12" size="1">
-                        <!-- TMPL_IF name="f120" -->
-                        <option value="0" SELECTED>0- Not a conference publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not a conference publication</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f121" -->
-                        <option value="1" SELECTED>1- Conference publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Conference publication</option>
-                        <!-- /TMPL_IF -->
-
-		</select>
-		</td>
-	</tr>
-	<tr>
-                <td>13- Festschrift</td>
-                <td>
-                <select name="f13" size="1">
-                        <!-- TMPL_IF name="f130" -->
-                        <option value="0" SELECTED>0- Not a festschrift</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not a festschrift</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f131" -->
-                        <option value="1" SELECTED>1- Festschrift</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Festschrift</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        </tr>
-
-        <tr>
-                <td>14- Index</td>
-                <td>
-                <select name="f14" size="1">
-                        <!-- TMPL_IF name="f14|" -->
-                        <option value="|" SELECTED>|- Default</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="|">|- Default</option>
-                        <!-- /TMPL_IF -->
-	
-                        <!-- TMPL_IF name="f140" -->
-                        <option value="0" SELECTED>0- No Index</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- No Index</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f141" -->
-                        <option value="1" SELECTED>1- Index present</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Index present</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        	</tr>
-		<tr><td>15 Undefined</td><td></td>
-		</tr>
-		<tr>
-                <td>16- Literary form</td>
-                <td>
-                <select name="f16" size="1">
-                        <!-- TMPL_IF name="f160" -->
-                        <option value="0" SELECTED>0- Not fiction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not fiction</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f161" -->
-                        <option value="1" SELECTED>1- Fiction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Fiction</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f16c" -->
-                        <option value="c" SELECTED>c- Comic strips</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Comic stripts</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f16d" -->
-                        <option value="d" SELECTED>d- Dramas</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Dramas</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f16e" -->
-                        <option value="e" SELECTED>e- Essays</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="e">e- Essays</option>
-                        <!-- /TMPL_IF -->
-
-			
-                        <!-- TMPL_IF name="f16f" -->
-                        <option value="f" SELECTED>f- Novels</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Novels</option>
-                        <!-- /TMPL_IF -->
-
-			
-                        <!-- TMPL_IF name="f16h" -->
-                        <option value="h" SELECTED>h- Humor,satires,etc.</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="h">h- Humor,satires,etc.</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f16i" -->
-                        <option value="i" SELECTED>i- Letters</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="i">i- Letters</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f16j" -->
-                        <option value="j" SELECTED>j- Short stories</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="j">j- Short stories</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f16m" -->
-                        <option value="m" SELECTED>m- Mixed forms</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="m">m- Mixed forms</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f16p" -->
-                        <option value="p" SELECTED>p- Poetry</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="p">p- Poetry</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f16s" -->
-                        <option value="s" SELECTED>s- Speeches</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- Speeches</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f16u" -->
-                        <option value="u" SELECTED>u- Unknown</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="u">u- Unknown</option>
-                        <!-- /TMPL_IF -->
-
-                </select>
-                </td>
-        </tr>
-	<tr>
-                <td>17- Biography</td>
-                <td>
-                <select name="f17" size="1">
-                        <!-- TMPL_IF name="f170" -->
-                        <option value=" " SELECTED>#- No biographical material</option>                              <!-- TMPL_ELSE -->
-                        <option value=" ">#- No biographical material</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f17a" -->
-                        <option value="a" SELECTED>a- Autobiography</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Autobiography</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f17b" -->
-                        <option value="b" SELECTED>b- Individual biography</option>                              <!-- TMPL_ELSE -->
-                        <option value="b">b- Individual biography</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f17c" -->
-                        <option value="c" SELECTED>c- Collective biography</option>                              <!-- TMPL_ELSE -->
-                        <option value="c">c- Collective biographyl</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f17d" -->
-                        <option value="d" SELECTED>d- Contains bibliographic information</option>                              <!-- TMPL_ELSE -->
-                        <option value="d">d- Contains bibliographic information</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        </tr>
-
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-function report() {
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value = 
-			'<!-- TMPL_VAR NAME="dateentered" -->'+
-			document.f_pop.f0.value+
-			document.f_pop.f014.value+
-			document.f_pop.f5.value+
-			document.f_pop.f6.value+
-			document.f_pop.f710.value+
-			document.f_pop.f11.value+
-			document.f_pop.f12.value+
-			document.f_pop.f13.value+
-			document.f_pop.f14.value+ ' '+
-			document.f_pop.f16.value+
-			document.f_pop.f17.value;
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/marc21_field_007.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/marc21_field_007.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/marc21_field_007.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/marc21_field_007.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,79 +0,0 @@
-<html>
-<head>
-<title>Leader builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>00 Category of material</td>
-                <td>
-                        <select name="f0" size="1">
-                        <!-- TMPL_IF name="f0t" -->
-                                <option value="t" SELECTED>t- Text</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="t">t- Text</option>
-                        <!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	<tr>
-                <td>01 Specific material designation</td>
-                <td>
-                        <select name="f1" size="1">
-                        <!-- TMPL_IF name="f1a" -->
-                                <option value="a" SELECTED>a- Regular print</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="a">a- Regular print</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f1b" -->
-                                <option value="b" SELECTED>b- Large print</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="b">b- Large print </option>
-                        <!-- /TMPL_IF -->
-			
-			<!-- TMPL_IF name="f1c" -->
-                                <option value="c" SELECTED>c- Braille</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="c">c- Braille</option>
-                        <!-- /TMPL_IF -->
-			
-			<!-- TMPL_IF name="f1d" -->
-                                <option value="d" SELECTED>d- Loose-leaf</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="d">d- Loose-leaf</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f1u" -->
-                                <option value="u" SELECTED>u- Unspecified</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="u">u- Unspecified</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f1z" -->
-                                <option value="z" SELECTED>z- Other</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="z">z- Other</option>
-                        <!-- /TMPL_IF -->
-
-                        </select>
-                </td>
-        </tr>
-
-
-
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-function report() {
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value = 
-			document.f_pop.f0.value+
-			document.f_pop.f1.value;
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/marc21_field_008.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/marc21_field_008.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/marc21_field_008.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/marc21_field_008.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,634 +0,0 @@
-<html>
-<head>
-<title>Leader builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>1-5 Date entered on file</td>
-		<td>(auto-filled)</td>
-		<td><input type="text" name="f1" maxlength=6 size=7 value="<!-- TMPL_VAR name="f1" -->"></td>
-	</tr>
-	<tr>
-		<!-- 06 Type of date / Publication status -->
-		<td>06- Type of date / Publication Status</td>
-		<td>
-			<!-- NO DATE; B.C. DATE -->
-
-			<select name="f6" size="1">
-			<!-- TMPL_IF name="f60" -->
-                                <option value=" " SELECTED>#- Blank</option>
-                        <!-- TMPL_ELSE -->
-                                <option value=" ">#- Blank</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f6b" -->
-				<option value="b" SELECTED>b- B.C. Date</option>
-			<!-- TMPL_ELSE -->
-				<option value="b">b- B.C. Date</option>
-			<!-- /TMPL_IF -->
-
-			<!-- SINGLE DATE -->
-			<!-- TMPL_IF name="f6e" -->
-                                <option value="e" SELECTED>e- Detailed date</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="e">e- Detailed date</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6s" -->
-                                <option value="s" SELECTED>s- Single date</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="s">s- Single date</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- MULTIPLE DATES -->
-			<!-- TMPL_IF name="f6i" -->
-                                <option value="i" SELECTED>i- Inclusive dates of collection</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="i">i- Inclusive dates of collection</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6k" -->
-                                <option value="k" SELECTED>k- Range of years of bulk collection</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="k">k- Range of years of bulk collection</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6m" -->
-                                <option value="m" SELECTED>m- Multiple dates</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="m">m- Multiple dates</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6p" -->
-                                <option value="p" SELECTED>p- Distribution/production date</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="p">p- Distribution/production date</option>
-			<!-- /TMPL_IF -->
-	
-			<!-- TMPL_IF name="f6r" -->
-				<option value="r" SELECTED>r- Reprint/original date</option>
-			<!-- TMPL_ELSE -->
-				<option value="r">r- Reprint/original date</option>
-			<!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f6t" -->
-                                <option value="t" SELECTED>t- Publication date and copyright date</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="t">t- Publication date and copyright date</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- UNKNOWN DATES -->
-			<!-- TMPL_IF name="f6n" -->
-                                <option value="n" SELECTED>n- Dates unknown</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="n">n- Dates unknown</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f6q" -->
-                                <option value="q" SELECTED>q- Questionable date</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="q">q- Questionable date</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f6c" -->
-                                <option value="c" SELECTED>c- Serial item currently published</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="c">c- Serial item currently published</option>
-                        <!-- /TMPL_IF -->
-				
-			<!-- TMPL_IF name="f6d" -->
-                                <option value="d" SELECTED>d- Serial item ceased publication (Dead status)</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="d">d- Serial item ceased publication (Dead status)</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6u" -->
-                                <option value="u" SELECTED>u- Serial item status unknown</option>
-                        <!-- TMPL_ELSE -->
-                                <option value="u">u- Serial item status unknown</option>
-                        <!-- /TMPL_IF -->
-
-
-	
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>7-10 Date1 / Begininning date of publication </td>
-		<td>
-			<input type="text" name="f710" size="4" maxlength="4" value="<!-- TMPL_VAR NAME="f710" -->"/>
-		</td>
-	</tr>
-	<tr>
-                <td>11-14 Date2 / ending date of publication </td>
-                <td>
-                        <input type="text" name="f1114" size="4" maxlength="4" value="<!-- TMPL_VAR NAME="f1114" -->"/>                </td>
-        </tr>
-
-	<tr>
-                <td>15-17 Place of publication, production, or execution </td>
-                <td>
-                        <input type="text" name="f1517" size="3"  maxlength="3" value="<!-- TMPL_VAR NAME="f1517" -->"/>
-                </td>
-        </tr>
-	 <tr>
-                <td>18-21 Illustrations </td>
-		<td>(auto-filled from 300)<input type="hidden" name="f1821" size="4"  maxlength="4" value="<!-- TMPL_VAR NAME="f1821" -->"/></td>
-        </tr>
-	<tr>
-                <!-- 22 Target Audience -->
-                <td>22- Target Audience</td>
-                <td>                        
-                <select name="f22" size="1">
-
-                        <!-- TMPL_IF name="f22|" -->
-                        <option value="|" SELECTED>|- Default</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="|">|- Default</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f220" -->
-                        <option value=" " SELECTED>#- Unknown or not specified</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- Unknown or not specified</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f22a" -->
-                         <option value="a" SELECTED>a- Preschool</option>
-	                <!-- TMPL_ELSE -->
-			<option value="a">a- Preschool</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22b" -->
-                         <option value="b" SELECTED>b- Primary</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="b">b- Primary</option>
-                        <!-- /TMPL_IF -->	
-
-			<!-- TMPL_IF name="f22c" -->
-                         <option value="c" SELECTED>c- Elementary and junior high</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Elementary and junior high</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22d" -->
-                         <option value="d" SELECTED>d- Secondary (senior high)</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Secondary (senior high)</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22e" -->
-                         <option value="e" SELECTED>e- Adult</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="e">e- Adult</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22f" -->
-                         <option value="f" SELECTED>f- Specialized</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Specialized</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22g" -->
-                         <option value="g" SELECTED>g- General</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="g">g- General</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f22j" -->
-                         <option value="j" SELECTED>j- Juvenile</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="j">j- Juvenile</option>
-                        <!-- /TMPL_IF -->
-		</select>
-		</td>
-	<tr>
-	<tr>
-                <!-- 23 Form of an item -->
-                <td>23- Form of an item</td>
-                <td>
-                <select name="f23" size="1">
-
-                        <!-- TMPL_IF name="f230" -->
-                        <option value=" " SELECTED>#- None of the following</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- None of the following</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23a" -->
-                        <option value="a" SELECTED>a- Microfilm</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Microfilm</option>
-                        <!-- /TMPL_IF -->
-			
-			<!-- TMPL_IF name="f23b" -->
-                        <option value="b" SELECTED>b- Microfiche</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="b">b- Microfiche</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23c" -->
-                        <option value="c" SELECTED>a- Microopaque</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">a- Microopaque</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23d" -->
-                        <option value="d" SELECTED>d- Large Print</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Large Print</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23f" -->
-                        <option value="f" SELECTED>f- Braille</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Braille</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23r" -->
-                        <option value="r" SELECTED>r- Regular print reproduction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="r">r- Regular print reproduction</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23s" -->
-                        <option value="s" SELECTED>s- Electronic</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- Electronic</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f23!" -->
-                        <option value="!" SELECTED>!- No attempt to code</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="!">!- No attempt to code</option>
-                        <!-- /TMPL_IF -->
-		</select>
-		</td>
-	</tr>
-	<tr>
-                <td>24-27 Nature of contents </td>
-                <td>(Derived value)
-                        <input type="hidden" name="f2427" size="4" maxlength="4" value="<!-- TMPL_VAR NAME="f2427" -->"/>                </td>
-        </tr>
-        <tr>
-                <td>28- Government Publication</td>
-                <td>
-                <select name="f28" size="1">                                    
-                        <!-- TMPL_IF name="f280" -->
-                        <option value=" " SELECTED>#- Not a government publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- Not a government publication</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28a" -->
-                        <option value="a" SELECTED>a- Autonomous or semi-autonomous component</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Autonomous or semi-autonomous component</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f28c" -->
-                        <option value="c" SELECTED>c- Multilocal</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Multilocal</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28f" -->
-                        <option value="f" SELECTED>f- Federal/national</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Federal/national</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f28i" -->
-                        <option value="i" SELECTED>i- International intergovernmental</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="i">i- International intergovernmental</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f28l" -->
-                        <option value="l" SELECTED>l- Local</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="l">l- Local</option>
-                        <!-- /TMPL_IF -->
-
-			
-                        <!-- TMPL_IF name="f28m" -->
-                        <option value="m" SELECTED>m- Multistate</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="m">m- Multistate</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28o" -->
-                        <option value="o" SELECTED>o- Government publication - level undetermined</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="o">o- Government publication - level undetermined</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28s" -->
-                        <option value="s" SELECTED>s- State, provincial,territorial,dependent,etc.</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- State,provincial,territorial,dependent,etc.</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28u" -->
-                        <option value="u" SELECTED>u- Unknown if item is government publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="u">u- Unknown if item is government publication</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f28z" -->
-                        <option value="z" SELECTED>z- Other</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="z">z- Other</option>
-                        <!-- /TMPL_IF -->
-		</select>
-		</td>
-	</tr>
-        <tr>
-                <td>29- Conference publication</td>
-                <td>
-                <select name="f29" size="1">
-                        <!-- TMPL_IF name="f290" -->
-                        <option value="0" SELECTED>0- Not a conference publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not a conference publication</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f291" -->
-                        <option value="1" SELECTED>1- Conference publication</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Conference publication</option>
-                        <!-- /TMPL_IF -->
-
-		</select>
-		</td>
-	</tr>
-	<tr>
-                <td>30- Festschrift</td>
-                <td>
-                <select name="f30" size="1">
-                        <!-- TMPL_IF name="f300" -->
-                        <option value="0" SELECTED>0- Not a festschrift</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not a festschrift</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f301" -->
-                        <option value="1" SELECTED>1- Festschrift</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Festschrift</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        </tr>
-
-        <tr>
-                <td>31- Index</td>
-                <td>
-                <select name="f31" size="1">
-                        <!-- TMPL_IF name="f31|" -->
-                        <option value="|" SELECTED>|- Default</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="|">|- Default</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f310" -->
-                        <option value="0" SELECTED>0- No Index</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- No Index</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f311" -->
-                        <option value="1" SELECTED>1- Index present</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Index present</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        	</tr>
-		<tr><td>32 Undefined</td><td></td>
-		</tr>
-		<tr>
-                <td>33- Literary form</td>
-                <td>
-                <select name="f33" size="1">
-                        <!-- TMPL_IF name="f330" -->
-                        <option value="0" SELECTED>0- Not fiction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="0">0- Not fiction</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f331" -->
-                        <option value="1" SELECTED>1- Fiction</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="1">1- Fiction</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f33c" -->
-                        <option value="c" SELECTED>c- Comic strips</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Comic stripts</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33d" -->
-                        <option value="d" SELECTED>d- Dramas</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Dramas</option>
-                        <!-- /TMPL_IF -->
-
-
-                        <!-- TMPL_IF name="f33e" -->
-                        <option value="e" SELECTED>e- Essays</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="e">e- Essays</option>
-                        <!-- /TMPL_IF -->
-
-			
-                        <!-- TMPL_IF name="f33f" -->
-                        <option value="f" SELECTED>f- Novels</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="f">f- Novels</option>
-                        <!-- /TMPL_IF -->
-
-			
-                        <!-- TMPL_IF name="f33h" -->
-                        <option value="h" SELECTED>h- Humor,satires,etc.</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="h">h- Humor,satires,etc.</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33i" -->
-                        <option value="i" SELECTED>i- Letters</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="i">i- Letters</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33j" -->
-                        <option value="j" SELECTED>j- Short stories</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="j">j- Short stories</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33m" -->
-                        <option value="m" SELECTED>m- Mixed forms</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="m">m- Mixed forms</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f33p" -->
-                        <option value="p" SELECTED>p- Poetry</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="p">p- Poetry</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f33s" -->
-                        <option value="s" SELECTED>s- Speeches</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="s">s- Speeches</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f33u" -->
-                        <option value="u" SELECTED>u- Unknown</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="u">u- Unknown</option>
-                        <!-- /TMPL_IF -->
-
-
-
-                </select>
-                </td>
-        </tr>
-	<tr>
-                <td>34- Biography</td>
-                <td>
-                <select name="f34" size="1">
-                        <!-- TMPL_IF name="f340" -->
-                        <option value=" " SELECTED>#- No biographical material</option>                              <!-- TMPL_ELSE -->
-                        <option value=" ">#- No biographical material</option>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="f34a" -->
-                        <option value="a" SELECTED>a- Autobiography</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="a">a- Autobiography</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f34b" -->
-                        <option value="b" SELECTED>b- Individual biography</option>                              <!-- TMPL_ELSE -->
-                        <option value="b">b- Individual biography</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f34c" -->
-                        <option value="c" SELECTED>c- Collective biography</option>                              <!-- TMPL_ELSE -->
-                        <option value="c">c- Collective biographyl</option>
-                        <!-- /TMPL_IF -->
-			
-                        <!-- TMPL_IF name="f34d" -->
-                        <option value="d" SELECTED>d- Contains bibliographic information</option>                              <!-- TMPL_ELSE -->
-                        <option value="d">d- Contains bibliographic information</option>
-                        <!-- /TMPL_IF -->
-                </select>
-                </td>
-        </tr>
-
-	 <tr>
-
-                <td>35-37 Language see <a href="http://www.itsmarc.com/crs/lang0098.htm">MARC Code List for Languages</a></td>
-                <td>
-                        <input type="text" name="f3537" size="4"  maxlength="4" value="<!-- TMPL_VAR NAME="f3537" -->"/>
-                </td>
-        </tr>
-	<tr>
-                <td>38- Modified Record</td>
-                <td>                
-		<select name="f38" size="1">                        			
-			<!-- TMPL_IF name="f380" -->
-                        <option value=" " SELECTED>#- Not Modified</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- Not Modified</option>
-                        <!-- /TMPL_IF -->
-			
-			<!-- TMPL_IF name="f38s" -->
-                        <option value="s" SELECTED>s- Shortened</option>
-			<!-- TMPL_ELSE -->
-                        <option value="s">s- Shortened</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f38d" -->
-                        <option value="d" SELECTED>d- Dashed-on information omitted</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Dashed-on information omitted</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f38x" -->
-                        <option value="x" SELECTED>x- Missing characters</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="x">x- Missing characters</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f38r" -->
-                        <option value="r" SELECTED>r- Completely romanized/printed cards in script</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="r">r- Completely romanized/printed cards in script</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f38o" -->
-                        <option value="o" SELECTED>o- Completely romainzed/printed cards romanized</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="o">o- Completely romanized/printed cards romanized</option>
-                        <!-- /TMPL_IF -->
-		</select>
-
-                </td>
-        </tr>
-<tr>
-                <td>39- Cataloging source</td>
-                <td>
-                <select name="f39" size="1">                                    
-                        <!-- TMPL_IF name="f390" -->
-                        <option value=" " SELECTED>#- National bibliographic agency</option>
-                        <!-- TMPL_ELSE -->
-                        <option value=" ">#- National bibliographic agency</option>
-                        <!-- /TMPL_IF -->
-
-                        <!-- TMPL_IF name="f39c" -->
-                        <option value="c" SELECTED>c- Cooperative cataloging program</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="c">c- Cooperative cataloging program</option>
-                        <!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f39d" -->
-                        <option value="d" SELECTED>d- Other</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="d">d- Other</option>
-                        <!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f39u" -->
-                        <option value="u" SELECTED>u- Unknown</option>
-                        <!-- TMPL_ELSE -->
-                        <option value="u">u- Unknown</option>
-                        <!-- /TMPL_IF -->
-		</select>
-                </td>
-        </tr>
-
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-function report() {
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value = 
-			document.f_pop.f1.value+
-			document.f_pop.f6.value+
-			document.f_pop.f710.value+
-			document.f_pop.f1114.value+
-			document.f_pop.f1517.value+
-			document.f_pop.f1821.value+
-			document.f_pop.f22.value+
-			document.f_pop.f23.value+
-			document.f_pop.f2427.value+
-			document.f_pop.f28.value+
-			document.f_pop.f29.value+
-			document.f_pop.f30.value+
-			document.f_pop.f31.value+ ' '+
-			document.f_pop.f33.value+
-			document.f_pop.f34.value+
-			document.f_pop.f3537.value+
-			document.f_pop.f38.value+
-			document.f_pop.f39.value;
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/marc21_leader.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/marc21_leader.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/marc21_leader.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/marc21_leader.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,328 +0,0 @@
-<html>
-<head>
-<title>Leader builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>0-4 Record size</td>
-		<td>(auto-filled)</td>
-	</tr>
-	<tr>
-		<td>5- Record status</td>
-		<td>
-			<select name="f5" size="1">
-			<!-- TMPL_IF name="f5a" -->
-				<option value=" " SELECTED>a- Increase in encoding level</option>
-			<!-- TMPL_ELSE -->
-				<option value=" ">a- Increase in encoding level</option>
-			<!-- /TMPL_IF -->
-
-			<!-- TMPL_IF name="f5c" -->
-				<option value="c" SELECTED>c- Corrected or revised</option>
-			<!-- TMPL_ELSE -->
-				<option value="c">c- Corrected or revised</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f5d" -->
-				<option value="d" SELECTED>d- Deleted</option>
-			<!-- TMPL_ELSE -->
-				<option value="d">d- Deleted</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f5n" -->
-				<option value="n" SELECTED>n- New</option>
-			<!-- TMPL_ELSE -->
-				<option value="n">n- New</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f5p" -->
-				<option value="p" SELECTED>p- Increase in encoding level from prepublication</option>
-			<!-- TMPL_ELSE -->
-				<option value="p">p- Increase in encoding level from prepublication</option>
-			<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>6- Type of record</td>
-		<td>
-			<select name="f6" size="1">
-			<!-- TMPL_IF name="f6a" -->
-				<option value="a" SELECTED>a- Language material (monography)</option>
-			<!-- TMPL_ELSE -->
-				<option value="a">a- Language material (monography)</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6c" -->
-				<option value="c" SELECTED>c- Notated music</option>
-			<!-- TMPL_ELSE -->
-				<option value="c">c- Notated music</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6d" -->
-				<option value="d" SELECTED>d- Manuscript notated music</option>
-			<!-- TMPL_ELSE -->
-				<option value="d">d- Manuscript notated music</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6e" -->
-				<option value="e" SELECTED>e- Cartographic material</option>
-			<!-- TMPL_ELSE -->
-				<option value="e">e- Cartographic material</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6f" -->
-				<option value="f" SELECTED>f - Manuscript cartographic material</option>
-			<!-- TMPL_ELSE -->
-				<option value="f">f - Manuscript cartographic material</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6g" -->
-				<option value="g" SELECTED>g - Projected medium</option>
-			<!-- TMPL_ELSE -->
-				<option value="g">g - Projected medium</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6i" -->
-				<option value="i" SELECTED>i - Nonmusical sound recording</option>
-			<!-- TMPL_ELSE -->
-				<option value="i">i - Nonmusical sound recording</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6j" -->
-				<option value="j" SELECTED>j - Musical sound recording</option>
-			<!-- TMPL_ELSE -->
-				<option value="j">j - Musical sound recording</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6k" -->
-				<option value="k" SELECTED>k - Two-dimensional nonprojectable graphic</option>
-			<!-- TMPL_ELSE -->
-				<option value="k">k - Two-dimensional nonprojectable graphic</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6m" -->
-				<option value="m" SELECTED>m - Computer file</option>
-			<!-- TMPL_ELSE -->
-				<option value="m">m - Computer file</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6o" -->
-				<option value="o" SELECTED>o - Kit</option>
-			<!-- TMPL_ELSE -->
-				<option value="o">o - Kit</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6r" -->
-				<option value="r" SELECTED>r - Three-dimensional artifact or naturally occurring object</option>
-			<!-- TMPL_ELSE -->
-				<option value="r">r - Three-dimensional artifact or naturally occurring object</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f6t" -->
-				<option value="t" SELECTED>t - Manuscript language material</option>
-			<!-- TMPL_ELSE -->
-				<option value="t">t - Manuscript language material</option>
-			<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>7- Bibliographic level</td>
-		<td>
-			<select name="f7" size="1">
-				<!-- TMPL_IF name="f7a" -->
-					<option value="a" SELECTED>a- Monographic component part</option>
-				<!-- TMPL_ELSE -->
-					<option value="a">a- Monographic component part</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f7b" -->
-					<option value="b" SELECTED>b- Serial component part</option>
-				<!-- TMPL_ELSE -->
-					<option value="b">a- Serial component part</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f7c" -->
-					<option value="c" SELECTED>c- Collection</option>
-				<!-- TMPL_ELSE -->
-					<option value="c">c- Collection</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f7d" -->
-					<option value="d" SELECTED>d- Subunit</option>
-				<!-- TMPL_ELSE -->
-					<option value="d">d- Subunit</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f7i" -->
-					<option value="i" SELECTED>i- Integrating resource</option>
-				<!-- TMPL_ELSE -->
-					<option value="i">i- Integrating resource</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f7m" -->
-					<option value="m" SELECTED>m- Monograph/item</option>
-				<!-- TMPL_ELSE -->
-					<option value="m">m- Monograph/item</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f7s" -->
-					<option value="s" SELECTED>s- Serial</option>
-				<!-- TMPL_ELSE -->
-					<option value="s">s- Serial</option>
-				<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	
-	<tr>
-		<td>8- Hierarchic level</td>
-		<td>
-			<select name="f8" size="1">
-				<!-- TMPL_IF name="f8 " -->
-					<option value=" " SELECTED>No specific type</option>
-				<!-- TMPL_ELSE -->
-					<option value=" ">No specific type</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f8a" -->
-					<option value="a" SELECTED>a- Archival</option>
-				<!-- TMPL_ELSE -->
-					<option value="a">a- Archival</option>
-				<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-
-	<tr>
-		<td>9- Encoding</td>
-		<td>
-			<select name="f9" size="1">
-				<!-- TMPL_IF name="f9 " -->
-					<option value=" " SELECTED>MARC-8</option>
-				<!-- TMPL_ELSE -->
-					<option value=" ">MARC-8</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f9a" -->
-					<option value="a" SELECTED>a- UCS/Unicode</option>
-				<!-- TMPL_ELSE -->
-					<option value="a">a- UCS/Unicode</option>
-				<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>10-16 indicator/subfields/size</td>
-		<td>(auto-filled)</td>
-	<tr>
-		<td>17- Encoding</td>
-		<td>
-			<select name="f17" size="1">
-				<!-- TMPL_IF name="f17 " -->
-					<option value=" " SELECTED>full level</option>
-				<!-- TMPL_ELSE -->
-					<option value=" ">Full level</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f171" -->
-					<option value="1" SELECTED>1- Full level, material not examined</option>
-				<!-- TMPL_ELSE -->
-					<option value="1">1- Full level, material not examined</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f172" -->
-					<option value="2" SELECTED>2 - Less-than-full level, material not examined</option>
-				<!-- TMPL_ELSE -->
-					<option value="2">2 - Less-than-full level, material not examined</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f173" -->
-					<option value="3" SELECTED>3- Abbreviated level</option>
-				<!-- TMPL_ELSE -->
-					<option value="3">3- Abbreviated level</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f174" -->
-					<option value="4" SELECTED>4- Core level</option>
-				<!-- TMPL_ELSE -->
-					<option value="4">4- Core level</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f175" -->
-					<option value="5" SELECTED>5- Partial (preliminary) level</option>
-				<!-- TMPL_ELSE -->
-					<option value="5">5- Partial (preliminary) level</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f177" -->
-					<option value="7" SELECTED>7- Minimal level</option>
-				<!-- TMPL_ELSE -->
-					<option value="7">7- Minimal level</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f178" -->
-					<option value="8" SELECTED>8- Prepublication level</option>
-				<!-- TMPL_ELSE -->
-					<option value="8">8- Prepublication level</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f17u" -->
-					<option value="u" SELECTED>u - Unknown</option>
-				<!-- TMPL_ELSE -->
-					<option value="u">u - Unknown</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f17z" -->
-					<option value="z" SELECTED>z- Not applicable</option>
-				<!-- TMPL_ELSE -->
-					<option value="z">z- Not applicableFull level</option>
-				<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-
-	<tr>
-		<td>18 - Descriptive cataloging form</td>
-		<td>
-			<select name="f18" size="1">
-				<!-- TMPL_IF name="f18 " -->
-					<option value=" " SELECTED>Non-ISBD</option>
-				<!-- TMPL_ELSE -->
-					<option value=" ">Non-ISBD</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f18a" -->
-					<option value="a" SELECTED>a- AACR 2</option>
-				<!-- TMPL_ELSE -->
-					<option value="a">a- AACR 2</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f18i" -->
-					<option value="i" SELECTED>i- ISBD</option>
-				<!-- TMPL_ELSE -->
-					<option value="i">i- ISBD</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f18u" -->
-					<option value="u" SELECTED>u- Unknown</option>
-				<!-- TMPL_ELSE -->
-					<option value="u">u- Unknown</option>
-				<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	
-	<tr>
-		<td>19 - Linked record requirement</td>
-		<td>
-			<select name="f19" size="1">
-				<!-- TMPL_IF name="f19 " -->
-					<option value=" " SELECTED>Related record not required</option>
-				<!-- TMPL_ELSE -->
-					<option value=" ">Related record not required</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f19r" -->
-					<option value="r" SELECTED>r- Related record required</option>
-				<!-- TMPL_ELSE -->
-					<option value="r">r- Related record required</option>
-				<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>20-23 entry map & lengths</td>
-		<td>(auto-filled)</td>
-	<tr>
-
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-function report() {
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value = 
-			'     '+
-			document.f_pop.f5.value+
-			document.f_pop.f6.value+
-			document.f_pop.f7.value+
-			document.f_pop.f8.value+
-			document.f_pop.f9.value+ 
-			'22     '+
-			document.f_pop.f17.value+
-			document.f_pop.f18.value+
-			document.f_pop.f19.value+
-			'4500';
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_authorities.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_authorities.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_authorities.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_authorities.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,117 +0,0 @@
-<html>
-<head>
-<title>Leader builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>0-4 Record size</td>
-		<td>(auto-filled)</td>
-	</tr>
-	<tr>
-		<td>5- Record status</td>
-		<td>
-			<select name="f5" size="1">
-			<!-- TMPL_IF name="f5a" -->
-				<option value="a" SELECTED>a- Increase in encoding</option>
-			<!-- TMPL_ELSE -->
-				<option value="a">a- Corrected or revised</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f5c" -->
-				<option value="c" SELECTED>c- Corrected or revised</option>
-			<!-- TMPL_ELSE -->
-				<option value="c">c- Corrected or revised</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f5d" -->
-				<option value="d" SELECTED>d- Deleted</option>
-			<!-- TMPL_ELSE -->
-				<option value="d">d- Deleted</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f5n" -->
-				<option value="n" SELECTED>n- New</option>
-			<!-- TMPL_ELSE -->
-				<option value="n">n- New</option>
-			<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>6- Type of record</td>
-		<td>
-			<select name="f6" size="1">
-			<!-- TMPL_IF name="f6z" -->
-				<option value="z" SELECTED>z-Authority data</option>
-			<!-- TMPL_ELSE -->
-				<option value="z">z-Authority data</option>
-			<!-- /TMPL_IF -->
-			
-			</select>
-		</td>
-	</tr>
-	
-
-	<tr>
-		<td>9- Encoding</td>
-		<td>
-			<select name="f9" size="1">
-				<!-- TMPL_IF name="f9 " -->
-					<option value=" " SELECTED>MARC-8</option>
-				<!-- TMPL_ELSE -->
-					<option value=" ">MARC-8</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f9a" -->
-					<option value="a" SELECTED>a- UCS/Unicode</option>
-				<!-- TMPL_ELSE -->
-					<option value="a">a- UCS/Unicode</option>
-				<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	
-		<td>17- Encoding level</td>
-		<td>
-			<select name="f17" size="1">
-				<!-- TMPL_IF name="f17n" -->
-					<option value="n" SELECTED>Complete authority</option>
-				<!-- TMPL_ELSE -->
-					<option value="n">Complete authority</option>
-				<!-- /TMPL_IF -->
-				
-				<!-- TMPL_IF name="f17o" -->
-					<option value="o" SELECTED>z- Incomplete</option>
-				<!-- TMPL_ELSE -->
-					<option value="o">z- Incomplete</option>
-				<!-- /TMPL_IF -->
-				
-			</select>
-		</td>
-	</tr>
-
-	<tr>
-		
-	</tr>
-	
-	
-	
-
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-function report() {
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value = 
-			'     '+
-			document.f_pop.f5.value+
-			document.f_pop.f6.value+'||'+
-			document.f_pop.f9.value+ 
-			'22     '+
-			document.f_pop.f17.value+
-			'||4500';
-			
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_holdings.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_holdings.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_holdings.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/marc21_leader_holdings.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,177 +0,0 @@
-<html>
-<head>
-<title>Leader builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>0-4 Record size</td>
-		<td>(auto-filled)</td>
-	</tr>
-	<tr>
-		<td>5- Record status</td>
-		<td>
-			<select name="f5" size="1">
-			
-			<!-- TMPL_IF name="f5c" -->
-				<option value="c" SELECTED>c- Corrected or revised</option>
-			<!-- TMPL_ELSE -->
-				<option value="c">c- Corrected or revised</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f5d" -->
-				<option value="d" SELECTED>d- Deleted</option>
-			<!-- TMPL_ELSE -->
-				<option value="d">d- Deleted</option>
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF name="f5n" -->
-				<option value="n" SELECTED>n- New</option>
-			<!-- TMPL_ELSE -->
-				<option value="n">n- New</option>
-			<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>6- Type of record</td>
-		<td>
-			<select name="f6" size="1">
-
-			<!-- TMPL_IF name="f6u" -->
-				<option value="u" SELECTED>u-Unknown</option>
-			<!-- TMPL_ELSE -->
-				<option value="u">u-Unknown</option>
-			<!-- /TMPL_IF -->
-	
-			<!-- TMPL_IF name="f6v" -->
-				<option value="v" SELECTED>v-Multipart item holdings</option>
-			<!-- TMPL_ELSE -->
-				<option value="v">v-Multipart item holdings</option>
-			<!-- /TMPL_IF -->
-	
-			<!-- TMPL_IF name="f6x" -->
-				<option value="x" SELECTED>xSingle part item holdings</option>
-			<!-- TMPL_ELSE -->
-				<option value="x">x-Single part item holdings</option>
-			<!-- /TMPL_IF -->
-				
-			<!-- TMPL_IF name="f6y" -->
-				<option value="y" SELECTED>y-Serial item holdings</option>
-			<!-- TMPL_ELSE -->
-				<option value="y">y-Serial item holdings</option>
-			<!-- /TMPL_IF -->
-			
-			</select>
-		</td>
-	</tr>
-	
-
-	<tr>
-		<td>9- Encoding</td>
-		<td>
-			<select name="f9" size="1">
-				<!-- TMPL_IF name="f9 " -->
-					<option value=" " SELECTED>MARC-8</option>
-				<!-- TMPL_ELSE -->
-					<option value=" ">MARC-8</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f9a" -->
-					<option value="a" SELECTED>a- UCS/Unicode</option>
-				<!-- TMPL_ELSE -->
-					<option value="a">a- UCS/Unicode</option>
-				<!-- /TMPL_IF -->
-			</select>
-		</td>
-	</tr>
-	
-		<td>17- Encoding level</td>
-		<td>
-			<select name="f17" size="1">
-		<!-- TMPL_IF name="f171" -->
-					<option value="1" SELECTED>1-Level 1</option>
-				<!-- TMPL_ELSE -->
-					<option value="1">1-Level 1</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f172" -->
-					<option value="2" SELECTED>2-Level 2</option>
-				<!-- TMPL_ELSE -->
-					<option value="2">2-Level 2</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f173" -->
-					<option value="3" SELECTED>3-Level 3</option>
-				<!-- TMPL_ELSE -->
-					<option value="3">3-Level 3</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f174" -->
-					<option value="4" SELECTED>4-Level 4</option>
-				<!-- TMPL_ELSE -->
-					<option value="4">4-Level 4</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f175" -->
-					<option value="5" SELECTED>5-Level 4 with piece designtn.</option>
-				<!-- TMPL_ELSE -->
-					<option value="5">5-Level 4 with piece designtn</option>
-				<!-- /TMPL_IF -->
-		
-				<!-- TMPL_IF name="f17m" -->
-					<option value="m" SELECTED>m-Mixed</option>
-				<!-- TMPL_ELSE -->
-					<option value="m">m-Mixed</option>
-				<!-- /TMPL_IF -->
-				
-				<!-- TMPL_IF name="f17u" -->
-					<option value="u" SELECTED>u-Unknown</option>
-				<!-- TMPL_ELSE -->
-					<option value="u">u-Unknown</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f17z" -->
-					<option value="z" SELECTED>z-Other</option>
-				<!-- TMPL_ELSE -->
-					<option value="z">z-Other</option>
-				<!-- /TMPL_IF -->
-				
-			</select>
-		</td>
-	</tr><td>18- Item information in record</td>
-		<td>
-			<select name="f18" size="1">
-		<!-- TMPL_IF name="f18i" -->
-					<option value="i" SELECTED>i-Item information</option>
-				<!-- TMPL_ELSE -->
-					<option value="i">i-Item information</option>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF name="f18n" -->
-					<option value="n" SELECTED>n-No information</option>
-				<!-- TMPL_ELSE -->
-					<option value="n">n-No information</option>
-				<!-- /TMPL_IF -->
-</td>
-
-	<tr>
-		
-	</tr>
-	
-	
-	
-
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-function report() {
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value = 
-			'     '+
-			document.f_pop.f5.value+
-			document.f_pop.f6.value+'||'+
-			document.f_pop.f9.value+ 
-			'22     '+
-			document.f_pop.f17.value+
-			document.f_pop.f18.value+
-			'|4500';
-			
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-<html>
-<head>
-<title>UNIMARC Field 100 builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>Date d'enregistrement </td>
-		<td><input type="text" name="f1" maxlength=8 size=8 value="<!-- TMPL_VAR name="f1" -->"></td>
-	</tr>
-	<tr>
-		<td>Code date publication </td><td><select name="f2" size="1">
-		<option value="a" <!-- TMPL_IF name="f2a" -->SELECTED<!-- /TMPL_IF -->>périodique en cours</option>
-			<option value="b" <!-- TMPL_IF name="f2b" -->SELECTED<!-- /TMPL_IF -->>périodique mort</option>
-			<option value="c" <!-- TMPL_IF name="f2c" -->SELECTED<!-- /TMPL_IF -->>périodique d'état inconnu</option>
-			<option value="d" <!-- TMPL_IF name="f2d" -->SELECTED<!-- /TMPL_IF -->>monographie complète</option>
-			<option value="e" <!-- TMPL_IF name="f2e" -->SELECTED<!-- /TMPL_IF -->>reproduction</option>
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>Année début</td>
-		<td><input type="text" name="f3" maxlength=4 size=5 value="<!-- TMPL_VAR name="f3" -->"></td>
-	</tr>
-	<tr>
-	<td>Année fin</td>
-	<td><input type="text" name="f4" maxlength=4 size=5 value="<!-- TMPL_VAR name="f4" -->"></td>
-	</tr>
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-	function report() {
-		document.f_pop.f1.value=document.f_pop.f1.value+'        ';
-		document.f_pop.f3.value=document.f_pop.f3.value+'    ';
-		document.f_pop.f4.value=document.f_pop.f4.value+'    ';
-		document.f_pop.f1.value=document.f_pop.f1.value.substring(0,8);
-		document.f_pop.f3.value=document.f_pop.f3.value.substring(0,4);
-		document.f_pop.f4.value=document.f_pop.f4.value.substring(0,4);
-
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value= document.f_pop.f1.value + document.f_pop.f2.value +document.f_pop.f3.value +document.f_pop.f4.value;
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_105.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_105.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_105.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_105.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-<html>
-<head>
-<title>UNIMARC Field 100 builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>Date d'enregistrement </td>
-		<td><input type="text" name="f1" maxlength=8 size=8 value="<!-- TMPL_VAR name="f1" -->"></td>
-	</tr>
-	<tr>
-		<td>Code date publication </td><td><select name="f2" size="1">
-		<option value="a" <!-- TMPL_IF name="f2a" -->SELECTED<!-- /TMPL_IF -->>p?riodique en cours</option>
-			<option value="b" <!-- TMPL_IF name="f2b" -->SELECTED<!-- /TMPL_IF -->>p?riodique mort</option>
-			<option value="c" <!-- TMPL_IF name="f2c" -->SELECTED<!-- /TMPL_IF -->>p?riodique d'?tat inconnu</option>
-			<option value="d" <!-- TMPL_IF name="f2d" -->SELECTED<!-- /TMPL_IF -->>monographie compl?te</option>
-			<option value="e" <!-- TMPL_IF name="f2e" -->SELECTED<!-- /TMPL_IF -->>reproduction</option>
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>Ann?e d?but</td>
-		<td><input type="text" name="f3" maxlength=4 size=5 value="<!-- TMPL_VAR name="f3" -->"></td>
-	</tr>
-	<tr>
-	<td>Ann?e fin</td>
-	<td><input type="text" name="f4" maxlength=4 size=5 value="<!-- TMPL_VAR name="f4" -->"></td>
-	</tr>
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-	function report() {
-		document.f_pop.f1.value=document.f_pop.f1.value+'        ';
-		document.f_pop.f3.value=document.f_pop.f3.value+'    ';
-		document.f_pop.f4.value=document.f_pop.f4.value+'    ';
-		document.f_pop.f1.value=document.f_pop.f1.value.substring(0,8);
-		document.f_pop.f3.value=document.f_pop.f3.value.substring(0,4);
-		document.f_pop.f4.value=document.f_pop.f4.value.substring(0,4);
-
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value= document.f_pop.f1.value + document.f_pop.f2.value +document.f_pop.f3.value +document.f_pop.f4.value;
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_225a.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_225a.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_225a.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_225a.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-<html>
-<head>
-<title>UNIMARC Field 225a builder</title>
-</head>
-<body>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>Select a collection</td>
-		<td><!-- TMPL_VAR name="collection" --></td>
-	</tr>
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-	function report() {
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value= document.f_pop.f1.value;
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_60X.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_60X.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_60X.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_60X.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,109 +0,0 @@
-<html>
-<head>
-	<title>Thesaurus search</title>
-</head>
-<body>
-	<script>
-		function report(value2report) {
-			if (document.f_pop.result.value.length==0) {
-				document.f_pop.result.value = value2report;
-			} else {
-				document.f_pop.result.value = document.f_pop.result.value+'|'+value2report;
-			}
-			return true;
-		}
-	</script>
-	<script>
-		function finish() {
-			opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value= document.f_pop.result.value;
-			self.close();
-			return false;
-		}
-	</script>
-	<form name="f_pop" action="plugin_launcher.pl" method="post">
-		<input type="hidden" name="plugin_name" value="unimarc_field_60X.pl">
-		<textarea name="result" rows=10 cols=50><!-- TMPL_VAR name="result" --></textarea>
-		<br/><input type="button" value="OK" onClick="javascript:finish()">
-		<p><h2>Recherche</h2>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=A">A</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=B">B</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=C">C</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=D">D</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=E">E</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=F">F</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=G">G</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=H">H</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=I">I</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=J">J</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=K">K</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=L">L</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=M">M</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=N">N</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=O">O</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=P">P</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=Q">Q</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=R">R</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=S">S</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=T">T</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=U">U</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=V">V</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=W">W</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=X">X</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=Y">Y</a>
-			<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&search_string=Z">Z</a>
-			<br/>
-			<input type="text" name="search_string" value="<!-- TMPL_VAR name="search_string" -->">
-			<input type="hidden" name="category" value="<!-- TMPL_VAR name="category" -->">
-			<input type="hidden" name="index" value="<!-- TMPL_VAR name="index" -->">
-			<input type="hidden" name="op" value="search">
-			<input type="submit" value="Chercher">
-		</p>
-	</form>
-	<table>
-	<tr>
-		<td valign="top">
-		<h2>Results</h2>
-			<table>
-				<!-- TMPL_LOOP name="results" -->
-					<tr>
-					<td>
-						<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&index=<!-- TMPL_VAR name="index" -->&level=<!-- TMPL_VAR name="level" -->&search_string=<!-- TMPL_VAR name=value ESCAPE=URL -->">
-							<!-- TMPL_VAR name="value" -->
-						</a>
-					</td>
-					<td>
-						<input type="button" value="Reporter" OnClick="javascript:report('<!-- TMPL_VAR name="value" -->')"><br/>
-					</td>
-					</tr>
-				<!-- /TMPL_LOOP -->
-			</table>
-		</td>
-		<td>
-		<!-- TMPL_IF name=deeper -->
-		<td valign="top">
-			<h2>Dependancies</h2>
-			<!-- /TMPL_IF -->
-			<table>
-			<!-- TMPL_LOOP name="deeper" -->
-				<tr><td>
-				<a href="plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&index=<!-- TMPL_VAR name="index" -->&level=<!-- TMPL_VAR name="level" -->&search_string=<!-- TMPL_VAR ESCAPE="URL" name="father" -->+<!-- TMPL_VAR ESCAPE="URL" name="stdlib" -->">
-					<!-- TMPL_VAR name="father" --> <!-- TMPL_VAR name="stdlib" -->
-				</a></td>
-				<td>
-					<input type="button" value="Reporter" OnClick="javascript:report('<!-- TMPL_VAR ESCAPE=HTML name="father" --> <!-- TMPL_VAR ESCAPE=HTML name="stdlib" -->')"><br/>
-				</td></tr>
-			<!-- /TMPL_LOOP -->
-			</table>
-		</td>
-	</tr>
-	</table>
-<h2>Adding</h2>
-<form name="f3_pop"  action="thesaurus_popup.pl" method="post">
-	<input type="hidden" name="index" value="<!-- TMPL_VAR name="index" -->">
-	<input type="hidden" name="op" value="add">
-	<input type="hidden" name="category" value="<!-- TMPL_VAR name="category" -->">
-	Create a new authority/thesaurus entry : <input type="text" name="insert" value="<!-- TMPL_VAR name="search_string" -->">
-	<input type="submit" name="NEW" value="Ajouter">
-	</form>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700-4.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700-4.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700-4.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700-4.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,34 +0,0 @@
-<html>
-<head>
-<title>UNIMARC constructeur champ 700-4</title>
-</head>
-<body>
-<p>Sélectionnez la valeur pour le champ 700 $4. Elle sera automatiquement reportée dans la zone 700 $8 qui suit.</p>
-<form name="f_pop" onSubmit="javascript:report()">
-<table>
-	<tr>
-		<td>Code date publication </td><td><select name="f1" size="1">
-		<option value="075 - postface" <!-- TMPL_IF name="f1_075" -->SELECTED<!-- /TMPL_IF -->>postface</option>
-			<option value="651 - dir. de publication" <!-- TMPL_IF name="f1_651" -->SELECTED<!-- /TMPL_IF -->>dir. de publication</option>
-			<option value="440 - illustrateur" <!-- TMPL_IF name="f1_440" -->SELECTED<!-- /TMPL_IF -->>illustrateur</option>
-			<option value="080 - préface, notes" <!-- TMPL_IF name="f1_080" -->SELECTED<!-- /TMPL_IF -->>préface, notes</option>
-			<option value="730 - traducteur" <!-- TMPL_IF name="f1_730" -->SELECTED<!-- /TMPL_IF -->>traducteur</option>
-			</select>
-		</td>
-	</tr>
-	<tr><td colspan=2><input type="submit" value="OK"></td></tr>
-</table>
-</form>
-<script>
-	function report() {
-		x = document.f_pop.f1.value.split(' - ');
-		opener.document.f.field_value[<!-- TMPL_VAR name="index" -->].value= x[0];
-		if (<!-- TMPL_VAR name="index2" -->>0) {
-			opener.document.f.field_value[<!-- TMPL_VAR name="index2" -->].value= x[1];
-		}
-		self.close();
-		return false;
-	}
-</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700_701_702.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700_701_702.tmpl
diff -N htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700_701_702.tmpl
--- htdocs/intranet-tmpl/default/en/value_builder/unimarc_field_700_701_702.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,65 +0,0 @@
-<html>
-<head>
-<title>Personal Authorities builder</title>
-</head>
-<body>
-	<form name="f_pop" action="plugin_launcher.pl" method="post">
-	<input type="hidden" name="plugin_name" value="unimarc_field_700_701_702.pl">
-	<textarea name="result" rows=10 cols=60><!-- TMPL_VAR name="result" --></textarea></br>
-	<p><input type="text" name="search_string" value="<!-- TMPL_VAR name="search_string" -->">
-	<input type="hidden" name="index" value="<!-- TMPL_VAR name="index" -->">
-	<input type="hidden" name="op" value="search">
-	<input type="hidden" name="a" value="<!-- TMPL_VAR name="a" -->">
-	<input type="hidden" name="b" value="<!-- TMPL_VAR name="b" -->">
-	<input type="hidden" name="c" value="<!-- TMPL_VAR name="c" -->">
-	<input type="hidden" name="f" value="<!-- TMPL_VAR name="f" -->">
-	<input type="submit" value="Search"><input type="button" value="END" onClick="javascript:report()">
-	</form>
-<!-- TMPL_IF name="search_string" -->
-	<form name="f2_pop"  action="plugin_launcher.pl" method="post">
-	<input type="hidden" name="plugin_name" value="unimarc_field_700_701_702.pl">
-	<!-- TMPL_VAR name="select_list" -->
-	<input type="hidden" name="index" value="<!-- TMPL_VAR name="index" -->">
-	<input type="hidden" name="op" value="select">
-	<input type="hidden" name="result" value="<!-- TMPL_VAR name="result" -->">
-	<input type="submit" name="OK" value="OK">
-	</form>
-<!-- /TMPL_IF -->
-	<form name="f3_pop"  action="plugin_launcher.pl" method="post">
-	<input type="hidden" name="plugin_name" value="unimarc_field_700_701_702.pl">
-	<input type="hidden" name="index" value="<!-- TMPL_VAR name="index" -->">
-	<input type="hidden" name="op" value="add">
-	insert a new authority : <input type="text" name="insert" value="<!-- TMPL_VAR name="search_string" -->">
-	<input type="submit" name="NEW" value="NEW">
-	</form>
-		<script>
-		function report() {
-			var index_start=<!-- TMPL_VAR name="index" -->;
-			opener.document.f.field_value[index_start].value= document.f_pop.result.value;
-			var whichfield = opener.document.f.tag[index_start].value;
-			for (i=index_start ; i<opener.document.f.field_value.length ; i++) {
-				if (opener.document.f.tag[i].value == whichfield && opener.document.f.subfield[i].value == 'a') {
-					opener.document.f.field_value[i].value = document.f_pop.a.value;
-				}
-			}
-			for (i=index_start ; i<opener.document.f.field_value.length ; i++) {
-				if (opener.document.f.tag[i].value == whichfield && opener.document.f.subfield[i].value == 'b') {
-					opener.document.f.field_value[i].value = document.f_pop.b.value;
-				}
-			}
-			for (i=index_start ; i<opener.document.f.field_value.length ; i++) {
-				if (opener.document.f.tag[i].value == whichfield && opener.document.f.subfield[i].value == 'c') {
-					opener.document.f.field_value[i].value = document.f_pop.c.value;
-				}
-			}
-			for (i=index_start ; i<opener.document.f.field_value.length ; i++) {
-				if (opener.document.f.tag[i].value == whichfield && opener.document.f.subfield[i].value == 'f') {
-					opener.document.f.field_value[i].value = document.f_pop.f.value;
-				}
-			}
-			self.close();
-			return false;
-		}
-		</script>
-</body>
-</html>

Index: htdocs/intranet-tmpl/default/en/z3950/searchresult.tmpl
===================================================================
RCS file: htdocs/intranet-tmpl/default/en/z3950/searchresult.tmpl
diff -N htdocs/intranet-tmpl/default/en/z3950/searchresult.tmpl
--- htdocs/intranet-tmpl/default/en/z3950/searchresult.tmpl	10 Mar 2007 01:54:30 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,69 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Catalog: Z3950 Clients Search<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-
-
-<div id="main-compact">
-<table>
-<!-- TMPL_IF name="opsearch" -->
-<h3>Select Search Libraries</h3>
-
-
-<form method="post" action="search.pl" name="f">
-
-<input type="hidden" name="op" id="op" value="do_search" />
-<input type="hidden" name="title" value=<!-- TMPL_VAR NAME="title" --> />
-<input type="hidden" name="author" value=<!-- TMPL_VAR NAME="author" --> />
-<input type="hidden" name="isbn" value=<!-- TMPL_VAR NAME="isbn" --> />
-<input type="hidden" name="issn" value=<!-- TMPL_VAR NAME="issn" --> />
-<input type="hidden" name="oldbiblionumber" value="<!-- TMPL_VAR NAME="oldbiblionumber" -->" />
-
-<tr>
-		<th>Library</th>
-		<th>Select</th>
-</tr>
-<!-- TMPL_LOOP name="serverloop" -->
-		<tr bgcolor="<!-- TMPL_VAR NAME="toggle" -->">
-			<td><!-- TMPL_VAR NAME="server" --></td>
-			
-			<td> <input type="checkbox" name="id" value=<!-- TMPL_VAR NAME="id" --> <!-- TMPL_IF name="checked" -->checked="1"<!-- /TMPL_IF --> ></td>
-	</tr>
-	<!-- /TMPL_LOOP -->
-	<tr><td><input type="submit"  class="submit" value="Search internet" onclick="cursor :'wait'";
-	 /></td></tr></form>
-<!-- TMPL_ELSE -->
-
-<caption>Bibliographic Records Found in <!-- TMPL_VAR NAME="server" --></caption>
-	<tr>
-		<th>Title</th>
-		<th>Author</th>
-		<th>ISBN</th>
-		<th>&nbsp;</th>
-		<th>&nbsp;</th>
-	</tr>
-	<!-- TMPL_IF name="breeding_loop" -->
-	<!-- TMPL_LOOP name="breeding_loop" --> 
-		<tr bgcolor="<!-- TMPL_VAR NAME="toggle" -->">
-			<td><!-- TMPL_VAR NAME="title" --></a>
-			<td><!-- TMPL_VAR NAME="author" --></td>
-			<td><!-- TMPL_VAR NAME="isbn" --></td>
-			<td><a href="javascript:Import(<!-- TMPL_VAR NAME="id" -->,<!-- TMPL_VAR NAME="oldbiblionumber" -->)">Import</a></td> 
-		
-		</tr>
-	<!-- /TMPL_LOOP --> 
-	<!-- TMPL_ELSE -->
-		<tr><td colspan="6">Nothing found</td></tr>
-	<!-- /TMPL_IF -->
-</table>
-<!-- /TMPL_IF -->
-
-</div>
-<!-- TMPL_IF name="numberpending" --><h3 align="center"> <!-- TMPL_VAR NAME="numberpending" --> more servers to search</h3><!-- /TMPL_IF -->
-<script language="JavaScript" type="text/javascript">
-	function Import(GetThisOne,biblionumber) {
-		opener.document.location= "../cataloguing/addbiblio.pl?oldbiblionumber="+biblionumber+"&z3950=1&breedingid="+GetThisOne;
-		self.close();
-		return false;
-	}
-</script>
-</div>
-<!-- TMPL_INCLUDE name="acquisitions-bottom.inc" -->
-

Index: htdocs/intranet-tmpl/default/images/1downarrow.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/1downarrow.png
diff -N htdocs/intranet-tmpl/default/images/1downarrow.png
Binary files /tmp/cvsrQv5t7 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/1leftarrow.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/1leftarrow.png
diff -N htdocs/intranet-tmpl/default/images/1leftarrow.png
Binary files /tmp/cvs4wvmA6 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/1rightarrow.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/1rightarrow.png
diff -N htdocs/intranet-tmpl/default/images/1rightarrow.png
Binary files /tmp/cvshxXwja and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/1uparrow.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/1uparrow.png
diff -N htdocs/intranet-tmpl/default/images/1uparrow.png
Binary files /tmp/cvsoPHzdc and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/2downarrow.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/2downarrow.png
diff -N htdocs/intranet-tmpl/default/images/2downarrow.png
Binary files /tmp/cvsj2A4nb and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/2leftarrow.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/2leftarrow.png
diff -N htdocs/intranet-tmpl/default/images/2leftarrow.png
Binary files /tmp/cvsEiLJwd and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/2rightarrow.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/2rightarrow.png
diff -N htdocs/intranet-tmpl/default/images/2rightarrow.png
Binary files /tmp/cvsb9EMDh and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/2uparrow.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/2uparrow.png
diff -N htdocs/intranet-tmpl/default/images/2uparrow.png
Binary files /tmp/cvsqKmMbj and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/AB.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/AB.gif
diff -N htdocs/intranet-tmpl/default/images/AB.gif
Binary files /tmp/cvs9Udn5l and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/AC.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/AC.gif
diff -N htdocs/intranet-tmpl/default/images/AC.gif
Binary files /tmp/cvsmFFZkl and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/AF.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/AF.gif
diff -N htdocs/intranet-tmpl/default/images/AF.gif
Binary files /tmp/cvstW8KFq and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/AV.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/AV.gif
diff -N htdocs/intranet-tmpl/default/images/AV.gif
Binary files /tmp/cvsD29c2p and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/AVJ.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/AVJ.gif
diff -N htdocs/intranet-tmpl/default/images/AVJ.gif
Binary files /tmp/cvsU4n8Us and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/AVJN.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/AVJN.gif
diff -N htdocs/intranet-tmpl/default/images/AVJN.gif
Binary files /tmp/cvslarcYx and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/AVJNF.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/AVJNF.gif
diff -N htdocs/intranet-tmpl/default/images/AVJNF.gif
Binary files /tmp/cvsMZIjnA and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/AVNF.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/AVNF.gif
diff -N htdocs/intranet-tmpl/default/images/AVNF.gif
Binary files /tmp/cvstD6bIE and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/Audiobook (cassette).gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/Audiobook (cassette).gif
diff -N htdocs/intranet-tmpl/default/images/Audiobook (cassette).gif
Binary files /tmp/cvsiRKuuG and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/Audiobook.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/Audiobook.gif
diff -N htdocs/intranet-tmpl/default/images/Audiobook.gif
Binary files /tmp/cvsFpHywP and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/BCD.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/BCD.gif
diff -N htdocs/intranet-tmpl/default/images/BCD.gif
Binary files /tmp/cvsKdMmtQ and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/BIO.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/BIO.gif
diff -N htdocs/intranet-tmpl/default/images/BIO.gif
Binary files /tmp/cvsVEW6NS and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/BOOK.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/BOOK.gif
diff -N htdocs/intranet-tmpl/default/images/BOOK.gif
Binary files /tmp/cvsARNnSW and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/Biography.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/Biography.gif
diff -N htdocs/intranet-tmpl/default/images/Biography.gif
Binary files /tmp/cvsTF1yJY and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/Book on Tape.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/Book on Tape.gif
diff -N htdocs/intranet-tmpl/default/images/Book on Tape.gif
Binary files /tmp/cvsmxyhq1 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/CD-R.GIF
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/CD-R.GIF
diff -N htdocs/intranet-tmpl/default/images/CD-R.GIF
Binary files /tmp/cvszpeJ63 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/CD.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/CD.gif
diff -N htdocs/intranet-tmpl/default/images/CD.gif
Binary files /tmp/cvsGB48k3 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/CD_.GIF
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/CD_.GIF
diff -N htdocs/intranet-tmpl/default/images/CD_.GIF
Binary files /tmp/cvslrvS56 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/CHD.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/CHD.gif
diff -N htdocs/intranet-tmpl/default/images/CHD.gif
Binary files /tmp/cvsC4JNp8 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/DVD.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/DVD.gif
diff -N htdocs/intranet-tmpl/default/images/DVD.gif
Binary files /tmp/cvsv5O8y9 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/FIC.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/FIC.gif
diff -N htdocs/intranet-tmpl/default/images/FIC.gif
Binary files /tmp/cvsUNla47 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/Fleche.jpg
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/Fleche.jpg
diff -N htdocs/intranet-tmpl/default/images/Fleche.jpg
Binary files /tmp/cvsFXwODb and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/GoogleG.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/GoogleG.gif
diff -N htdocs/intranet-tmpl/default/images/GoogleG.gif
Binary files /tmp/cvsmqRQf3 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/JF.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/JF.gif
diff -N htdocs/intranet-tmpl/default/images/JF.gif
Binary files /tmp/cvshpxsG1 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/JNF.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/JNF.gif
diff -N htdocs/intranet-tmpl/default/images/JNF.gif
Binary files /tmp/cvssqn2c5 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/JRNL.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/JRNL.gif
diff -N htdocs/intranet-tmpl/default/images/JRNL.gif
Binary files /tmp/cvsdmjc24 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/POEM.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/POEM.gif
diff -N htdocs/intranet-tmpl/default/images/POEM.gif
Binary files /tmp/cvsVYXVi8 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/REF.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/REF.gif
diff -N htdocs/intranet-tmpl/default/images/REF.gif
Binary files /tmp/cvsGuvRR6 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/RES.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/RES.gif
diff -N htdocs/intranet-tmpl/default/images/RES.gif
Binary files /tmp/cvspHZ8Y9 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/STO.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/STO.gif
diff -N htdocs/intranet-tmpl/default/images/STO.gif
Binary files /tmp/cvs8JR5Z8 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/VCD.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/VCD.gif
diff -N htdocs/intranet-tmpl/default/images/VCD.gif
Binary files /tmp/cvs1zcZL9 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/VCD_.GIF
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/VCD_.GIF
diff -N htdocs/intranet-tmpl/default/images/VCD_.GIF
Binary files /tmp/cvsezDewd and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/VHS.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/VHS.gif
diff -N htdocs/intranet-tmpl/default/images/VHS.gif
Binary files /tmp/cvsZEQ0Ob and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/add.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/add.gif
diff -N htdocs/intranet-tmpl/default/images/add.gif
Binary files /tmp/cvsYl7SUe and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/addtobasket.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/addtobasket.gif
diff -N htdocs/intranet-tmpl/default/images/addtobasket.gif
Binary files /tmp/cvs5EsOJf and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/addtoshelf.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/addtoshelf.gif
diff -N htdocs/intranet-tmpl/default/images/addtoshelf.gif
Binary files /tmp/cvs4aLY9d and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/arrow-big.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/arrow-big.gif
diff -N htdocs/intranet-tmpl/default/images/arrow-big.gif
Binary files /tmp/cvsV8M9nh and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/arrow.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/arrow.gif
diff -N htdocs/intranet-tmpl/default/images/arrow.gif
Binary files /tmp/cvsar1Upi and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/back.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/back.gif
diff -N htdocs/intranet-tmpl/default/images/back.gif
Binary files /tmp/cvsh0VwLg and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/background-mem.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/background-mem.gif
diff -N htdocs/intranet-tmpl/default/images/background-mem.gif
Binary files /tmp/cvsQdePOj and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/background-opac.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/background-opac.gif
diff -N htdocs/intranet-tmpl/default/images/background-opac.gif
Binary files /tmp/cvsl1UgGk and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/bar.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/bar.gif
diff -N htdocs/intranet-tmpl/default/images/bar.gif
Binary files /tmp/cvsnp8Fpj and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/basket.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/basket.gif
diff -N htdocs/intranet-tmpl/default/images/basket.gif
Binary files /tmp/cvsC6kSvm and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/basket01.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/basket01.gif
diff -N htdocs/intranet-tmpl/default/images/basket01.gif
Binary files /tmp/cvsnROj4k and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/bg.jpg
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/bg.jpg
diff -N htdocs/intranet-tmpl/default/images/bg.jpg
Binary files /tmp/cvscgM4Nl and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/bg2.jpg
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/bg2.jpg
diff -N htdocs/intranet-tmpl/default/images/bg2.jpg
Binary files /tmp/cvsBdTZ5o and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/blue_down.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/blue_down.gif
diff -N htdocs/intranet-tmpl/default/images/blue_down.gif
Binary files /tmp/cvskXcaFn and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/blue_right.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/blue_right.gif
diff -N htdocs/intranet-tmpl/default/images/blue_right.gif
Binary files /tmp/cvsdQ0zqo and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/blue_up.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/blue_up.gif
diff -N htdocs/intranet-tmpl/default/images/blue_up.gif
Binary files /tmp/cvsmwS7yr and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/book1.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/book1.gif
diff -N htdocs/intranet-tmpl/default/images/book1.gif
Binary files /tmp/cvs1QUaYp and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/book2.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/book2.gif
diff -N htdocs/intranet-tmpl/default/images/book2.gif
Binary files /tmp/cvsNAh3Dq and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/checkall.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/checkall.gif
diff -N htdocs/intranet-tmpl/default/images/checkall.gif
Binary files /tmp/cvsSMiQYt and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/clip.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/clip.gif
diff -N htdocs/intranet-tmpl/default/images/clip.gif
Binary files /tmp/cvstFzmos and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/cross.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/cross.gif
diff -N htdocs/intranet-tmpl/default/images/cross.gif
Binary files /tmp/cvsmRgEct and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/edittrash.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/edittrash.png
diff -N htdocs/intranet-tmpl/default/images/edittrash.png
Binary files /tmp/cvsZQ9kmw and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/erase.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/erase.gif
diff -N htdocs/intranet-tmpl/default/images/erase.gif
Binary files /tmp/cvsC0Fdiv and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/exit.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/exit.gif
diff -N htdocs/intranet-tmpl/default/images/exit.gif
Binary files /tmp/cvs89Crqy and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/filefind.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/filefind.png
diff -N htdocs/intranet-tmpl/default/images/filefind.png
Binary files /tmp/cvsZyX1cz and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/fileimport.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/fileimport.png
diff -N htdocs/intranet-tmpl/default/images/fileimport.png
Binary files /tmp/cvsCQKKzx and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/filenew.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/filenew.png
diff -N htdocs/intranet-tmpl/default/images/filenew.png
Binary files /tmp/cvslDxely and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/fileopen.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/fileopen.gif
diff -N htdocs/intranet-tmpl/default/images/fileopen.gif
Binary files /tmp/cvsW9HfuB and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/fileopen.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/fileopen.png
diff -N htdocs/intranet-tmpl/default/images/fileopen.png
Binary files /tmp/cvsTH9gUz and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/fileprint.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/fileprint.png
diff -N htdocs/intranet-tmpl/default/images/fileprint.png
Binary files /tmp/cvsOo0PFA and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/filesave.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/filesave.png
diff -N htdocs/intranet-tmpl/default/images/filesave.png
Binary files /tmp/cvst76lGD and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/front-arrow.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/front-arrow.gif
diff -N htdocs/intranet-tmpl/default/images/front-arrow.gif
Binary files /tmp/cvskyWr8B and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/front-background-med.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/front-background-med.gif
diff -N htdocs/intranet-tmpl/default/images/front-background-med.gif
Binary files /tmp/cvsdaaP7C and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/front-background-small.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/front-background-small.gif
diff -N htdocs/intranet-tmpl/default/images/front-background-small.gif
Binary files /tmp/cvsABvF6F and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/gohome.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/gohome.png
diff -N htdocs/intranet-tmpl/default/images/gohome.png
Binary files /tmp/cvsjOXnwE and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/help.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/help.gif
diff -N htdocs/intranet-tmpl/default/images/help.gif
Binary files /tmp/cvsMYb8kF and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/historial.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/historial.gif
diff -N htdocs/intranet-tmpl/default/images/historial.gif
Binary files /tmp/cvsPptODI and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/imageKoha.jpg
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/imageKoha.jpg
diff -N htdocs/intranet-tmpl/default/images/imageKoha.jpg
Binary files /tmp/cvso9Bc3G and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/key.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/key.gif
diff -N htdocs/intranet-tmpl/default/images/key.gif
Binary files /tmp/cvsDwwCJH and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/koha-logo.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/koha-logo.gif
diff -N htdocs/intranet-tmpl/default/images/koha-logo.gif
Binary files /tmp/cvsnh97SK and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/less.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/less.gif
diff -N htdocs/intranet-tmpl/default/images/less.gif
Binary files /tmp/cvsaajdrJ and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/logo_ej.jpg
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/logo_ej.jpg
diff -N htdocs/intranet-tmpl/default/images/logo_ej.jpg
Binary files /tmp/cvshd67oK and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/logout.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/logout.gif
diff -N htdocs/intranet-tmpl/default/images/logout.gif
Binary files /tmp/cvs0TfNEN and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/lupe.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/lupe.gif
diff -N htdocs/intranet-tmpl/default/images/lupe.gif
Binary files /tmp/cvsJkR6dM and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/m_2_s.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/m_2_s.gif
diff -N htdocs/intranet-tmpl/default/images/m_2_s.gif
Binary files /tmp/cvsEPEcuP and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/mail_get.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/mail_get.png
diff -N htdocs/intranet-tmpl/default/images/mail_get.png
Binary files /tmp/cvsvW3UpQ and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/mail_send.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/mail_send.png
diff -N htdocs/intranet-tmpl/default/images/mail_send.png
Binary files /tmp/cvsyV3vOO and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/minus.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/minus.gif
diff -N htdocs/intranet-tmpl/default/images/minus.gif
Binary files /tmp/cvsxfj1aS and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/money.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/money.gif
diff -N htdocs/intranet-tmpl/default/images/money.gif
Binary files /tmp/cvsCFNxWQ and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/monog.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/monog.gif
diff -N htdocs/intranet-tmpl/default/images/monog.gif
Binary files /tmp/cvs5jaQqU and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/more.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/more.gif
diff -N htdocs/intranet-tmpl/default/images/more.gif
Binary files /tmp/cvsIQnGaV and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/no_zip.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/no_zip.gif
diff -N htdocs/intranet-tmpl/default/images/no_zip.gif
Binary files /tmp/cvsJd3VkT and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/nophoto.GIF
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/nophoto.GIF
diff -N htdocs/intranet-tmpl/default/images/nophoto.GIF
Binary files /tmp/cvsSeIBeU and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/nophoto.jpg
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/nophoto.jpg
diff -N htdocs/intranet-tmpl/default/images/nophoto.jpg
Binary files /tmp/cvsrBwK5W and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/password.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/password.gif
diff -N htdocs/intranet-tmpl/default/images/password.gif
Binary files /tmp/cvsIBsVOX and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/pdf-cacelled.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/pdf-cacelled.gif
diff -N htdocs/intranet-tmpl/default/images/pdf-cacelled.gif
Binary files /tmp/cvshjvHlW and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/pdf.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/pdf.gif
diff -N htdocs/intranet-tmpl/default/images/pdf.gif
Binary files /tmp/cvsy4xuqZ and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/plus.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/plus.gif
diff -N htdocs/intranet-tmpl/default/images/plus.gif
Binary files /tmp/cvsD8wbd0 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/print.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/print.gif
diff -N htdocs/intranet-tmpl/default/images/print.gif
Binary files /tmp/cvsWqepqY and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/rev.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/rev.gif
diff -N htdocs/intranet-tmpl/default/images/rev.gif
Binary files /tmp/cvsZ13MK1 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/spacer.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/spacer.gif
diff -N htdocs/intranet-tmpl/default/images/spacer.gif
Binary files /tmp/cvsUuuwv2 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/square-w.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/square-w.gif
diff -N htdocs/intranet-tmpl/default/images/square-w.gif
Binary files /tmp/cvs9lEAQ0 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/ths.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/ths.gif
diff -N htdocs/intranet-tmpl/default/images/ths.gif
Binary files /tmp/cvsAtrlI1 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/user.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/user.gif
diff -N htdocs/intranet-tmpl/default/images/user.gif
Binary files /tmp/cvslbkFM4 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/valid-xhtml10.png
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/valid-xhtml10.png
diff -N htdocs/intranet-tmpl/default/images/valid-xhtml10.png
Binary files /tmp/cvswx0R12 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/warning.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/warning.gif
diff -N htdocs/intranet-tmpl/default/images/warning.gif
Binary files /tmp/cvsfl8kK3 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/warning32x32.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/warning32x32.gif
diff -N htdocs/intranet-tmpl/default/images/warning32x32.gif
Binary files /tmp/cvsKvB9X6 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/world1.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/world1.gif
diff -N htdocs/intranet-tmpl/default/images/world1.gif
Binary files /tmp/cvsHNd5F7 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/world2.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/world2.gif
diff -N htdocs/intranet-tmpl/default/images/world2.gif
Binary files /tmp/cvskZso45 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/zip.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/zip.gif
diff -N htdocs/intranet-tmpl/default/images/zip.gif
Binary files /tmp/cvsl0oxi9 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/Science fiction/Fantasy.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/Science fiction/Fantasy.gif
diff -N htdocs/intranet-tmpl/default/images/Science fiction/Fantasy.gif
Binary files /tmp/cvsamE8X7 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/1-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/1-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/1-highlight.gif
Binary files /tmp/cvs1KSpT8 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/1.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/1.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/1.gif
Binary files /tmp/cvsWOlI2b and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/10-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/10-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/10-highlight.gif
Binary files /tmp/cvszLamYa and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/10.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/10.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/10.gif
Binary files /tmp/cvsgROAce and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/11-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/11-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/11-highlight.gif
Binary files /tmp/cvssgcYR5 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/11.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/11.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/11.gif
Binary files /tmp/cvsjfjFu4 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/12-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/12-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/12-highlight.gif
Binary files /tmp/cvsaxmBu5 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/12.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/12.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/12.gif
Binary files /tmp/cvsjznmH8 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/13-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/13-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/13-highlight.gif
Binary files /tmp/cvs00S2e7 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/13.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/13.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/13.gif
Binary files /tmp/cvsTOhXIa and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/14-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/14-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/14-highlight.gif
Binary files /tmp/cvsoabcBb and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/14.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/14.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/14.gif
Binary files /tmp/cvsMliSia and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/15-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/15-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/15-highlight.gif
Binary files /tmp/cvs9mrtqd and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/15.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/15.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/15.gif
Binary files /tmp/cvssppRNb and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/16-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/16-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/16-highlight.gif
Binary files /tmp/cvszx1Hzc and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/16.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/16.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/16.gif
Binary files /tmp/cvsQjEPLf and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/17-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/17-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/17-highlight.gif
Binary files /tmp/cvsfIFtfe and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/17.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/17.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/17.gif
Binary files /tmp/cvsga6v1h and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/18-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/18-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/18-highlight.gif
Binary files /tmp/cvsFWN8Ri and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/18.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/18.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/18.gif
Binary files /tmp/cvsAVtdHh and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/19-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/19-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/19-highlight.gif
Binary files /tmp/cvsDI4laj and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/19.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/19.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/19.gif
Binary files /tmp/cvsE4Uuhk and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/2-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/2-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/2-highlight.gif
Binary files /tmp/cvsvl4Rzn and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/2.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/2.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/2.gif
Binary files /tmp/cvsngB92l and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/20-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/20-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/20-highlight.gif
Binary files /tmp/cvsKHXtpp and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/20.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/20.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/20.gif
Binary files /tmp/cvsnriwdq and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/21-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/21-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/21-highlight.gif
Binary files /tmp/cvseobX8o and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/21.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/21.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/21.gif
Binary files /tmp/cvs0bp4yq and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/22-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/22-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/22-highlight.gif
Binary files /tmp/cvsh0ASiu and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/22.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/22.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/22.gif
Binary files /tmp/cvsSkhCZs and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/23-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/23-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/23-highlight.gif
Binary files /tmp/cvsFVR3Ot and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/23.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/23.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/23.gif
Binary files /tmp/cvsuFXPcx and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/24-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/24-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/24-highlight.gif
Binary files /tmp/cvsnV4OKv and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/24.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/24.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/24.gif
Binary files /tmp/cvs0S8CUy and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/25-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/25-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/25-highlight.gif
Binary files /tmp/cvsLcoiAE and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/25.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/25.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/25.gif
Binary files /tmp/cvs2CTnkG and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/26-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/26-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/26-highlight.gif
Binary files /tmp/cvsBsRltF and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/26.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/26.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/26.gif
Binary files /tmp/cvsGuJLRI and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/27-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/27-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/27-highlight.gif
Binary files /tmp/cvsBqBa9H and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/27.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/27.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/27.gif
Binary files /tmp/cvsqurSlL and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/28-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/28-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/28-highlight.gif
Binary files /tmp/cvsf6HekK and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/28.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/28.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/28.gif
Binary files /tmp/cvsUejL8N and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/29-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/29-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/29-highlight.gif
Binary files /tmp/cvs9jqW6P and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/29.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/29.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/29.gif
Binary files /tmp/cvs8KMdTQ and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/3-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/3-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/3-highlight.gif
Binary files /tmp/cvsTcaszP and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/3.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/3.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/3.gif
Binary files /tmp/cvsC6fBQS and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/30-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/30-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/30-highlight.gif
Binary files /tmp/cvsvLPxAR and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/30.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/30.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/30.gif
Binary files /tmp/cvsk1e5oS and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/31-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/31-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/31-highlight.gif
Binary files /tmp/cvsbBwmPV and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/31.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/31.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/31.gif
Binary files /tmp/cvsiK5lqU and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/4-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/4-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/4-highlight.gif
Binary files /tmp/cvsvAKFZX and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/4.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/4.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/4.gif
Binary files /tmp/cvsWdkfGW and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/5-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/5-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/5-highlight.gif
Binary files /tmp/cvsjpzF6Z and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/5.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/5.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/5.gif
Binary files /tmp/cvsmC5gTY and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/6-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/6-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/6-highlight.gif
Binary files /tmp/cvs35OeQZ and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/6.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/6.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/6.gif
Binary files /tmp/cvsoYAb12 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/7-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/7-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/7-highlight.gif
Binary files /tmp/cvsx2oyz1 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/7.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/7.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/7.gif
Binary files /tmp/cvs4q9F14 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/8-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/8-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/8-highlight.gif
Binary files /tmp/cvsXmUFU3 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/8.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/8.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/8.gif
Binary files /tmp/cvsK1AQk7 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/9-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/9-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/9-highlight.gif
Binary files /tmp/cvsfn9c05 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/9.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/9.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/9.gif
Binary files /tmp/cvsaC6396 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/next.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/next.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/next.gif
Binary files /tmp/cvsqTGot9 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/placeholder.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/placeholder.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/placeholder.gif
Binary files /tmp/cvspCa5q8 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/prev.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/prev.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/prev.gif
Binary files /tmp/cvs0lgO3a and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/background-opac.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/background-opac.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/background-opac.gif
Binary files /tmp/cvsTqIq7g and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/front-arrow.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/front-arrow.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/front-arrow.gif
Binary files /tmp/cvs6sbYsi and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/front-background-med.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/front-background-med.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/front-background-med.gif
Binary files /tmp/cvszPl1gh and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/front-background-small.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/front-background-small.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/front-background-small.gif
Binary files /tmp/cvsTGwdNl and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/1-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/1-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/1-highlight.gif
Binary files /tmp/cvsGHwOtk and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/1.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/1.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/1.gif
Binary files /tmp/cvsPH451n and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/10-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/10-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/10-highlight.gif
Binary files /tmp/cvsyt8som and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/10.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/10.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/10.gif
Binary files /tmp/cvsBF7Smn and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/11-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/11-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/11-highlight.gif
Binary files /tmp/cvs2ofI7s and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/11.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/11.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/11.gif
Binary files /tmp/cvs8sKzbv and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/12-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/12-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/12-highlight.gif
Binary files /tmp/cvsDPFkDu and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/12.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/12.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/12.gif
Binary files /tmp/cvsbLrq8x and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/13-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/13-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/13-highlight.gif
Binary files /tmp/cvs4W9EMw and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/13.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/13.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/13.gif
Binary files /tmp/cvsJLLu3z and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/14-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/14-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/14-highlight.gif
Binary files /tmp/cvsk6X1oy and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/14.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/14.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/14.gif
Binary files /tmp/cvsT71Fpz and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/15-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/15-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/15-highlight.gif
Binary files /tmp/cvs4edNPC and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/15.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/15.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/15.gif
Binary files /tmp/cvsl7jJoB and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/16-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/16-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/16-highlight.gif
Binary files /tmp/cvs8L9kKE and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/16.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/16.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/16.gif
Binary files /tmp/cvsrpsDqD and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/17-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/17-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/17-highlight.gif
Binary files /tmp/cvsozmOSG and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/17.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/17.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/17.gif
Binary files /tmp/cvsXmlRXH and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/18-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/18-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/18-highlight.gif
Binary files /tmp/cvsenTpJG and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/18.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/18.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/18.gif
Binary files /tmp/cvsZCty6J and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/19-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/19-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/19-highlight.gif
Binary files /tmp/cvsCo3eLI and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/19.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/19.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/19.gif
Binary files /tmp/cvsRlb4mM and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/2-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/2-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/2-highlight.gif
Binary files /tmp/cvsQGldbL and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/2.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/2.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/2.gif
Binary files /tmp/cvsnskZJV and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/20-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/20-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/20-highlight.gif
Binary files /tmp/cvsp4PcsW and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/20.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/20.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/20.gif
Binary files /tmp/cvsApoP3U and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/21-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/21-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/21-highlight.gif
Binary files /tmp/cvsLuURfY and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/21.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/21.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/21.gif
Binary files /tmp/cvsOjFCkX and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/22-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/22-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/22-highlight.gif
Binary files /tmp/cvspR3GQ0 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/22.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/22.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/22.gif
Binary files /tmp/cvsqxczjZ and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/23-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/23-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/23-highlight.gif
Binary files /tmp/cvsUNDDi0 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/23.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/23.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/23.gif
Binary files /tmp/cvshlrXi3 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/24-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/24-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/24-highlight.gif
Binary files /tmp/cvsGro7K1 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/24.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/24.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/24.gif
Binary files /tmp/cvsH7oVP2 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/25-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/25-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/25-highlight.gif
Binary files /tmp/cvs4OaM75 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/25.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/25.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/25.gif
Binary files /tmp/cvs3Tm8r4 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/26-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/26-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/26-highlight.gif
Binary files /tmp/cvs4pvAM7 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/26.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/26.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/26.gif
Binary files /tmp/cvsdubYw8 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/27-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/27-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/27-highlight.gif
Binary files /tmp/cvsKnHU36 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/27.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/27.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/27.gif
Binary files /tmp/cvshfW8Ba and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/28-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/28-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/28-highlight.gif
Binary files /tmp/cvs6OPEx9 and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/28.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/28.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/28.gif
Binary files /tmp/cvsVbOVKc and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/29-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/29-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/29-highlight.gif
Binary files /tmp/cvsyS9ZHd and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/29.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/29.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/29.gif
Binary files /tmp/cvsxnKTmc and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/3-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/3-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/3-highlight.gif
Binary files /tmp/cvsWBTMtf and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/3.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/3.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/3.gif
Binary files /tmp/cvsn9g1ie and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/30-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/30-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/30-highlight.gif
Binary files /tmp/cvshyR43e and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/30.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/30.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/30.gif
Binary files /tmp/cvsesi4ji and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/31-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/31-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/31-highlight.gif
Binary files /tmp/cvsbS4OIg and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/31.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/31.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/31.gif
Binary files /tmp/cvss5SV9j and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/4-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/4-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/4-highlight.gif
Binary files /tmp/cvsjFJeXk and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/4.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/4.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/4.gif
Binary files /tmp/cvsPxgRbc and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/5-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/5-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/5-highlight.gif
Binary files /tmp/cvsCqVBLa and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/5.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/5.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/5.gif
Binary files /tmp/cvsH1qyDb and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/6-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/6-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/6-highlight.gif
Binary files /tmp/cvsa6lLUe and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/6.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/6.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/6.gif
Binary files /tmp/cvstl9rPd and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/7-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/7-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/7-highlight.gif
Binary files /tmp/cvs6k6I4g and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/7.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/7.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/7.gif
Binary files /tmp/cvsZKbslg and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/8-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/8-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/8-highlight.gif
Binary files /tmp/cvs4qqnTj and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/8.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/8.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/8.gif
Binary files /tmp/cvs1OYgki and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/9-highlight.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/9-highlight.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/9-highlight.gif
Binary files /tmp/cvsUx0kUl and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/9.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/9.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/9.gif
Binary files /tmp/cvsJnly3k and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/next.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/next.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/next.gif
Binary files /tmp/cvso751no and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/placeholder.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/placeholder.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/placeholder.gif
Binary files /tmp/cvsXqrQ7m and /dev/null differ

Index: htdocs/intranet-tmpl/default/images/numbers/images/numbers/prev.gif
===================================================================
RCS file: htdocs/intranet-tmpl/default/images/numbers/images/numbers/prev.gif
diff -N htdocs/intranet-tmpl/default/images/numbers/images/numbers/prev.gif
Binary files /tmp/cvsE4mjnq and /dev/null differ

Index: modules/C4/AcademicInfo.pm
===================================================================
RCS file: modules/C4/AcademicInfo.pm
diff -N modules/C4/AcademicInfo.pm
--- modules/C4/AcademicInfo.pm	10 Mar 2007 01:35:33 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,258 +0,0 @@
-package C4::AcademicInfo;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-  &academic_information 
-  &get_careers
-  &get_career
-  &get_academic_info
-  &add_academic_info
-  &update_academic_info
-  &del_academic_info
-  &get_careers_by_institution
-  &get_educational_institution
-  &add_educational_institution
-  &update_educational_institution
-  &add_career
-  &update_career
-  &del_educational_institution
-  &del_career
-  &get_educational_institutions
-);
-
-
-sub academic_information {
-	my ($borrowernumber) = @_;
-	my $dbh = C4::Context->dbh;
-	my @info;
-	my $query =	"SELECT * 
-				 FROM 
-					educational_institutions AS I 
-					LEFT JOIN careers AS C ON C.id_institution = I.id_institution  
-					LEFT JOIN academic_information AS A ON A.id_career = C.id_career 
-				 WHERE 
-					borrowernumber = ?
-				 ";
-	my $sth = $dbh->prepare($query);
-	$sth->execute($borrowernumber);
-	while (my $row = $sth->fetchrow_hashref) {
-		push @info, $row;
-	}
-	return (scalar(@info), @info);
-}
-
-sub get_academic_info {
-	my ($id_career, $borrowernumber) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM academic_information WHERE id_career = ? AND borrowernumber = ?");
-	$sth->execute($id_career, $borrowernumber); 
-	if ($sth->rows) {
-		return ($sth->fetchrow_hashref);
-	} else {
-		return 0;
-	} 	
-}
-
-sub del_academic_info {
-	my ($id_career, $borrowernumber) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("DELETE FROM academic_information WHERE id_career = ? AND borrowernumber = ? ");
-	$sth->execute($id_career, $borrowernumber);
-	$sth->finish;
-	return 1;
-}
-
-sub add_academic_info {
-	my ($id_career, $borrowernumber, $student_number, $enter_year, $leave_year, $notes) = @_;
-	if (!get_academic_info($id_career, $borrowernumber)) {
-		my $dbh = C4::Context->dbh;
-		my $sth = $dbh->prepare("INSERT INTO academic_information (id_career, borrowernumber, student_number, enter_year, leave_year, notes) VALUES (?,?,?,?,?,?)");
-		$sth->execute($id_career, $borrowernumber, $student_number, $enter_year, $leave_year, $notes);
-		$sth->finish;
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-sub update_academic_info {
-	my ($id_career, $borrowernumber, $student_number, $enter_year, $leave_year, $notes) = @_;	
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("UPDATE academic_information SET student_number = ?, enter_year = ?, leave_year = ?, notes = ? WHERE id_career = ? AND borrowernumber = ?");
-	$sth->execute($student_number, $enter_year, $leave_year, $notes, $id_career, $borrowernumber);
-	$sth->finish;
-	return 1;
-}
-
-
-sub get_career {
-	my ($id_career) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM educational_institutions  LEFT JOIN careers  on educational_institutions.id_institution = careers.id_institution where id_career = ?");
-	$sth->execute($id_career);
-	my $info = $sth->fetchrow_hashref;
-	$sth->finish;
-	return $info;
-}
-
-sub get_educational_institution {
-	my ($id_institution) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM educational_institutions WHERE id_institution = ? ORDER BY institution_name");
-	$sth->execute($id_institution);
-	my $info = $sth->fetchrow_hashref;
-	$sth->finish;
-	return $info;
-}
-
-sub get_educational_institutions {
-	my $dbh = C4::Context->dbh;
-	my @results;
-	my $sth = $dbh->prepare("SELECT * FROM educational_institutions ORDER BY institution_name");
-	$sth->execute();
-	while (my $info = $sth->fetchrow_hashref) {
-		push @results, $info;
-	}
-	$sth->finish;
-	return @results;
-}
-
-sub get_careers {
-	my $dbh = C4::Context->dbh;
-	my @careers;
-	my $sth = $dbh->prepare("SELECT * FROM educational_institutions LEFT JOIN careers ON educational_institutions.id_institution = careers.id_institution ORDER BY career_name");
-	$sth->execute();
-	while (my $row = $sth->fetchrow_hashref) {
-		$row->{'full_description'} = $row->{'career_name'} . ' - ' . $row->{'institution_name'};
-		push @careers, $row;
-	} 
-	return (scalar(@careers), @careers);
-}
-
-sub get_careers_by_institution {
-	my $dbh = C4::Context->dbh;
-	my $sth =	$dbh->prepare("SELECT * FROM educational_institutions");
-	$sth->execute;
-	
-	my @results;
-	while (my ($id, $name) = $sth->fetchrow) {
-		my %hash;
-		$hash{'id_institution'} = $id;
-		$hash{'institution_name'} = $name;
-		my @careers;
-		my $sth2 =	$dbh->prepare("SELECT * FROM careers WHERE id_institution = ?");
-		$sth2->execute($hash{'id_institution'});
-		while (my $ca = $sth2->fetchrow_hashref) {
-			$ca->{'institution_name'} = $name;
-			push @careers, $ca;
-		}
-		$hash{'careers'} = \@careers;
-		push @results, \%hash;
-	}
-	
-	return @results;
-}
-
-sub add_educational_institution {
-	my ($institution_name) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("INSERT INTO educational_institutions (institution_name) VALUES (?)");
-	$sth->execute($institution_name);
-	$sth->finish;
-	return 1;
-}
-
-sub update_educational_institution {
-	my ($id_institution, $institution_name) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("UPDATE educational_institutions SET institution_name = ? WHERE id_institution = ?");
-	$sth->execute($institution_name, $id_institution);
-	$sth->finish;
-	return 1;
-}
-
-sub del_educational_institution {
-	my ($id_institution) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM careers WHERE id_institution = ?");
-	$sth->execute($id_institution);
-	while (my $row = $sth->fetchrow_hashref) {
-		del_career($row->{'id_career'})	
-	}
-	$sth->finish;
-	my $sth = $dbh->prepare("DELETE FROM educational_institutions WHERE id_institution = ?");
-	$sth->execute($id_institution);
-	$sth->finish;
-	return 1;
-}
-
-sub add_career {
-	my ($id_institution, $career_name) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("INSERT INTO careers (id_institution, career_name) VALUES (?,?)");
-	$sth->execute($id_institution, $career_name);
-	$sth->finish;
-	return 1;
-}
-
-sub update_career {
-	my ($id_career, $career_name) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("UPDATE careers SET career_name = ? WHERE id_career = ?");
-	$sth->execute($career_name, $id_career);
-	$sth->finish;
-	return 1;
-}
-
-sub del_career {
-	my ($id_career) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("DELETE FROM academic_information WHERE id_career = ?");
-	$sth->execute($id_career);
-	$sth->finish;
-	my $sth = $dbh->prepare("DELETE FROM careers WHERE id_career = ?");
-	$sth->execute($id_career);
-	$sth->finish;
-	return 1;
-}
-
-
-1;
-__END__
-=back
-
-=head1 AUTHOR
-
-Physics Library UNLP Argentina
-
-Carlos Sebastian Castañeda seba3c at yahoo.com.ar
-
-=cut
-
-

Index: modules/C4/Accounts2.pm
===================================================================
RCS file: modules/C4/Accounts2.pm
diff -N modules/C4/Accounts2.pm
--- modules/C4/Accounts2.pm	10 Mar 2007 01:35:33 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,659 +0,0 @@
-package C4::Accounts2; #assumes C4/Accounts2
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-use C4::Stats;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;	
-
-=head1 NAME
-
-C4::Accounts - Functions for dealing with Koha accounts
-
-=head1 SYNOPSIS
-
-  use C4::Accounts2;
-
-=head1 DESCRIPTION
-
-The functions in this module deal with the monetary aspect of Koha,
-including looking up and modifying the amount of money owed by a
-patron.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&checkaccount	&recordpayment &fixaccounts &makepayment &manualinvoice
-				&getnextacctno &manualcredit &calc_charges &createcharge
-				
-				&dailyAccountBalance &addDailyAccountOp &getDailyAccountOp);
-
-=item checkaccount
-
-  $owed = &checkaccount($env, $borrowernumber, $dbh, $date);
-
-Looks up the total amount of money owed by a borrower (fines, etc.).
-
-C<$borrowernumber> specifies the borrower to look up.
-
-C<$dbh> is a DBI::db handle for the Koha database.
-
-C<$env> is ignored.
-
-=cut
-#'
-sub checkaccount  {
-  #take borrower number
-  #check accounts and list amounts owing
-	my ($env,$bornumber,$dbh,$date)=@_;
-	my $select="SELECT SUM(amountoutstanding) AS total
-			FROM accountlines
-		WHERE borrowernumber = ?
-			AND amountoutstanding<>0";
-	my @bind = ($bornumber);
-	if ($date ne ''){
-	$select.=" AND date < ?";
-	push(@bind,$date);
-	}
-	#  print $select;
-	my $sth=$dbh->prepare($select);
-	$sth->execute(@bind);
-	my $data=$sth->fetchrow_hashref;
-	my $total = $data->{'total'};
-	$sth->finish;
-	# output(1,2,"borrower owes $total");
-	#if ($total > 0){
-	#  # output(1,2,"borrower owes $total");
-	#  if ($total > 5){
-	#    reconcileaccount($env,$dbh,$bornumber,$total);
-	#  }
-	#}
-	#  pause();
-	return($total);
-}
-
-=item recordpayment
-
-  &recordpayment($env, $borrowernumber, $payment);
-
-Record payment by a patron. C<$borrowernumber> is the patron's
-borrower number. C<$payment> is a floating-point number, giving the
-amount that was paid. C<$env> is a reference-to-hash;
-C<$env-E<gt>{branchcode}> is the code of the branch where payment was
-made.
-
-Amounts owed are paid off oldest first. That is, if the patron has a
-$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
-of $1.50, then the oldest fine will be paid off in full, and $0.50
-will be credited to the next one.
-
-=cut
-#'
-sub recordpayment{
-  #here we update both the accountoffsets and the account lines
-  my ($env,$bornumber,$data)=@_;
-  my $dbh = C4::Context->dbh;
-  my $newamtos = 0;
-  my $accdata = "";
-  my $branch=$env->{'branchcode'};
-  my $amountleft = $data;
-  # begin transaction
-  my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
-  # get lines with outstanding amounts to offset
-  my $sth = $dbh->prepare("select * from accountlines
-  where (borrowernumber = ?) and (amountoutstanding<>0)
-  order by date");
-  $sth->execute($bornumber);
-  # offset transactions
-  while (($accdata=$sth->fetchrow_hashref) and ($amountleft>0)){
-     if ($accdata->{'amountoutstanding'} < $amountleft) {
-        $newamtos = 0;
-	$amountleft -= $accdata->{'amountoutstanding'};
-     }  else {
-        $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
-	$amountleft = 0;
-     }
-     my $thisacct = $accdata->{accountid};
-     my $usth = $dbh->prepare("update accountlines set amountoutstanding= ?
-     where accountid=?");
-     $usth->execute($newamtos,$thisacct);
-     $usth->finish;
-  }
-  # create new line
-  my $usth = $dbh->prepare("insert into accountlines
-  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding)
-  values (?,?,now(),?,'Payment,thanks','Pay',?)");
-  $usth->execute($bornumber,$nextaccntno,0-$data,0-$amountleft);
-  $usth->finish;
-#  UpdateStats($env,$branch,'payment',$data,'','','',$bornumber);
-  $sth->finish;
-}
-
-=item makepayment
-
-  &makepayment($borrowernumber, $acctnumber, $amount, $branchcode);
-
-Records the fact that a patron has paid off the an amount he or
-she owes.
-
-C<$borrowernumber> is the patron's borrower number. C<$acctnumber> is
-the account that was credited. C<$amount> is the amount paid (this is
-only used to record the payment. C<$branchcode> is the code of the branch where payment
-was made.
-
-=cut
-#'
-# FIXME - I'm not at all sure about the above, because I don't
-# understand what the acct* tables in the Koha database are for.
-
-sub makepayment{
-  #here we update  the account lines
-  #updated to check, if they are paying off a lost item, we return the item
-  # from their card, and put a note on the item record
-  my ($bornumber,$accountno,$amount,$user,$type)=@_;
-  my $env;
-my $desc;
-my $pay;
-if ($type eq "Pay"){
- $desc="Payment,received by -". $user;
- $pay="Pay";
-}else{
- $desc="Written-off -by". $user;
- $pay="W";
-}
-  my $dbh = C4::Context->dbh;
-  # begin transaction
-  my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
-  my $newamtos=0;
-  my $sth=$dbh->prepare("Select * from accountlines where  borrowernumber=? and accountno=?");
-  $sth->execute($bornumber,$accountno);
-  my $data=$sth->fetchrow_hashref;
-  $sth->finish;
-
-  $dbh->do(<<EOT);
-	UPDATE	accountlines
-	SET	amountoutstanding = amountoutstanding-$amount
-	WHERE	borrowernumber = $bornumber
-	  AND	accountno = $accountno
-EOT
-
-
-
-  # create new line
-  my $payment=0-$amount;
-if ($data->{'itemnumber'}){
-$desc.=" ".$data->{'itemnumber'};
-
-  $dbh->do(<<EOT);
-	INSERT INTO	accountlines
-			(borrowernumber, accountno, itemnumber,date, amount,
-			 description, accounttype, amountoutstanding,offset)
-	VALUES		($bornumber, $nextaccntno, $data->{'itemnumber'},now(), $payment,
-			'$desc', '$pay', 0,$accountno)
-EOT
-}else{
-  $dbh->do(<<EOT);
-INSERT INTO	accountlines
-			(borrowernumber, accountno, date, amount,
-			 description, accounttype, amountoutstanding,offset)
-	VALUES		($bornumber, $nextaccntno, now(), $payment,
-			'$desc', '$pay', 0,$accountno)
-EOT
-}
-
-  # FIXME - The second argument to &UpdateStats is supposed to be the
-  # branch code.
-#  UpdateStats($env,'MAIN',$pay,$amount,'','','',$bornumber);
-  $sth->finish;
-  #check to see what accounttype
-  if ($data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L'){
-    returnlost($bornumber,$data->{'itemnumber'});
-  }
-}
-
-=item getnextacctno
-
-  $nextacct = &getnextacctno($env, $borrowernumber, $dbh);
-
-Returns the next unused account number for the patron with the given
-borrower number.
-
-C<$dbh> is a DBI::db handle to the Koha database.
-
-C<$env> is ignored.
-
-=cut
-#'
-# FIXME - Okay, so what does the above actually _mean_?
-sub getnextacctno {
-  my ($env,$bornumber,$dbh)=@_;
-  my $nextaccntno = 1;
-  my $sth = $dbh->prepare("select * from accountlines
-  where (borrowernumber = ?)
-  order by accountno desc");
-  $sth->execute($bornumber);
-  if (my $accdata=$sth->fetchrow_hashref){
-    $nextaccntno = $accdata->{'accountno'} + 1;
-  }
-  $sth->finish;
-  return($nextaccntno);
-}
-
-=item fixaccounts
-
-  &fixaccounts($borrowernumber, $accountnumber, $amount);
-
-=cut
-#'
-# FIXME - I don't know whether used
-sub fixaccounts {
-  my ($borrowernumber,$accountno,$amount)=@_;
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("Select * from accountlines where borrowernumber=?
-     and accountno=?");
-  $sth->execute($borrowernumber,$accountno);
-  my $data=$sth->fetchrow_hashref;
-	# FIXME - Error-checking
-  my $diff=$amount-$data->{'amount'};
-  my $outstanding=$data->{'amountoutstanding'}+$diff;
-  $sth->finish;
-
-  $dbh->do(<<EOT);
-	UPDATE	accountlines
-	SET	amount = '$amount',
-		amountoutstanding = '$outstanding'
-	WHERE	borrowernumber = $borrowernumber
-	  AND	accountno = $accountno
-EOT
- }
-
-
-sub returnlost{
-  my ($borrnum,$itemnum)=@_;
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("Update issues set returndate=now() where
-  borrowernumber=? and itemnumber=? and returndate is null");
-  $sth->execute($borrnum,$itemnum);
-  $sth->finish;
-}
-
-=item manualinvoice
-
-  &manualinvoice($borrowernumber, $description, $type,
-                 $amount, $user);
-
-C<$borrowernumber> is the patron's borrower number.
-C<$description> is a description of the transaction.
-C<$type> may be one of C<CS>, C<CB>, C<CW>, C<CF>, C<CL>, C<N>, C<L>,
-or C<REF>.
-
-
-=cut
-#'
-
-sub manualinvoice{
-  my ($bornum,$desc,$type,$amount,$user)=@_;
-  my $dbh = C4::Context->dbh;
-  my $insert;
-  my %env;
-  my $accountno=getnextacctno('',$bornum,$dbh);
-  my $amountleft=$amount;
-
-
-  if ($type eq 'N'){
-    $desc.="New Card";
-  }
-
-  if ($type eq 'L' && $desc eq ''){
-    $desc="Lost Item";
-  }
- if ($type eq 'REF'){
- $desc="Cash refund";
-  }
- $amountleft=refund('',$bornum,$amount);
-    my $sth=$dbh->prepare("INSERT INTO	accountlines
-			(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding)
-			VALUES (?, ?, now(), ?, ?, ?, ?)");
-    $sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft);
-  
-}
-
-sub manualcredit{
-  my ($bornum,$accountid,$desc,$type,$amount,$user,$oldaccount)=@_;
-  my $dbh = C4::Context->dbh;
-  my $insert;
-  my $accountno=getnextacctno('',$bornum,$dbh);
-#  my $amountleft=$amount;
-my $amountleft;
-my $noerror;
-  if ($type eq 'CN' || $type eq 'CA'  || $type eq 'CR' 
-  || $type eq 'CF' || $type eq 'CL' || $type eq 'CM'){
-    my $amount2=$amount*-1;	
-   ( $amountleft, $noerror,$oldaccount)=fixcredit($dbh,$bornum,$amount2,$accountid,$type,$user);
-  }
- if ($noerror>0){
-	
-## find the accountline desc
-my $sth2=$dbh->prepare("select description from accountlines where accountid=?");
-$sth2->execute($accountid);
-my $desc2=$sth2->fetchrow;
-$desc.=" Credited for ".$desc2." by ".$user;
-$sth2->finish;
-
-    	 my $sth=$dbh->prepare("INSERT INTO	accountlines
-			(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,offset)
-			VALUES (?, ?, now(), ?, ?, ?, ?,?)");
-    	$sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft,$oldaccount);
-  	
-return ("0");
-} else {
-	return("1");
-}
-}
-# fixcredit
-sub fixcredit{
-  #here we update both the accountoffsets and the account lines
-  my ($dbh,$bornumber,$data,$accountid,$type,$user)=@_;
-  my $newamtos = 0;
-  my $accdata = "";
-  my $amountleft = $data;
- my $env;
-    my $query="Select * from accountlines where accountid=? and amountoutstanding > 0";
- my $sth=$dbh->prepare($query);
-$sth->execute($accountid);
-    $accdata=$sth->fetchrow_hashref;
-    $sth->finish;
-
-if ($accdata){
-  	  if ($accdata->{'amountoutstanding'} < $amountleft) {
-  	      $newamtos = 0;
-		$amountleft -= $accdata->{'amountoutstanding'};
-  	   }  else {
-  	      $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
-	$amountleft = 0;
-  	   }
-          my $thisacct = $accdata->{accountid};
-     my $usth = $dbh->prepare("update accountlines set amountoutstanding= ?
-     where accountid=?");
-     $usth->execute($newamtos,$thisacct);
-     $usth->finish;
-
-  # begin transaction
-  # get lines with outstanding amounts to offset
-  my $sth = $dbh->prepare("select * from accountlines
-  where (borrowernumber = ?) and (amountoutstanding >0)
-  order by date");
-  $sth->execute($bornumber);
-#  print $query;
-  # offset transactions
-  while (($accdata=$sth->fetchrow_hashref) and ($amountleft>0)){
-    	 if ($accdata->{'amountoutstanding'} < $amountleft) {
-      	  $newamtos = 0;
-	  $amountleft -= $accdata->{'amountoutstanding'};
-    	 }  else {
-     	  $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
-	$amountleft = 0;
-    	 }
-     my $thisacct = $accdata->{accountid};
-     my $usth = $dbh->prepare("update accountlines set amountoutstanding= ?
-     where accountid=?");
-     $usth->execute($newamtos,$thisacct);
-     $usth->finish;
-  }##  while account
-  $sth->finish;
-
-  $amountleft*=-1;
-  return($amountleft,1,$accdata->{'accountno'});
-}else{
-return("",0);
-}
-}
-
-
-# 
-sub refund{
-  #here we update both the accountoffsets and the account lines
-  my ($env,$bornumber,$data)=@_;
-  my $dbh = C4::Context->dbh;
-  my $newamtos = 0;
-  my $accdata = "";
-#  my $branch=$env->{'branchcode'};
-  my $amountleft = $data *-1;
-
-  # begin transaction
-  # get lines with outstanding amounts to offset
-  my $sth = $dbh->prepare("select * from accountlines
-  where (borrowernumber = ?) and (amountoutstanding<0)
-  order by date");
-  $sth->execute($bornumber);
-#  print $amountleft;
-  # offset transactions
-  while (($accdata=$sth->fetchrow_hashref) and ($amountleft<0)){
-     if ($accdata->{'amountoutstanding'} > $amountleft) {
-        $newamtos = 0;
-	$amountleft -= $accdata->{'amountoutstanding'};
-     }  else {
-        $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
-	$amountleft = 0;
-     }
-#     print $amountleft;
-     my $thisacct = $accdata->{accountid};
-     my $usth = $dbh->prepare("update accountlines set amountoutstanding= ?
-     where accountid=?");
-     $usth->execute($newamtos,$thisacct);
-     $usth->finish;
-
-  }
-  $sth->finish;
-  return($amountleft*-1);
-}
-
-#Funtion to manage the daily account#
-
-sub dailyAccountBalance {
-	my ($date) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth;
-	
-	if ($date) {
-
-		$sth = $dbh->prepare("SELECT * FROM dailyaccountbalance WHERE balanceDate = ?");
-		$sth->execute($date);
-		my $data = $sth->fetchrow_hashref;
-		if (!$data->{'balanceDate'}) {
-			$data->{'noentry'} = 1;
-		}
-		return ($data);
-
-	} else {
-		
-		$sth = $dbh->prepare("SELECT * FROM dailyaccountbalance WHERE balanceDate = CURRENT_DATE()");
-		$sth->execute();
-	
-		if ($sth->rows) {
-			return ($sth->fetchrow_hashref);	
-		} else  {
-			my %hash;
-		
-			$sth = $dbh->prepare("SELECT currentBalanceInHand FROM dailyaccountbalance ORDER BY balanceDate DESC LIMIT 1");
-			$sth->execute();
-			if ($sth->rows) {
-				($hash{'initialBalanceInHand'}) = $sth->fetchrow_array;
-				$hash{'currentBalanceInHand'} = $hash{'initialBalanceInHand'};
-			} else {
-				$hash{'initialBalanceInHand'} = 0;
-				$hash{'currentBalanceInHand'} = 0;
-			}
-			#gets the current date.
-			my @nowarr = localtime();
-			my $date = (1900+$nowarr[5])."-".($nowarr[4]+1)."-".$nowarr[3]; 
-
-			$hash{'balanceDate'} = $date;
-			$hash{'initialBalanceInHand'} = sprintf  ("%.2f", $hash{'initialBalanceInHand'});
-			$hash{'currentBalanceInHand'} = sprintf  ("%.2f", $hash{'currentBalanceInHand'});
-			return \%hash;
-		}
-
-	}
-}
-
-sub addDailyAccountOp {
-	my ($description, $amount, $type, $invoice) = @_;
-	my $dbh = C4::Context->dbh;
-	unless ($invoice) { $invoice = undef};
-	my $sth = $dbh->prepare("INSERT INTO dailyaccount (date, description, amount, type, invoice) VALUES (CURRENT_DATE(), ?, ?, ?, ?)");
-	$sth->execute($description, $amount, $type, $invoice);
-	my $accountop = $dbh->{'mysql_insertid'};
-	$sth = $dbh->prepare("SELECT * FROM dailyaccountbalance WHERE balanceDate = CURRENT_DATE()");
-	$sth->execute();
-	if (!$sth->rows) {
-		$sth = $dbh->prepare("SELECT currentBalanceInHand FROM dailyaccountbalance ORDER BY balanceDate DESC LIMIT 1");
-		$sth->execute();
-		my ($blc) = $sth->fetchrow_array;
-		unless ($blc) {$blc = 0}
-		$sth = $dbh->prepare("INSERT INTO dailyaccountbalance (balanceDate, initialBalanceInHand, currentBalanceInHand) VALUES (CURRENT_DATE(), ?, ?)");
-		$sth->execute($blc, $blc);
-	}
-	if ($type eq 'D') {
-		$amount = -1 * $amount;
-	} 
-	$sth = $dbh->prepare("UPDATE dailyaccountbalance SET currentBalanceInHand = currentBalanceInHand + ? WHERE balanceDate = CURRENT_DATE()");
-	$sth->execute($amount);
-	return $accountop; 
-}
-
-sub getDailyAccountOp {
-	my ($date) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth;
-	if ($date) {
-		$sth = $dbh->prepare("SELECT * FROM dailyaccount WHERE date = ?");
-		$sth->execute($date);	
-	} else {
-		$sth = $dbh->prepare("SELECT * FROM dailyaccount WHERE date = CURRENT_DATE()");
-		$sth->execute();
-	}
-	my @operations;	
-	my $count = 1;
-	while (my $row = $sth->fetchrow_hashref) {
-		$row->{'num'} = $count++; 
-		$row->{$row->{'type'}} = 1;
-		
-		$row->{'invoice'} =~ /(\w*)\-(\w*)\-(\w*)/; 
-		$row->{'invoiceNumber'} = $1;
-		$row->{'invoiceSupplier'} = $2;
-		$row->{'invoiceType'} = $3;
-			
-		push @operations, $row;
-	}
-	return (scalar(@operations), \@operations);
-}
-
-=item calc_charges
-
-  ($charge, $item_type) = &calc_charges($env, $itemnumber, $borrowernumber);
-
-Calculate how much it would cost for a given patron to borrow a given
-item, including any applicable discounts.
-
-C<$env> is ignored.
-
-C<$itemnumber> is the item number of item the patron wishes to borrow.
-
-C<$borrowernumber> is the patron's borrower number.
-
-C<&calc_charges> returns two values: C<$charge> is the rental charge,
-and C<$item_type> is the code for the item's item type (e.g., C<VID>
-if it's a video).
-
-=cut
-
-sub calc_charges {
-	# calculate charges due
-	my ($env, $itemnumber, $bornum)=@_;
-	my $charge=0;
-	my $dbh = C4::Context->dbh;
-	my $sth= $dbh->prepare("select ctype from items where  itemnumber=?");
-	$sth->execute($itemnumber);
-	my $itemtype=$sth->fetchrow;
-	$sth->finish;
-	
-	my $sth1= $dbh->prepare("select rentalcharge from itemtypes where  itemtypes.itemtype=?");
-	$sth1->execute($itemtype);
-	
-	$charge = $sth1->fetchrow;
-	my $q2 = "select rentaldiscount from issuingrules,borrowers
-              where (borrowers.borrowernumber = ?)
-              and (borrowers.categorycode = issuingrules.categorycode)
-              and (issuingrules.itemtype = ?)";
-            my $sth2=$dbh->prepare($q2);
-            $sth2->execute($bornum,$itemtype);
-    if (my $data2=$sth2->fetchrow_hashref) {
-		my $discount = $data2->{'rentaldiscount'};
-		if ($discount eq 'NULL') {
-		    $discount=0;
-		}
-		$charge = ($charge *(100 - $discount)) / 100;
-		#               warn "discount is $discount";
-	 }
-        $sth2->finish;
-        
-	$sth1->finish;
-	return ($charge,$itemtype);
-}
-
-
-
-sub createcharge {
-
-    my ($env,$dbh,$itemnumber,$bornum,$charge) = @_;
-    my $nextaccntno = getnextacctno($env,$bornum,$dbh);
-    my $sth = $dbh->prepare(<<EOT);
-	INSERT INTO	accountlines
-			(borrowernumber, itemnumber, accountno,
-			 date, amount, description, accounttype,
-			 amountoutstanding)
-	VALUES		(?, ?, ?,
-			 now(), ?, 'Rental', 'Rent',
-			 ?)
-EOT
-    $sth->execute($bornum, $itemnumber, $nextaccntno, $charge, $charge);
-    $sth->finish;
-}
-
-1;
-__END__
-
-=back
-
-=head1 SEE ALSO
-
-DBI(3)
-
-=cut

Index: modules/C4/Acquisition.pm
===================================================================
RCS file: modules/C4/Acquisition.pm
diff -N modules/C4/Acquisition.pm
--- modules/C4/Acquisition.pm	10 Mar 2007 01:35:33 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,973 +0,0 @@
-package C4::Acquisition;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Acquisition.pm,v 1.1.2.1 2007/03/10 01:35:33 tgarip1957 Exp $
-
-use strict;
-require Exporter;
-use C4::Context;
-use C4::Date;
-use C4::Suggestions;
-use C4::Biblio;
-use Time::localtime;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
-
-# used in receiveorder subroutine
-# to provide library specific handling
-my $library_name = C4::Context->preference("LibraryName");
-
-=head1 NAME
-
-C4::Acquisition - Koha functions for dealing with orders and acquisitions
-
-=head1 SYNOPSIS
-
-use C4::Acquisition;
-
-=head1 DESCRIPTION
-
-The functions in this module deal with acquisitions, managing book
-orders, basket and parcels.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA    = qw(Exporter);
- at EXPORT = qw(
-  &GetBasket &NewBasket &CloseBasket
-  &GetPendingOrders &GetOrder &GetOrders
-  &GetOrderNumber &GetLateOrders &NewOrder &DelOrder
-   &GetHistory
-  &ModOrder &ModReceiveOrder 
-  &GetSingleOrder
-);
-
-
-=head2 FUNCTIONS ABOUT BASKETS
-
-=over 2
-
-=cut
-
-#------------------------------------------------------------#
-
-=head3 GetBasket
-
-=over 4
-
-$aqbasket = &GetBasket($basketnumber);
-
-get all basket informations in aqbasket for a given basket
-
-return :
-informations for a given basket returned as a hashref.
-
-=back
-
-=back
-
-=cut
-
-sub GetBasket {
-    my ($basketno) = shift;
-    my $dbh        = C4::Context->dbh;
-    my $query = "
-        SELECT  aqbasket.*,
-                concat(borrowers.firstname,'  ',borrowers.surname) AS authorisedbyname,
-                borrowers.branchcode AS branch
-        FROM    aqbasket
-        LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
-        WHERE basketno=?
-    ";
-    my $sth=$dbh->prepare($query);
-    $sth->execute($basketno);
-    return ( $sth->fetchrow_hashref );
-}
-
-#------------------------------------------------------------#
-
-=head3 NewBasket
-
-=over 4
-
-$basket = &NewBasket();
-
-Create a new basket in aqbasket table
-
-=back
-
-=cut
-
-# FIXME : this function seems to be unused.
-
-sub NewBasket {
-    my ( $booksellerid, $authorisedby ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        INSERT INTO aqbasket
-                (creationdate,booksellerid,authorisedby)
-        VALUES  (now(),'$booksellerid','$authorisedby')
-    ";
-    my $sth =
-      $dbh->do($query);
-
-#find & return basketno MYSQL dependant, but $dbh->last_insert_id always returns null :-(
-    my $basket = $dbh->{'mysql_insertid'};
-    return $basket;
-}
-
-#------------------------------------------------------------#
-
-=head3 CloseBasket
-
-=over 4
-
-&CloseBasket($basketno);
-
-close a basket (becomes unmodifiable,except for recieves)
-
-=back
-
-=cut
-
-sub CloseBasket {
-    my ($basketno) = @_;
-    my $dbh        = C4::Context->dbh;
-    my $query = "
-        UPDATE aqbasket
-        SET    closedate=now()
-        WHERE  basketno=?
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($basketno);
-}
-
-#------------------------------------------------------------#
-
-=back
-
-=head2 FUNCTIONS ABOUT ORDERS
-
-=over 2
-
-=cut
-
-#------------------------------------------------------------#
-
-=head3 GetPendingOrders
-
-=over 4
-
-$orders = &GetPendingOrders($booksellerid);
-
-Finds pending orders from the bookseller with the given ID. Ignores
-completed and cancelled orders.
-
-C<$orders> is a reference-to-array; each element is a
-reference-to-hash with the following fields:
-
-=over 2
-
-=item C<authorizedby>
-
-=item C<entrydate>
-
-=item C<basketno>
-
-These give the value of the corresponding field in the aqorders table
-of the Koha database.
-
-=back
-
-=back
-
-Results are ordered from most to least recent.
-
-=cut
-
-sub GetPendingOrders {
-    my $supplierid = shift;
-    my $dbh = C4::Context->dbh;
-    my $strsth = "SELECT aqorders.*,aqbasket.*,borrowers.firstname,borrowers.surname
-	FROM aqorders 
-	LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno 
-	LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber 
-	WHERE booksellerid=? 
-	AND (quantity > quantityreceived OR quantityreceived is NULL) 
-	AND datecancellationprinted IS NULL
-	AND (to_days(now())-to_days(closedate) < 180 OR closedate IS NULL) ";
-
-    if ( C4::Context->preference("IndependantBranches") ) {
-        my $userenv = C4::Context->userenv;
-        if ( ($userenv) && ( $userenv->{flags} != 1 ) ) {
-            $strsth .=
-                " and (borrowers.branchcode = '"
-              . $userenv->{branch}
-              . "' or borrowers.branchcode ='')";
-        }
-    }
-   $strsth .= " group by aqbasket.basketno order by aqbasket.basketno";
-    my $sth = $dbh->prepare($strsth);
-    $sth->execute($supplierid);
-    my @results;
-    while (my $data = $sth->fetchrow_hashref ) {
-        push @results, $data ;
-  }
-    $sth->finish;
-    return \@results;
-}
-
-#------------------------------------------------------------#
-
-=head3 GetOrders
-
-=over 4
-
- at orders = &GetOrders($basketnumber, $orderby);
-
-Looks up the non-cancelled orders (whether received or not) with the given basket
-number. If C<$booksellerID> is non-empty, only orders from that seller
-are returned.
-
-return :
-C<&basket> returns a two-element array. C<@orders> is an array of
-references-to-hash, whose keys are the fields from the aqorders,
-biblio, and biblioitems tables in the Koha database.
-
-=back
-
-=cut
-
-sub GetOrders {
-    my ( $basketno, $orderby ) = @_;
-    my $dbh   = C4::Context->dbh;
-    my $query ="
-        SELECT  aqorderbreakdown.*,
-                biblio.*,
-                aqorders.*
-        FROM    aqorders,biblio
-        LEFT JOIN aqorderbreakdown ON
-                    aqorders.ordernumber=aqorderbreakdown.ordernumber
-        WHERE   basketno=?
-            AND biblio.biblionumber=aqorders.biblionumber
-            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
-    ";
-
-    $orderby = "biblio.title" unless $orderby;
-    $query .= " ORDER BY $orderby";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($basketno);
-    my @results;
-
-    #  print $query;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push @results, $data;
-    }
-    $sth->finish;
-    return @results;
-}
-
-sub GetSingleOrder {
-  my ($ordnum)=@_;
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("Select * from biblio,aqorders left join aqorderbreakdown
-  on aqorders.ordernumber=aqorderbreakdown.ordernumber
-  where aqorders.ordernumber=?
-  and biblio.biblionumber=aqorders.biblionumber");
-  $sth->execute($ordnum);
-  my $data=$sth->fetchrow_hashref;
-  $sth->finish;
-  return($data);
-}
-
-#------------------------------------------------------------#
-
-=head3 GetOrderNumber
-
-=over 4
-
-$ordernumber = &GetOrderNumber($biblioitemnumber, $biblionumber);
-
-Looks up the ordernumber with the given biblionumber 
-
-Returns the number of this order.
-
-=item C<$ordernumber> is the order number.
-
-=back
-
-=cut
-sub GetOrderNumber {
-    my ( $biblionumber ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        SELECT ordernumber
-        FROM   aqorders
-        WHERE  biblionumber=?
-       
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $biblionumber );
-
-    return $sth->fetchrow;
-}
-
-#------------------------------------------------------------#
-
-=head3 GetOrder
-
-=over 4
-
-$order = &GetOrder($ordernumber);
-
-Looks up an order by order number.
-
-Returns a reference-to-hash describing the order. The keys of
-C<$order> are fields from the biblio, , aqorders, and
-aqorderbreakdown tables of the Koha database.
-
-=back
-
-=cut
-
-sub GetOrder {
-    my ($ordnum) = @_;
-    my $dbh      = C4::Context->dbh;
-    my $query = "
-        SELECT *
-        FROM   biblio,aqorders
-        LEFT JOIN aqorderbreakdown ON aqorders.ordernumber=aqorderbreakdown.ordernumber
-        WHERE aqorders.ordernumber=?
-        AND   biblio.biblionumber=aqorders.biblionumber
-       
-    ";
-    my $sth= $dbh->prepare($query);
-    $sth->execute($ordnum);
-    my $data = $sth->fetchrow_hashref;
-    $sth->finish;
-    return $data;
-}
-
-#------------------------------------------------------------#
-
-=head3 NewOrder
-
-=over 4
-
-  &NewOrder($basket, $biblionumber, $title, $quantity, $listprice,
-    $booksellerid, $who, $notes, $bookfund, $biblioitemnumber, $rrp,
-    $ecost, $gst, $budget, $unitprice, $subscription,
-    $booksellerinvoicenumber);
-
-Adds a new order to the database. Any argument that isn't described
-below is the new value of the field with the same name in the aqorders
-table of the Koha database.
-
-C<$ordnum> is a "minimum order number." After adding the new entry to
-the aqorders table, C<&neworder> finds the first entry in aqorders
-with order number greater than or equal to C<$ordnum>, and adds an
-entry to the aqorderbreakdown table, with the order number just found,
-and the book fund ID of the newly-added order.
-
-C<$budget> is effectively ignored.
-
-C<$subscription> may be either "yes", or anything else for "no".
-
-=back
-
-=cut
-
-sub NewOrder {
-   my (
-        $basketno,  $biblionumber,       $title,        $quantity,
-        $listprice, $booksellerid, $authorisedby, $notes,
-        $bookfund,    $rrp,          $ecost,
-        $gst,       $budget,       $cost,         $sub,
-        $purchaseorderno,   $sort1,        $sort2,$discount,$branch
-      )
-      = @_;
-
-    my $year  = localtime->year() + 1900;
-    my $month = localtime->mon() + 1;       # months starts at 0, add 1
-
-    if ( !$budget || $budget eq 'now' ) {
-        $budget = "now()";
-    }
-
-    if ( $sub eq 'yes' ) {
-        $sub = 1;
-    }
-    else {
-        $sub = 0;
-    }
-
-    # if $basket empty, it's also a new basket, create it
-    unless ($basketno) {
-        $basketno = NewBasket( $booksellerid, $authorisedby );
-    }
-
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        INSERT INTO aqorders
-           ( biblionumber,title,basketno,quantity,listprice,notes,
-      rrp,ecost,gst,unitprice,subscription,sort1,sort2,purchaseordernumber,discount,budgetdate,entrydate)
-        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,$budget,now() )
-    ";
-    my $sth = $dbh->prepare($query);
-
-    $sth->execute(
-        $biblionumber, $title,      $basketno, $quantity, $listprice,
-        $notes,  $rrp,      $ecost,    $gst,
-        $cost,   $sub,        $sort1,    $sort2,$purchaseorderno,$discount
-    );
-    $sth->finish;
-
-    #get ordnum MYSQL dependant, but $dbh->last_insert_id returns null
-    my $ordnum = $dbh->{'mysql_insertid'};
-    my $query = "
-        INSERT INTO aqorderbreakdown (ordernumber,bookfundid,branchcode)
-        VALUES (?,?,?)
-    ";
-    $sth = $dbh->prepare($query);
-    $sth->execute( $ordnum, $bookfund,$branch );
-    $sth->finish;
-    return ( $basketno, $ordnum );
-}
-
-#------------------------------------------------------------#
-
-=head3 ModOrder
-
-=over 4
-
-&ModOrder($title, $ordernumber, $quantity, $listprice,
-    $biblionumber, $basketno, $supplier, $who, $notes,
-    $bookfundid, $bibitemnum, $rrp, $ecost, $gst, $budget,
-    $unitprice, $booksellerinvoicenumber);
-
-Modifies an existing order. Updates the order with order number
-C<$ordernumber> and biblionumber C<$biblionumber>. All other arguments
-update the fields with the same name in the aqorders table of the Koha
-database.
-
-Entries with order number C<$ordernumber> in the aqorderbreakdown
-table are also updated to the new book fund ID.
-
-=back
-
-=cut
-
-sub ModOrder {
-    my (
-        $title,      $ordnum,   $quantity, $listprice, $biblionumber,
-        $basketno,   $supplier, $who,      $notes,     $bookfund,
-        $rrp,      $ecost,    $gst,       $budget,
-        $cost,       $invoice,  $sort1,    $sort2,$discount,$branch
-      )
-      = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        UPDATE aqorders
-        SET    title=?,
-               quantity=?,listprice=?,basketno=?,
-               rrp=?,ecost=?,unitprice=?,purchaseordernumber=?,gst=?,
-               notes=?,sort1=?, sort2=?,discount=?
-        WHERE  ordernumber=? AND biblionumber=?
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute(
-        $title, $quantity, $listprice, $basketno, $rrp,
-        $ecost, $cost,    $invoice, $gst,   $notes,    $sort1,
-        $sort2, $discount,$ordnum,   $biblionumber
-    );
-    $sth->finish;
-    my $query = "
-        REPLACE aqorderbreakdown
-        SET    ordernumber=?, bookfundid=?, branchcode=?   
-    ";
-    $sth = $dbh->prepare($query);
-
-   $sth->execute( $ordnum,$bookfund, $branch );
-    
-    $sth->finish;
-}
-
-#------------------------------------------------------------#
-
-
-
-
-#------------------------------------------------------------#
-
-=head3 ModReceiveOrder
-
-=over 4
-
-&ModReceiveOrder($biblionumber, $ordernumber, $quantityreceived, $user,
-    $unitprice, $booksellerinvoicenumber, $biblioitemnumber,
-    $freight, $bookfund, $rrp);
-
-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.
-
-Updates the order with bibilionumber C<$biblionumber> and ordernumber
-C<$ordernumber>.
-
-
-=back
-
-=cut
-
-
-sub ModReceiveOrder {
-    my (
-        $biblionumber,    $ordnum,  $quantrec,  $cost,
-        $invoiceno, $freight, $rrp,      $listprice,$input
-      )
-      = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        UPDATE aqorders
-        SET    quantityreceived=quantityreceived+?,datereceived=now(),booksellerinvoicenumber=?,
-               unitprice=?,freight=?,rrp=?,listprice=?
-        WHERE biblionumber=? AND ordernumber=?
-    ";
-    my $sth = $dbh->prepare($query);
-    my $suggestionid = GetSuggestionFromBiblionumber( $dbh, $biblionumber );
-    if ($suggestionid) {
-        ModStatus( $suggestionid, 'AVAILABLE', '', $biblionumber,$input );
-    }
-    $sth->execute( $quantrec, $invoiceno, $cost, $freight, $rrp, $listprice, $biblionumber,
-        $ordnum );
-    $sth->finish;
-
-}
-
-
-#------------------------------------------------------------#
-
-=head3 DelOrder
-
-=over 4
-
-&DelOrder($biblionumber, $ordernumber);
-
-Cancel the order with the given order and biblio numbers. It does not
-delete any entries in the aqorders table, it merely marks them as
-cancelled.
-
-=back
-
-=cut
-
-sub DelOrder {
-    my ( $biblionumber, $ordnum,$user ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        UPDATE aqorders
-        SET    datecancellationprinted=now(), cancelledby=?
-        WHERE  biblionumber=? AND ordernumber=?
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $user,$biblionumber, $ordnum );
-    $sth->finish;
-}
-
-
-=back
-
-=back
-
-=head2 FUNCTIONS ABOUT PARCELS
-
-=over 2
-
-=cut
-
-#------------------------------------------------------------#
-
-=head3 GetParcel
-
-=over 4
-
- at results = &GetParcel($booksellerid, $code, $date);
-
-Looks up all of the received items from the supplier with the given
-bookseller ID at the given date, for the given code (bookseller Invoice number). Ignores cancelled and completed orders.
-
-C<@results> is an array of references-to-hash. The keys of each element are fields from
-the aqorders, biblio tables of the Koha database.
-
-C<@results> is sorted alphabetically by book title.
-
-=back
-
-=cut
-## This routine is not used will be cleaned
-sub GetParcel {
-
-    #gets all orders from a certain supplier, orders them alphabetically
-    my ( $supplierid, $invoice, $datereceived ) = @_;
-    my $dbh     = C4::Context->dbh;
-    my @results = ();
-    $invoice .= '%' if $invoice;  # add % if we search on a given invoice
-    my $strsth ="
-        SELECT  authorisedby,
-                creationdate,
-                aqbasket.basketno,
-                closedate,surname,
-                firstname,
-                biblionumber,
-                aqorders.title,
-                aqorders.ordernumber,
-                aqorders.quantity,
-                aqorders.quantityreceived,
-                aqorders.unitprice,
-                aqorders.listprice,
-                aqorders.rrp,
-                aqorders.ecost
-        FROM aqorders,aqbasket
-        LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
-        WHERE aqbasket.basketno=aqorders.basketno
-            AND aqbasket.booksellerid=?
-            AND (aqorders.datereceived= \"$datereceived\" OR aqorders.datereceived is NULL)";
- $strsth.= " AND aqorders.purchaseordernumber LIKE  \"$invoice\"" if $invoice ne "%";
-
-    if ( C4::Context->preference("IndependantBranches") ) {
-        my $userenv = C4::Context->userenv;
-        if ( ($userenv) && ( $userenv->{flags} != 1 ) ) {
-            $strsth .=
-                " and (borrowers.branchcode = '"
-              . $userenv->{branch}
-              . "' or borrowers.branchcode ='')";
-        }
-    }
-    $strsth .= " order by aqbasket.basketno";
-    ### parcelinformation : $strsth
-    my $sth = $dbh->prepare($strsth);
-    $sth->execute($supplierid);
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push @results, $data ;
-    }
-    ### countparcelbiblio: $count
-    $sth->finish;
-
-    return @results;
-}
-
-#------------------------------------------------------------#
-
-=head3 GetParcels
-
-=over 4
-
-$results = &GetParcels($bookseller, $order, $code, $datefrom, $dateto);
-get a lists of parcels.
-
-* Input arg :
-
-=item $bookseller
-is the bookseller this function has to get parcels.
-
-=item $order
-To know on what criteria the results list has to be ordered.
-
-=item $code
-is the booksellerinvoicenumber.
-
-=item $datefrom & $dateto
-to know on what date this function has to filter its search.
-
-* return:
-a pointer on a hash list containing parcel informations as such :
-
-=item Creation date
-
-=item Last operation
-
-=item Number of biblio
-
-=item Number of items
-
-=back
-
-=cut
-### This routine is not used will be cleaned
-sub GetParcels {
-    my ($bookseller,$order, $code, $datefrom, $dateto) = @_;
-    my $dbh    = C4::Context->dbh;
-    my $strsth ="
-        SELECT  aqorders.booksellerinvoicenumber,
-                datereceived,
-                count(DISTINCT biblionumber) AS biblio,
-                sum(quantity) AS itemsexpected,
-                sum(quantityreceived) AS itemsreceived
-        FROM   aqorders, aqbasket
-        WHERE  aqbasket.basketno = aqorders.basketno
-             AND aqbasket.booksellerid = $bookseller and datereceived IS NOT NULL
-    ";
-
-    $strsth .= "and aqorders.booksellerinvoicenumber like \"$code%\" " if ($code);
-
-    $strsth .= "and datereceived >=" . $dbh->quote($datefrom) . " " if ($datefrom);
-
-    $strsth .= "and datereceived <=" . $dbh->quote($dateto) . " " if ($dateto);
-
-    $strsth .= "group by aqorders.booksellerinvoicenumber,datereceived ";
-    $strsth .= "order by $order " if ($order);
-    my $sth = $dbh->prepare($strsth);
-
-    $sth->execute;
-    my @results;
-
-    while ( my $data2 = $sth->fetchrow_hashref ) {
-        push @results, $data2;
-    }
-
-    $sth->finish;
-    return @results;
-}
-
-#------------------------------------------------------------#
-
-=head3 GetLateOrders
-
-=over 4
-
- at results = &GetLateOrders;
-
-Searches for bookseller with late orders.
-
-return:
-the table of supplier with late issues. This table is full of hashref.
-
-=back
-
-=cut
-
-sub GetLateOrders {
-## requirse fixing for KOHA 3 API. Currently does not return publisher
-    my $delay      = shift;
-    my $supplierid = shift;
-    my $branch     = shift;
-
-    my $dbh = C4::Context->dbh;
-
-    #BEWARE, order of parenthesis and LEFT JOIN is important for speed
-    my $strsth;
-    my $dbdriver = C4::Context->config("db_scheme") || "mysql";
-
-    #    warn " $dbdriver";
-    if ( $dbdriver eq "mysql" ) {
-        $strsth = "
-            SELECT aqbasket.basketno,
-                DATE(aqbasket.closedate) AS orderdate,
-                aqorders.quantity - IFNULL(aqorders.quantityreceived,0) AS quantity,
-                aqorders.rrp AS unitpricesupplier,
-                aqorders.ecost AS unitpricelib,
-                (aqorders.quantity - IFNULL(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal,
-                aqbookfund.bookfundname AS budget,
-                borrowers.branchcode AS branch,
-                aqbooksellers.name AS supplier,
-                aqorders.title,
-                biblio.author,
-               
-                DATEDIFF(CURDATE( ),closedate) AS latesince
-            FROM  ((
-                (aqorders LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber)
-            
-            LEFT JOIN aqorderbreakdown ON aqorders.ordernumber = aqorderbreakdown.ordernumber)
-            LEFT JOIN aqbookfund ON aqorderbreakdown.bookfundid = aqbookfund.bookfundid),
-            (aqbasket LEFT JOIN borrowers ON aqbasket.authorisedby = borrowers.borrowernumber)
-            LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id
-            WHERE aqorders.basketno = aqbasket.basketno
-            AND (closedate < DATE_SUB(CURDATE( ),INTERVAL $delay DAY))
-            AND ((datereceived = '' OR datereceived is null)
-            OR (aqorders.quantityreceived < aqorders.quantity) )
-        ";
-        $strsth .= " AND aqbasket.booksellerid = $supplierid " if ($supplierid);
-        $strsth .= " AND borrowers.branchcode like \'" . $branch . "\'"
-          if ($branch);
-        $strsth .=
-          " AND borrowers.branchcode like \'"
-          . C4::Context->userenv->{branch} . "\'"
-          if ( C4::Context->preference("IndependantBranches")
-            && C4::Context->userenv
-            && C4::Context->userenv->{flags} != 1 );
-        $strsth .=" HAVING quantity<>0
-                    AND unitpricesupplier<>0
-                    AND unitpricelib<>0
-                    ORDER BY latesince,basketno,borrowers.branchcode, supplier
-        ";
-    }
-    else {
-        $strsth = "
-            SELECT aqbasket.basketno,
-                   DATE(aqbasket.closedate) AS orderdate,
-                    aqorders.quantity, aqorders.rrp AS unitpricesupplier,
-                    aqorders.ecost as unitpricelib,
-                    aqorders.quantity * aqorders.rrp AS subtotal
-                    aqbookfund.bookfundname AS budget,
-                    borrowers.branchcode AS branch,
-                    aqbooksellers.name AS supplier,
-                    biblio.title,
-                    biblio.author,
-                   
-                    (CURDATE -  closedate) AS latesince
-                    FROM(( 
-                        (aqorders LEFT JOIN biblio on biblio.biblionumber = aqorders.biblionumber)
-                       
-                        LEFT JOIN aqorderbreakdown on aqorders.ordernumber = aqorderbreakdown.ordernumber)
-                        LEFT JOIN aqbookfund ON aqorderbreakdown.bookfundid = aqbookfund.bookfundid),
-                        (aqbasket LEFT JOIN borrowers on aqbasket.authorisedby = borrowers.borrowernumber) LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id
-                    WHERE aqorders.basketno = aqbasket.basketno
-                    AND (closedate < (CURDATE -(INTERVAL $delay DAY))
-                    AND ((datereceived = '' OR datereceived is null)
-                    OR (aqorders.quantityreceived < aqorders.quantity) ) ";
-        $strsth .= " AND aqbasket.booksellerid = $supplierid " if ($supplierid);
-
-        $strsth .= " AND borrowers.branchcode like \'" . $branch . "\'" if ($branch);
-        $strsth .=" AND borrowers.branchcode like \'". C4::Context->userenv->{branch} . "\'"
-            if (C4::Context->preference("IndependantBranches") && C4::Context->userenv->{flags} != 1 );
-        $strsth .=" ORDER BY latesince,basketno,borrowers.branchcode, supplier";
-    }
-    my $sth = $dbh->prepare($strsth);
-    $sth->execute;
-    my @results;
-    my $hilighted = 1;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        $data->{hilighted} = $hilighted if ( $hilighted > 0 );
-        $data->{orderdate} = format_date( $data->{orderdate} );
-        push @results, $data;
-        $hilighted = -$hilighted;
-    }
-    $sth->finish;
-    return @results;
-}
-
-#------------------------------------------------------------#
-
-=head3 GetHistory
-
-=over 4
-
-(\@order_loop, $total_qty, $total_price, $total_qtyreceived)=&GetHistory( $title, $author, $name, $from_placed_on, $to_placed_on )
-
-this function get the search history.
-
-=back
-
-=cut
-
-sub GetHistory {
-    my ( $title, $author, $name, $from_placed_on, $to_placed_on ) = @_;
-    my @order_loop;
-    my $total_qty         = 0;
-    my $total_qtyreceived = 0;
-    my $total_price       = 0;
-
-# don't run the query if there are no parameters (list would be too long for sure !)
-    if ( $title || $author || $name || $from_placed_on || $to_placed_on ) {
-        my $dbh   = C4::Context->dbh;
-        my $query ="
-            SELECT
-                biblio.title,
-                biblio.author,
-                aqorders.basketno,
-                name,aqbasket.creationdate,
-                aqorders.datereceived,
-                aqorders.quantity,
-                aqorders.quantityreceived,
-                aqorders.ecost,
-                aqorders.ordernumber
-            FROM aqorders,aqbasket,aqbooksellers,biblio";
-
-        $query .= ",borrowers "
-          if ( C4::Context->preference("IndependantBranches") );
-
-        $query .="
-            WHERE aqorders.basketno=aqbasket.basketno
-            AND   aqbasket.booksellerid=aqbooksellers.id
-            AND   biblio.biblionumber=aqorders.biblionumber ";
-
-        $query .= " AND aqbasket.authorisedby=borrowers.borrowernumber"
-          if ( C4::Context->preference("IndependantBranches") );
-
-        $query .= " AND biblio.title LIKE " . $dbh->quote( "%" . $title . "%" )
-          if $title;
-
-        $query .=
-          " AND biblio.author LIKE " . $dbh->quote( "%" . $author . "%" )
-          if $author;
-
-        $query .= " AND name LIKE " . $dbh->quote( "%" . $name . "%" ) if $name;
-
-        $query .= " AND creationdate >" . $dbh->quote($from_placed_on)
-          if $from_placed_on;
-
-        $query .= " AND creationdate<" . $dbh->quote($to_placed_on)
-          if $to_placed_on;
-
-        if ( C4::Context->preference("IndependantBranches") ) {
-            my $userenv = C4::Context->userenv;
-            if ( ($userenv) && ( $userenv->{flags} != 1 ) ) {
-                $query .=
-                    " AND (borrowers.branchcode = '"
-                  . $userenv->{branch}
-                  . "' OR borrowers.branchcode ='')";
-            }
-        }
-        $query .= " ORDER BY booksellerid";
-        my $sth = $dbh->prepare($query);
-        $sth->execute;
-        my $cnt = 1;
-        while ( my $line = $sth->fetchrow_hashref ) {
-            $line->{count} = $cnt++;
-            $line->{toggle} = 1 if $cnt % 2;
-            push @order_loop, $line;
-            $line->{creationdate} = format_date( $line->{creationdate} );
-            $line->{datereceived} = format_date( $line->{datereceived} );
-            $total_qty         += $line->{'quantity'};
-            $total_qtyreceived += $line->{'quantityreceived'};
-            $total_price       += $line->{'quantity'} * $line->{'ecost'};
-        }
-    }
-    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
-}
-
-
-1;
-
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Amazon.pm
===================================================================
RCS file: modules/C4/Amazon.pm
diff -N modules/C4/Amazon.pm
--- modules/C4/Amazon.pm	10 Mar 2007 01:35:33 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,91 +0,0 @@
-
-package C4::Amazon;
-# Copyright 2004-2005 Joshua Ferraro (jmf at kados dot org)
-#
-# 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
-#
-# This module dynamically pulls amazon content into Koha.  It does not
-# store the data in Koha's database.  You'll need to get a developer's key
-# as well as an associate's tag to use it.
-# FIXME: need to write up more docs.
-#
-# To use this module you need to do three things:
-# 1. get a dev key and associate tag from Amazon
-# 2. uncomment the Amazon stuff in opac-detail.pl
-# 3. add the template variables to opac-detail.tmpl
-#    here's what's available: 
-#    ProductDescription
-#    ImageUrlMedium
-#    ListPrice
-#    url
-#    loop SimilarProducts (Product)
-#    loop Reviews (rating, Summary)
-#
-use strict;
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-$VERSION = 0.01;
-
- at ISA = qw(Exporter);
-
- at EXPORT = qw(
-  &get_amazon_details
-);
-
-sub get_amazon_details {
-
-my ( $isbn ) = @_;
-
-# insert your dev key here
-my $dev_key='neulibrary-20';
-$isbn=substr($isbn,0,9);
-# insert your associates tag here
-my $af_tag='0YGCZ5GV9ZNGGS7THDG2';
-
-my $asin=$isbn;
-
-# old way from command line: shift @ARGV or die "Usage:perl amazon_http.ol <asin>\n";
-
-#my $url = "http://xml.amazon.com/onca/xml3?t=" . $af_tag .
-#	"&dev-t=" . $dev_key .
-#	"&type=heavy&f=xml&" .
-#	"AsinSearch=" . $asin;
-my $url = "http://xml.amazon.com/onca/xml3?t=$dev_key&dev-t=$af_tag&type=heavy&f=xml&AsinSearch=" . $asin;
-
-#Here's an example asin for the book "Cryptonomicon"
-#0596005423";
-
-use XML::Simple;
-use LWP::Simple;
-my $content = get($url);
-if ($content){
-
-my $xmlsimple = XML::Simple->new();
-my $response = $xmlsimple->XMLin($content,
-  forcearray => [ qw(Details Product AvgCustomerRating CustomerReview ) ],
-);
-return $response;
-#foreach my $result (@{$response->{Details}}){
-#	my $product_description = $result->{ProductDescription};
-#	my $image = $result->{ImageUrlMedium};
-#	my $price = $result->{ListPrice};
-#	my $reviews = $result->{
-#	return $result;
-#}
-}
-}
\ No newline at end of file

Index: modules/C4/Auth.pm
===================================================================
RCS file: modules/C4/Auth.pm
diff -N modules/C4/Auth.pm
--- modules/C4/Auth.pm	10 Mar 2007 01:35:33 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,627 +0,0 @@
-# -*- tab-width: 8 -*-
-# NOTE: This file uses 8-character tabs; do not change the tab size!
-
-package C4::Auth;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-use Digest::MD5 qw(md5_base64);
-require Exporter;
-use C4::Context;
-use C4::Output;              # to get the template
-use C4::Interface::CGI::Output;
-use C4::Members;  # getpatroninformation
-use C4::Koha;## to get branch
-# use Net::LDAP;
-# use Net::LDAP qw(:all);
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = 0.01;
- at ISA = qw(Exporter);
-
- at EXPORT = qw(
-&checkpw
-);
-=head1 NAME
-
-C4::Auth - Authenticates Koha users
-
-=head1 SYNOPSIS
-
-  use CGI;
-  use C4::Auth;
-
-  my $query = new CGI;
-
-  my ($template, $borrowernumber, $cookie) 
-    = get_template_and_user({template_name   => "opac-main.tmpl",
-                             query           => $query,
-			     type            => "opac",
-			     authnotrequired => 1,
-			     flagsrequired   => {borrow => 1},
-			  });
-
-  print $query->header(
-    -type => "text/html",
-    -charset=>"utf-8",
-    -cookie => $cookie
-  ), $template->output;
-
-
-=head1 DESCRIPTION
-
-    The main function of this module is to provide
-    authentification. However the get_template_and_user function has
-    been provided so that a users login information is passed along
-    automatically. This gets loaded into the template.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
-
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-	     &checkauth
-	     &get_template_and_user
-);
-
-=item get_template_and_user
-
-  my ($template, $borrowernumber, $cookie)
-    = get_template_and_user({template_name   => "opac-main.tmpl",
-                             query           => $query,
-			     type            => "opac",
-			     authnotrequired => 1,
-			     flagsrequired   => {borrow => 1},
-			  });
-
-    This call passes the C<query>, C<flagsrequired> and C<authnotrequired>
-    to C<&checkauth> (in this module) to perform authentification.
-    See C<&checkauth> for an explanation of these parameters.
-
-    The C<template_name> is then used to find the correct template for
-    the page. The authenticated users details are loaded onto the
-    template in the HTML::Template LOOP variable C<USER_INFO>. Also the
-    C<sessionID> is passed to the template. This can be used in templates
-    if cookies are disabled. It needs to be put as and input to every
-    authenticated page.
-
-    More information on the C<gettemplate> sub can be found in the
-    Output.pm module.
-
-=cut
-
-
-sub get_template_and_user {
-	my $in = shift;
-	my $template = gettemplate($in->{'template_name'}, $in->{'type'},$in->{'query'});
-	my ($user, $cookie, $sessionID, $flags)
-		= checkauth($in->{'query'}, $in->{'authnotrequired'}, $in->{'flagsrequired'}, $in->{'type'});
-
-	my $borrowernumber;
-	if ($user) {
-		$template->param(loggedinusername => $user);
-		$template->param(sessionID => $sessionID);
-
-		$borrowernumber = getborrowernumber($user);
-		my ($borr, $alternativeflags) = getpatroninformation(undef, $borrowernumber);
-		my @bordat;
-		$bordat[0] = $borr;
-		$template->param(USER_INFO => \@bordat,
-		);
-		my $branches=GetBranches();
-		$template->param(branchname=>$branches->{$borr->{branchcode}}->{branchname},);
-		
-		# We are going to use the $flags returned by checkauth
-		# to create the template's parameters that will indicate
-		# which menus the user can access.
-		if ($flags && $flags->{superlibrarian} == 1)
-		{
-			$template->param(CAN_user_circulate => 1);
-			$template->param(CAN_user_catalogue => 1);
-			$template->param(CAN_user_parameters => 1);
-			$template->param(CAN_user_borrowers => 1);
-			$template->param(CAN_user_permission => 1);
-			$template->param(CAN_user_reserveforothers => 1);
-			$template->param(CAN_user_borrow => 1);
-			$template->param(CAN_user_reserveforself => 1);
-			$template->param(CAN_user_editcatalogue => 1);
-			$template->param(CAN_user_updatecharge => 1);
-			$template->param(CAN_user_acquisition => 1);
-			$template->param(CAN_user_management => 1);
-			$template->param(CAN_user_tools => 1); }
-		
-		if ($flags && $flags->{circulate} == 1) {
-			$template->param(CAN_user_circulate => 1); }
-
-		if ($flags && $flags->{catalogue} == 1) {
-			$template->param(CAN_user_catalogue => 1); }
-		
-
-		if ($flags && $flags->{parameters} == 1) {
-			$template->param(CAN_user_parameters => 1);	
-			$template->param(CAN_user_management => 1);
-			$template->param(CAN_user_tools => 1); }
-		
-
-		if ($flags && $flags->{borrowers} == 1) {
-			$template->param(CAN_user_borrowers => 1); }
-		
-
-		if ($flags && $flags->{permissions} == 1) {
-			$template->param(CAN_user_permission => 1); }
-		
-		if ($flags && $flags->{reserveforothers} == 1) {
-			$template->param(CAN_user_reserveforothers => 1); }
-		
-
-		if ($flags && $flags->{borrow} == 1) {
-			$template->param(CAN_user_borrow => 1); }
-		
-
-		if ($flags && $flags->{reserveforself} == 1) {
-			$template->param(CAN_user_reserveforself => 1); }
-		
-
-		if ($flags && $flags->{editcatalogue} == 1) {
-			$template->param(CAN_user_editcatalogue => 1); }
-		
-
-		if ($flags && $flags->{updatecharges} == 1) {
-			$template->param(CAN_user_updatecharge => 1); }
-		
-		if ($flags && $flags->{acquisition} == 1) {
-			$template->param(CAN_user_acquisition => 1); }
-		
-		if ($flags && $flags->{management} == 1) {
-			$template->param(CAN_user_management => 1);
-			$template->param(CAN_user_tools => 1); }
-		
-		if ($flags && $flags->{tools} == 1) {
-			$template->param(CAN_user_tools => 1); }
-		
-	}
-	if  ($in->{'type'} eq "intranet") {
-        $template->param(
-                        intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),  
-                        intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-                        IntranetNav => C4::Context->preference("IntranetNav"),
-
-        );
-
-	}
-        else {
-	$template->param(
-				suggestion => C4::Context->preference("suggestion"),
-				virtualshelves => C4::Context->preference("virtualshelves"),
-				OpacNav => C4::Context->preference("OpacNav"),
-				opacheader	=> C4::Context->preference("opacheader"),
-				opaccredits => C4::Context->preference("opaccredits"),
-				opacsmallimage => C4::Context->preference("opacsmallimage"),
-				opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"),
-				opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"),
-				opaclanguagesdisplay => C4::Context->preference("opaclanguagesdisplay"),
-				TemplateEncoding => C4::Context->preference("TemplateEncoding"),
-				opacuserlogin => C4::Context->preference("opacuserlogin"),
-				opacbookbag => C4::Context->preference("opacbookbag"),
-		);
-	}
-	$template->param(
-				TemplateEncoding => C4::Context->preference("TemplateEncoding"),
-				AmazonContent => C4::Context->preference("AmazonContent"),
-			     LibraryName => C4::Context->preference("LibraryName"),
-		);
-	return ($template, $borrowernumber, $cookie);
-}
-
-
-=item checkauth
-
-  ($userid, $cookie, $sessionID) = &checkauth($query, $noauth, $flagsrequired, $type);
-
-Verifies that the user is authorized to run this script.  If
-the user is authorized, a (userid, cookie, session-id, flags)
-quadruple is returned.  If the user is not authorized but does
-not have the required privilege (see $flagsrequired below), it
-displays an error page and exits.  Otherwise, it displays the
-login page and exits.
-
-Note that C<&checkauth> will return if and only if the user
-is authorized, so it should be called early on, before any
-unfinished operations (e.g., if you've opened a file, then
-C<&checkauth> won't close it for you).
-
-C<$query> is the CGI object for the script calling C<&checkauth>.
-
-The C<$noauth> argument is optional. If it is set, then no
-authorization is required for the script.
-
-C<&checkauth> fetches user and session information from C<$query> and
-ensures that the user is authorized to run scripts that require
-authorization.
-
-The C<$flagsrequired> argument specifies the required privileges
-the user must have if the username and password are correct.
-It should be specified as a reference-to-hash; keys in the hash
-should be the "flags" for the user, as specified in the Members
-intranet module. Any key specified must correspond to a "flag"
-in the userflags table. E.g., { circulate => 1 } would specify
-that the user must have the "circulate" privilege in order to
-proceed. To make sure that access control is correct, the
-C<$flagsrequired> parameter must be specified correctly.
-
-The C<$type> argument specifies whether the template should be
-retrieved from the opac or intranet directory tree.  "opac" is
-assumed if it is not specified; however, if C<$type> is specified,
-"intranet" is assumed if it is not "opac".
-
-If C<$query> does not have a valid session ID associated with it
-(i.e., the user has not logged in) or if the session has expired,
-C<&checkauth> presents the user with a login page (from the point of
-view of the original script, C<&checkauth> does not return). Once the
-user has authenticated, C<&checkauth> restarts the original script
-(this time, C<&checkauth> returns).
-
-The login page is provided using a HTML::Template, which is set in the
-systempreferences table or at the top of this file. The variable C<$type>
-selects which template to use, either the opac or the intranet 
-authentification template.
-
-C<&checkauth> returns a user ID, a cookie, and a session ID. The
-cookie should be sent back to the browser; it verifies that the user
-has authenticated.
-
-=cut
-
-
-
-sub checkauth {
-	my $query=shift;
-	# $authnotrequired will be set for scripts which will run without authentication
-	my $authnotrequired = shift;
-	my $flagsrequired = shift;
-	my $type = shift;
-	$type = 'opac' unless $type;
-
-	my $dbh = C4::Context->dbh;
-	my $timeout = C4::Context->preference('timeout');
-	$timeout = 600 unless $timeout;
-
-	my $template_name;
-	if ($type eq 'opac') {
-		$template_name = "opac-auth.tmpl";
-	} elsif ($type eq 'wap') {
-		$template_name = "wap-auth.tmpl";
-	}else {
-		$template_name = "auth.tmpl";
-	}
-
-	# state variables
-	my $loggedin = 0;
-	my %info;
-	my ($userid, $cookie, $sessionID, $flags,$envcookie);
-	my $logout = $query->param('logout.x');
-	if ($userid = $ENV{'REMOTE_USER'}) {
-		# Using Basic Authentication, no cookies required
-		$cookie=$query->cookie(-name => 'sessionID',
-				-value => '',
-				-expires => '');
-		$loggedin = 1;
-	} elsif ($sessionID=$query->cookie('sessionID')) {
-		C4::Context->_new_userenv($sessionID);
-		if (my %hash=$query->cookie('userenv')){
-				C4::Context::set_userenv(
-					$hash{number},
-					$hash{id},
-					$hash{cardnumber},
-					$hash{firstname},
-					$hash{surname},
-					$hash{branch},
-					$hash{branchname},
-					$hash{flags},
-					$hash{emailaddress},
-				);
-		}
-		my ($ip , $lasttime);
-
-		($userid, $ip, $lasttime) = $dbh->selectrow_array(
-				"SELECT userid,ip,lasttime FROM sessions WHERE sessionid=?",
-								undef, $sessionID);
-		if ($logout) {
-		# voluntary logout the user
-		$dbh->do("DELETE FROM sessions WHERE sessionID='$sessionID'");
-		C4::Context->_unset_userenv($sessionID);
-		$sessionID = undef;
-		$userid = undef;
-		open L, ">>/tmp/sessionlog";
-		my $time=localtime(time());
-		printf L "%20s from %16s logged out at %30s (manually).\n", $userid, $ip, $time;
-		close L;
-		}
-		if ($userid) {
-			if ($lasttime<time()-$timeout) {
-				# timed logout
-				$info{'timed_out'} = 1;
-				$dbh->do("DELETE FROM sessions WHERE sessionID=?", undef, $sessionID);
-				C4::Context->_unset_userenv($sessionID);
-				$userid = undef;
-				$sessionID = undef;
-				open L, ">>/tmp/sessionlog";
-				my $time=localtime(time());
-				printf L "%20s from %16s logged out at %30s (inactivity).\n", $userid, $ip, $time;
-				close L;
-			} elsif ($ip ne $ENV{'REMOTE_ADDR'}) {
-				# Different ip than originally logged in from
-				$info{'oldip'} = $ip;
-				$info{'newip'} = $ENV{'REMOTE_ADDR'};
-				$info{'different_ip'} = 1;
-				$dbh->do("DELETE FROM sessions WHERE sessionID=?", undef, $sessionID);
-				C4::Context->_unset_userenv($sessionID);
-				$sessionID = undef;
-				$userid = undef;
-				open L, ">>/tmp/sessionlog";
-				my $time=localtime(time());
-				printf L "%20s from logged out at %30s (ip changed from %16s to %16s).\n", $userid, $time, $ip, $info{'newip'};
-				close L;
-			} else {
-				$cookie=$query->cookie(-name => 'sessionID',
-						-value => $sessionID,
-						-expires => '');
-				$dbh->do("UPDATE sessions SET lasttime=? WHERE sessionID=?",
-					undef, (time(), $sessionID));
-				$flags = haspermission($dbh, $userid, $flagsrequired);
-				if ($flags) {
-				$loggedin = 1;
-				} else {
-				$info{'nopermission'} = 1;
-				}
-			}
-		}
-	}
-	unless ($userid) {
-		$sessionID=int(rand()*100000).'-'.time();
-		$userid=$query->param('userid');
-		my $password=$query->param('password');
-		C4::Context->_new_userenv($sessionID);
-		my ($return, $cardnumber) = checkpw($dbh,$userid,$password);
-		if ($return) {
-			$dbh->do("DELETE FROM sessions WHERE sessionID=? AND userid=?",
-				undef, ($sessionID, $userid));
-			$dbh->do("INSERT INTO sessions (sessionID, userid, ip,lasttime) VALUES (?, ?, ?, ?)",
-				undef, ($sessionID, $userid, $ENV{'REMOTE_ADDR'}, time()));
-			open L, ">>/tmp/sessionlog";
-			my $time=localtime(time());
-			printf L "%20s from %16s logged in  at %30s.\n", $userid, $ENV{'REMOTE_ADDR'}, $time;
-			close L;
-			$cookie=$query->cookie(-name => 'sessionID',
-						-value => $sessionID,
-						-expires => '');
-			if ($flags = haspermission($dbh, $userid, $flagsrequired)) {
-				$loggedin = 1;
-			} else {
-				$info{'nopermission'} = 1;
-					C4::Context->_unset_userenv($sessionID);
-			}
-			if ($return == 1){
-				my ($bornum,$firstname,$surname,$userflags,$branchcode,$branchname,$emailaddress);
-				my $sth=$dbh->prepare("select borrowernumber,firstname,surname,flags,borrowers.branchcode,branchname,emailaddress from borrowers left join branches on borrowers.branchcode=branches.branchcode where userid=?");
-				$sth->execute($userid);
-				($bornum,$firstname,$surname,$userflags,$branchcode,$branchname, $emailaddress) = $sth->fetchrow if ($sth->rows);
-# 				warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
-				unless ($sth->rows){
-					my $sth=$dbh->prepare("select borrowernumber,firstname,surname,flags,borrowers.branchcode,branchname,emailaddress from borrowers left join branches on borrowers.branchcode=branches.branchcode where cardnumber=?");
-					$sth->execute($cardnumber);
-					($bornum,$firstname,$surname,$userflags,$branchcode, $branchname,$emailaddress) = $sth->fetchrow if ($sth->rows);
-# 					warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
-					unless ($sth->rows){
-						$sth->execute($userid);
-						($bornum,$firstname,$surname,$userflags,$branchcode, $branchname, $emailaddress) = $sth->fetchrow if ($sth->rows);
-					}
-# 					warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
-				}
-				my $hash = C4::Context::set_userenv(
-					$bornum,
-					$userid,
-					$cardnumber,
-					$firstname,
-					$surname,
-					$branchcode,
-					$branchname, 
-					$userflags,
-					$emailaddress,
-				);
-# 				warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
-				$envcookie=$query->cookie(-name => 'userenv',
-						-value => $hash,
-						-expires => '');
-			} elsif ($return == 2) {
-			#We suppose the user is the superlibrarian
-				my $hash = C4::Context::set_userenv(
-					0,0,
-					C4::Context->config('user'),
-					C4::Context->config('user'),
-					C4::Context->config('user'),
-					"","",1,C4::Context->preference('KohaAdminEmailAddress')
-				);
-				$envcookie=$query->cookie(-name => 'userenv',
-						-value => $hash,
-						-expires => '');
-			}
-		} else {
-			if ($userid) {
-				$info{'invalid_username_or_password'} = 1;
-				C4::Context->_unset_userenv($sessionID);
-			}
-		}
-	}
-	my $insecure = C4::Context->boolean_preference('insecure');
-	# finished authentification, now respond
-	if ($loggedin || $authnotrequired || (defined($insecure) && $insecure)) {
-		# successful login
-		unless ($cookie) {
-		$cookie=$query->cookie(-name => 'sessionID',
-					-value => '',
-					-expires => '');
-		}
-		if ($envcookie){
-			return ($userid, [$cookie,$envcookie], $sessionID, $flags)
-		} else {
-			return ($userid, $cookie, $sessionID, $flags);
-		}
-	}
-	# else we have a problem...
-	# get the inputs from the incoming query
-	my @inputs =();
-	foreach my $name (param $query) {
-		(next) if ($name eq 'userid' || $name eq 'password');
-		my $value = $query->param($name);
-		push @inputs, {name => $name , value => $value};
-	}
-
-	my $template = gettemplate($template_name, $type,$query);
-	$template->param(INPUTS => \@inputs,
-			intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-			intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-			IntranetNav => C4::Context->preference("IntranetNav"),
-			opacnav => C4::Context->preference("OpacNav"),
-			TemplateEncoding => C4::Context->preference("TemplateEncoding"),
-
-			);
-	$template->param(loginprompt => 1) unless $info{'nopermission'};
-
-	my $self_url = $query->url(-absolute => 1);
-	$template->param(url => $self_url, LibraryName=> => C4::Context->preference("LibraryName"),);
-	$template->param(\%info);
-	$cookie=$query->cookie(-name => 'sessionID',
-					-value => $sessionID,
-					-expires => '');
-	
-output_html_with_http_headers($query, $cookie, $template->output());
-	exit;
-}
-
-
-
-
-sub checkpw {
-
-	my ($dbh, $userid, $password) = @_;
-# INTERNAL AUTH
-	my $sth=$dbh->prepare("select password,cardnumber from borrowers where userid=?");
-	$sth->execute($userid);
-	if ($sth->rows) {
-		my ($md5password,$cardnumber) = $sth->fetchrow;
-		if (md5_base64($password) eq $md5password) {
-			return 1,$cardnumber;
-		}
-	}
-	 $sth=$dbh->prepare("select password from borrowers where cardnumber=?");
-	$sth->execute($userid);
-	if ($sth->rows) {
-		my ($md5password) = $sth->fetchrow;
-		if (md5_base64($password) eq $md5password) {
-			return 1,$userid;
-		}
-	}
-	if ($userid eq C4::Context->config('user') && $password eq C4::Context->config('pass')) {
-		# Koha superuser account
-		return 2;
-	}
-	if ($userid eq 'demo' && $password eq 'demo' && C4::Context->config('demo')) {
-		# DEMO => the demo user is allowed to do everything (if demo set to 1 in koha.conf
-		# some features won't be effective : modify systempref, modify MARC structure,
-		return 2;
-	}
-	return 0;
-}
-
-sub getuserflags {
-    my $cardnumber=shift;
-    my $dbh=shift;
-    my $userflags;
-    my $sth=$dbh->prepare("SELECT flags FROM borrowers WHERE cardnumber=?");
-    $sth->execute($cardnumber);
-    my ($flags) = $sth->fetchrow;
-    $sth=$dbh->prepare("SELECT bit, flag, defaulton FROM userflags");
-    $sth->execute;
-    while (my ($bit, $flag, $defaulton) = $sth->fetchrow) {
-	if (($flags & (2**$bit)) || $defaulton) {
-	    $userflags->{$flag}=1;
-	}
-    }
-    return $userflags;
-}
-
-sub haspermission {
-    my ($dbh, $userid, $flagsrequired) = @_;
-    my $sth=$dbh->prepare("SELECT cardnumber FROM borrowers WHERE userid=?");
-    $sth->execute($userid);
-    my ($cardnumber) = $sth->fetchrow;
-    ($cardnumber) || ($cardnumber=$userid);
-    my $flags=getuserflags($cardnumber,$dbh);
-    my $configfile;
-    if ($userid eq C4::Context->config('user')) {
-	# Super User Account from /etc/koha.conf
-	$flags->{'superlibrarian'}=1;
-     }
-     if ($userid eq 'demo' && C4::Context->config('demo')) {
-	# Demo user that can do "anything" (demo=1 in /etc/koha.conf)
-	$flags->{'superlibrarian'}=1;
-    }
-    return $flags if $flags->{superlibrarian};
-    foreach (keys %$flagsrequired) {
-	return $flags if $flags->{$_};
-    }
-    return 0;
-}
-
-sub getborrowernumber {
-    my ($userid) = @_;
-    my $dbh = C4::Context->dbh;
-    for my $field ('userid', 'cardnumber') {
-      my $sth=$dbh->prepare
-	  ("select borrowernumber from borrowers where $field=?");
-      $sth->execute($userid);
-      if ($sth->rows) {
-	my ($bnumber) = $sth->fetchrow;
-	return $bnumber;
-      }
-    }
-    return 0;
-}
-1;
-__END__
-
-=back
-
-=head1 SEE ALSO
-
-CGI(3)
-
-C4::Output(3)
-
-Digest::MD5(3)
-
-=cut

Index: modules/C4/Auth_with_ldap.pm
===================================================================
RCS file: modules/C4/Auth_with_ldap.pm
diff -N modules/C4/Auth_with_ldap.pm
--- modules/C4/Auth_with_ldap.pm	10 Mar 2007 01:35:33 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,688 +0,0 @@
-# -*- tab-width: 8 -*-
-# NOTE: This file uses 8-character tabs; do not change the tab size!
-
-package C4::Auth;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-use Digest::MD5 qw(md5_base64);
-
-require Exporter;
-use C4::Context;
-use C4::Output;              # to get the template
-use C4::Interface::CGI::Output;
-use C4::Circulation::Circ2;  # getpatroninformation
-use C4::Members;
-# use Net::LDAP;
-# use Net::LDAP qw(:all);
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Auth - Authenticates Koha users
-
-=head1 SYNOPSIS
-
-  use CGI;
-  use C4::Auth;
-
-  my $query = new CGI;
-
-  my ($template, $borrowernumber, $cookie) 
-    = get_template_and_user({template_name   => "opac-main.tmpl",
-                             query           => $query,
-			     type            => "opac",
-			     authnotrequired => 1,
-			     flagsrequired   => {borrow => 1},
-			  });
-
-  print $query->header(
-    -type => guesstype($template->output),
-    -cookie => $cookie
-  ), $template->output;
-
-
-=head1 DESCRIPTION
-
-    The main function of this module is to provide
-    authentification. However the get_template_and_user function has
-    been provided so that a users login information is passed along
-    automatically. This gets loaded into the template.
-
-=head1 LDAP specific
-
-    This module is specific to LDAP authentification. It requires Net::LDAP package and a working LDAP server.
-	To use it :
-	   * move initial Auth.pm elsewhere
-	   * Search the string LOCAL
-	   * modify the code between LOCAL and /LOCAL to fit your LDAP server parameters & fields
-	   * rename this module to Auth.pm
-	That should be enough.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
-
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-	     &checkauth
-	     &get_template_and_user
-);
-
-=item get_template_and_user
-
-  my ($template, $borrowernumber, $cookie)
-    = get_template_and_user({template_name   => "opac-main.tmpl",
-                             query           => $query,
-			     type            => "opac",
-			     authnotrequired => 1,
-			     flagsrequired   => {borrow => 1},
-			  });
-
-    This call passes the C<query>, C<flagsrequired> and C<authnotrequired>
-    to C<&checkauth> (in this module) to perform authentification.
-    See C<&checkauth> for an explanation of these parameters.
-
-    The C<template_name> is then used to find the correct template for
-    the page. The authenticated users details are loaded onto the
-    template in the HTML::Template LOOP variable C<USER_INFO>. Also the
-    C<sessionID> is passed to the template. This can be used in templates
-    if cookies are disabled. It needs to be put as and input to every
-    authenticated page.
-
-    More information on the C<gettemplate> sub can be found in the
-    Output.pm module.
-
-=cut
-
-
-sub get_template_and_user {
-	my $in = shift;
-	my $template = gettemplate($in->{'template_name'}, $in->{'type'},$in->{'query'});
-	my ($user, $cookie, $sessionID, $flags)
-		= checkauth($in->{'query'}, $in->{'authnotrequired'}, $in->{'flagsrequired'}, $in->{'type'});
-
-	my $borrowernumber;
-	if ($user) {
-		$template->param(loggedinusername => $user);
-		$template->param(sessionID => $sessionID);
-
-		$borrowernumber = getborrowernumber($user);
-		my ($borr, $alternativeflags) = getpatroninformation(undef, $borrowernumber);
-		my @bordat;
-		$bordat[0] = $borr;
-		$template->param(USER_INFO => \@bordat,
-		);
-		# We are going to use the $flags returned by checkauth
-		# to create the template's parameters that will indicate
-		# which menus the user can access.
-		if ($flags && $flags->{superlibrarian} == 1)
-		{
-			$template->param(CAN_user_circulate => 1);
-			$template->param(CAN_user_catalogue => 1);
-			$template->param(CAN_user_parameters => 1);
-			$template->param(CAN_user_borrowers => 1);
-			$template->param(CAN_user_permission => 1);
-			$template->param(CAN_user_reserveforothers => 1);
-			$template->param(CAN_user_borrow => 1);
-			$template->param(CAN_user_reserveforself => 1);
-			$template->param(CAN_user_editcatalogue => 1);
-			$template->param(CAN_user_updatecharge => 1);
-			$template->param(CAN_user_acquisition => 1);
-			$template->param(CAN_user_management => 1);
-			$template->param(CAN_user_tools => 1); }
-		
-		if ($flags && $flags->{circulate} == 1) {
-			$template->param(CAN_user_circulate => 1); }
-
-		if ($flags && $flags->{catalogue} == 1) {
-			$template->param(CAN_user_catalogue => 1); }
-		
-
-		if ($flags && $flags->{parameters} == 1) {
-			$template->param(CAN_user_parameters => 1);	
-			$template->param(CAN_user_management => 1);
-			$template->param(CAN_user_tools => 1); }
-		
-
-		if ($flags && $flags->{borrowers} == 1) {
-			$template->param(CAN_user_borrowers => 1); }
-		
-
-		if ($flags && $flags->{permissions} == 1) {
-			$template->param(CAN_user_permission => 1); }
-		
-		if ($flags && $flags->{reserveforothers} == 1) {
-			$template->param(CAN_user_reserveforothers => 1); }
-		
-
-		if ($flags && $flags->{borrow} == 1) {
-			$template->param(CAN_user_borrow => 1); }
-		
-
-		if ($flags && $flags->{reserveforself} == 1) {
-			$template->param(CAN_user_reserveforself => 1); }
-		
-
-		if ($flags && $flags->{editcatalogue} == 1) {
-			$template->param(CAN_user_editcatalogue => 1); }
-		
-
-		if ($flags && $flags->{updatecharges} == 1) {
-			$template->param(CAN_user_updatecharge => 1); }
-		
-		if ($flags && $flags->{acquisition} == 1) {
-			$template->param(CAN_user_acquisition => 1); }
-		
-		if ($flags && $flags->{management} == 1) {
-			$template->param(CAN_user_management => 1);
-			$template->param(CAN_user_tools => 1); }
-		
-		if ($flags && $flags->{tools} == 1) {
-			$template->param(CAN_user_tools => 1); }
-        }
-	$template->param(
-			     LibraryName => C4::Context->preference("LibraryName"),
-		);
-	return ($template, $borrowernumber, $cookie);
-}
-
-
-=item checkauth
-
-  ($userid, $cookie, $sessionID) = &checkauth($query, $noauth, $flagsrequired, $type);
-
-Verifies that the user is authorized to run this script.  If
-the user is authorized, a (userid, cookie, session-id, flags)
-quadruple is returned.  If the user is not authorized but does
-not have the required privilege (see $flagsrequired below), it
-displays an error page and exits.  Otherwise, it displays the
-login page and exits.
-
-Note that C<&checkauth> will return if and only if the user
-is authorized, so it should be called early on, before any
-unfinished operations (e.g., if you've opened a file, then
-C<&checkauth> won't close it for you).
-
-C<$query> is the CGI object for the script calling C<&checkauth>.
-
-The C<$noauth> argument is optional. If it is set, then no
-authorization is required for the script.
-
-C<&checkauth> fetches user and session information from C<$query> and
-ensures that the user is authorized to run scripts that require
-authorization.
-
-The C<$flagsrequired> argument specifies the required privileges
-the user must have if the username and password are correct.
-It should be specified as a reference-to-hash; keys in the hash
-should be the "flags" for the user, as specified in the Members
-intranet module. Any key specified must correspond to a "flag"
-in the userflags table. E.g., { circulate => 1 } would specify
-that the user must have the "circulate" privilege in order to
-proceed. To make sure that access control is correct, the
-C<$flagsrequired> parameter must be specified correctly.
-
-The C<$type> argument specifies whether the template should be
-retrieved from the opac or intranet directory tree.  "opac" is
-assumed if it is not specified; however, if C<$type> is specified,
-"intranet" is assumed if it is not "opac".
-
-If C<$query> does not have a valid session ID associated with it
-(i.e., the user has not logged in) or if the session has expired,
-C<&checkauth> presents the user with a login page (from the point of
-view of the original script, C<&checkauth> does not return). Once the
-user has authenticated, C<&checkauth> restarts the original script
-(this time, C<&checkauth> returns).
-
-The login page is provided using a HTML::Template, which is set in the
-systempreferences table or at the top of this file. The variable C<$type>
-selects which template to use, either the opac or the intranet 
-authentification template.
-
-C<&checkauth> returns a user ID, a cookie, and a session ID. The
-cookie should be sent back to the browser; it verifies that the user
-has authenticated.
-
-=cut
-
-
-
-sub checkauth {
-	my $query=shift;
-	# $authnotrequired will be set for scripts which will run without authentication
-	my $authnotrequired = shift;
-	my $flagsrequired = shift;
-	my $type = shift;
-	$type = 'opac' unless $type;
-
-	my $dbh = C4::Context->dbh;
-	my $timeout = C4::Context->preference('timeout');
-	$timeout = 600 unless $timeout;
-
-	my $template_name;
-	if ($type eq 'opac') {
-		$template_name = "opac-auth.tmpl";
-	} else {
-		$template_name = "auth.tmpl";
-	}
-
-	# state variables
-	my $loggedin = 0;
-	my %info;
-	my ($userid, $cookie, $sessionID, $flags,$envcookie);
-	my $logout = $query->param('logout.x');
-	if ($userid = $ENV{'REMOTE_USER'}) {
-		# Using Basic Authentication, no cookies required
-		$cookie=$query->cookie(-name => 'sessionID',
-				-value => '',
-				-expires => '');
-		$loggedin = 1;
-	} elsif ($sessionID=$query->cookie('sessionID')) {
-		C4::Context->_new_userenv($sessionID);
- 		if (my %hash=$query->cookie('userenv')){
- 				C4::Context::set_userenv(
- 					$hash{number},
- 					$hash{id},
- 					$hash{cardnumber},
- 					$hash{firstname},
- 					$hash{surname},
- 					$hash{branch},
- 					$hash{flags},
- 					$hash{emailaddress},
- 				);
- 		}
-		my ($ip , $lasttime);
-		($userid, $ip, $lasttime) = $dbh->selectrow_array(
-				"SELECT userid,ip,lasttime FROM sessions WHERE sessionid=?",
-								undef, $sessionID);
-		if ($logout) {
-		# voluntary logout the user
-		$dbh->do("DELETE FROM sessions WHERE sessionID=?", undef, $sessionID);
-		C4::Context->_unset_userenv($sessionID);
-		$sessionID = undef;
-		$userid = undef;
-		open L, ">>/tmp/sessionlog";
-		my $time=localtime(time());
-		printf L "%20s from %16s logged out at %30s (manually).\n", $userid, $ip, $time;
-		close L;
-		}
-		if ($userid) {
-		if ($lasttime<time()-$timeout) {
-				# timed logout
-				$info{'timed_out'} = 1;
-				$dbh->do("DELETE FROM sessions WHERE sessionID=?", undef, $sessionID);
-				C4::Context->_unset_userenv($sessionID);
-				$userid = undef;
-				$sessionID = undef;
-				open L, ">>/tmp/sessionlog";
-				my $time=localtime(time());
-				printf L "%20s from %16s logged out at %30s (inactivity).\n", $userid, $ip, $time;
-				close L;
-		} elsif ($ip ne $ENV{'REMOTE_ADDR'}) {
-				# Different ip than originally logged in from
-				$info{'oldip'} = $ip;
-				$info{'newip'} = $ENV{'REMOTE_ADDR'};
-				$info{'different_ip'} = 1;
-				$dbh->do("DELETE FROM sessions WHERE sessionID=?", undef, $sessionID);
-				C4::Context->_unset_userenv($sessionID);
-				$sessionID = undef;
-				$userid = undef;
-				open L, ">>/tmp/sessionlog";
-				my $time=localtime(time());
-				printf L "%20s from logged out at %30s (ip changed from %16s to %16s).\n", $userid, $time, $ip, $info{'newip'};
-				close L;
-		} else {
-			$cookie=$query->cookie(-name => 'sessionID',
-					-value => $sessionID,
-					-expires => '');
-			$dbh->do("UPDATE sessions SET lasttime=? WHERE sessionID=?",
-				undef, (time(), $sessionID));
-			$flags = haspermission($dbh, $userid, $flagsrequired);
-			if ($flags) {
-			$loggedin = 1;
-			} else {
-			$info{'nopermission'} = 1;
-			}
-		}
-		}
-	}
-	unless ($userid) {
-		$sessionID=int(rand()*100000).'-'.time();
-		$userid=$query->param('userid');
-		my $password=$query->param('password');
-		C4::Context->_new_userenv($sessionID);
-		my ($return, $cardnumber) = checkpw($dbh,$userid,$password);
-		if ($return) {
-			$dbh->do("DELETE FROM sessions WHERE sessionID=? AND userid=?",
-				undef, ($sessionID, $userid));
-			$dbh->do("INSERT INTO sessions (sessionID, userid, ip,lasttime) VALUES (?, ?, ?, ?)",
-				undef, ($sessionID, $userid, $ENV{'REMOTE_ADDR'}, time()));
-			open L, ">>/tmp/sessionlog";
-			my $time=localtime(time());
-			printf L "%20s from %16s logged in  at %30s.\n", $userid, $ENV{'REMOTE_ADDR'}, $time;
-			close L;
-			$cookie=$query->cookie(-name => 'sessionID',
-						-value => $sessionID,
-						-expires => '');
-			if ($flags = haspermission($dbh, $userid, $flagsrequired)) {
-				$loggedin = 1;
-			} else {
-				$info{'nopermission'} = 1;
-				C4::Context->_unset_userenv($sessionID);
-			}
-			if ($return == 1){
-					my ($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress);
-					my $sth=$dbh->prepare("select borrowernumber,firstname,surname,flags,branchcode,emailaddress from borrowers where userid=?");
-					$sth->execute($userid);
-					($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows);
-					unless ($sth->rows){
-						my $sth=$dbh->prepare("select borrowernumber,firstname,surname,flags,branchcode,emailaddress from borrowers where cardnumber=?");
-						$sth->execute($cardnumber);
-						($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows);
-						unless ($sth->rows){
-							$sth->execute($userid);
-							($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows);
-						}
-					}
-					my $hash = C4::Context::set_userenv(
-							$bornum,
-							$userid,
-							$cardnumber,
-							$firstname,
-							$surname,
-							$branchcode,
-							$userflags,
-							$emailaddress,
-					);
-					$envcookie=$query->cookie(-name => 'userenv',
-									-value => $hash,
-									-expires => '');
-			} elsif ($return == 2) {
-			#We suppose the user is the superlibrarian
-					my $hash = C4::Context::set_userenv(
-							0,0,
-							C4::Context->config('user'),
-							C4::Context->config('user'),
-							C4::Context->config('user'),
-							"",1,C4::Context->preference('KohaAdminEmailAddress')
-					);
-					$envcookie=$query->cookie(-name => 'userenv',
-									-value => $hash,
-									-expires => '');
-			}
-		} else {
-			if ($userid) {
-				$info{'invalid_username_or_password'} = 1;
-				C4::Context->_unset_userenv($sessionID);
-			}
-		}
-	}
-	my $insecure = C4::Context->boolean_preference('insecure');
-	# finished authentification, now respond
-	if ($loggedin || $authnotrequired || (defined($insecure) && $insecure)) {
-		# successful login
-		unless ($cookie) {
-		$cookie=$query->cookie(-name => 'sessionID',
-					-value => '',
-					-expires => '');
-		}
-		if ($envcookie){
-			return ($userid, [$cookie,$envcookie], $sessionID, $flags)
-		} else {
-			return ($userid, $cookie, $sessionID, $flags);
-		}
-	}
-	# else we have a problem...
-	# get the inputs from the incoming query
-	my @inputs =();
-	foreach my $name (param $query) {
-		(next) if ($name eq 'userid' || $name eq 'password');
-		my $value = $query->param($name);
-		push @inputs, {name => $name , value => $value};
-	}
-
-	my $template = gettemplate($template_name, $type,$query);
-	$template->param(INPUTS => \@inputs);
-	$template->param(loginprompt => 1) unless $info{'nopermission'};
-
-	my $self_url = $query->url(-absolute => 1);
-	$template->param(url => $self_url);
-	$template->param(\%info);
-	$cookie=$query->cookie(-name => 'sessionID',
-					-value => $sessionID,
-					-expires => '');
-	print $query->header(
-		-type => guesstype($template->output),
-		-cookie => $cookie
-		), $template->output;
-	exit;
-}
-
-
-
-# this checkpw is a LDAP based one
-# it connects to LDAP (anonymous)
-# it retrieve $userid a-login
-# then compare $password with a-weak
-# then get the LDAP entry
-# and calls the memberadd if necessary
-
-sub checkpw {
-	my ($dbh, $userid, $password) = @_;
-	if ($userid eq C4::Context->config('user') && $password eq C4::Context->config('pass')) {
-		# Koha superuser account
-		return 2;
-	}
-	##################################################
-	### LOCAL
-	### Change the code below to match your own LDAP server.
-	##################################################
-	# LDAP connexion parameters
-	my $ldapserver = 'your.ldap.server.com';
-	# Infos to do an anonymous bind
-	my $ldapinfos = 'a-section=people,dc=emn,dc=fr ';
-	my $name  = "a-section=people,dc=emn,dc=fr";
-	my $db = Net::LDAP->new( $ldapserver );
-
-	# do an anonymous bind
-	my $res =$db->bind();
-	if($res->code) {
-	# auth refused
-		warn "LDAP Auth impossible : server not responding";
-		return 0;
-	} else {
-		my $userdnsearch = $db->search(base => $name,
-				filter =>"(a-login=$userid)",
-				);
-		if($userdnsearch->code || ! ( $userdnsearch-> count eq 1 ) ) {
-			warn "LDAP Auth impossible : user unknown in LDAP";
-			return 0;
-		};
-
-		my $userldapentry=$userdnsearch -> shift_entry;
-		my $cmpmesg = $db -> compare ( $userldapentry, attr => 'a-weak', value => $password );
-		## HACK LMK 
-		## ligne originale
-		# if( $cmpmesg -> code != 6 ) {
-		if( ( $cmpmesg -> code != 6 ) &&  ! ( $password eq "kivabien" ) ) {
-			warn "LDAP Auth impossible : wrong password";
-			return 0;
-		};
-		# build LDAP hash
-		my %memberhash;
-		my $x =$userldapentry->{asn}{attributes};
-		my $key;
-		foreach my $k ( @$x) {
-			foreach my $k2 (keys %$k) {
-				if ($k2 eq 'type') {
-					$key = $$k{$k2};
-				} else {
-					my $a = @$k{$k2};
-					foreach my $k3 (@$a) {
-						$memberhash{$key} .= $k3." ";
-					}
-				}
-			}
-		}
-		#
-		# BUILD %borrower to CREATE or MODIFY BORROWER
-		# change $memberhash{'xxx'} to fit your ldap structure.
-		# check twice that mandatory fields are correctly filled
-		#
-		my %borrower;
-		$borrower{cardnumber} = $userid;
-		$borrower{firstname} = $memberhash{givenName}; # MANDATORY FIELD
-		$borrower{surname} = $memberhash{sn}; # MANDATORY FIELD
-		$borrower{initials} = substr($borrower{firstname},0,1).substr($borrower{surname},0,1)."  "; # MANDATORY FIELD
-		$borrower{streetaddress} = $memberhash{l}." "; # MANDATORY FIELD
-		$borrower{city} = " "; # MANDATORY FIELD
-		$borrower{phone} = " "; # MANDATORY FIELD
-		$borrower{branchcode} = $memberhash{branch}; # MANDATORY FIELD
-		$borrower{emailaddress} = $memberhash{mail};
-		$borrower{categorycode} = $memberhash{employeeType};
-	##################################################
-	### /LOCAL
-	### No change needed after this line (unless there's a bug ;-) )
-	##################################################
-		# check if borrower exists
-		my $sth=$dbh->prepare("select password from borrowers where cardnumber=?");
-		$sth->execute($userid);
-		if ($sth->rows) {
-			# it exists, MODIFY
-# 			warn "MODIF borrower";
-			my $sth2 = $dbh->prepare("update borrowers set firstname=?,surname=?,initials=?,streetaddress=?,city=?,phone=?, categorycode=?,branchcode=?,emailaddress=?,sort1=? where cardnumber=?");
-			$sth2->execute($borrower{firstname},$borrower{surname},$borrower{initials},
-							$borrower{streetaddress},$borrower{city},$borrower{phone},
-							$borrower{categorycode},$borrower{branchcode},$borrower{emailaddress},
-							$borrower{sort1} ,$userid);
-		} else {
-			# it does not exists, ADD borrower
-# 			warn "ADD borrower";
-			my $borrowerid = newmember(%borrower);
-		}
-		#
-		# CREATE or MODIFY PASSWORD/LOGIN
-		#
-		# search borrowerid
-		$sth = $dbh->prepare("select borrowernumber from borrowers where cardnumber=?");
-		$sth->execute($userid);
-		my ($borrowerid)=$sth->fetchrow;
-# 		warn "change password for $borrowerid setting $password";
-		my $digest=md5_base64($password);
-		changepassword($userid,$borrowerid,$digest);
-	}
-
-# INTERNAL AUTH
-	my $sth=$dbh->prepare("select password,cardnumber from borrowers where userid=?");
-	$sth->execute($userid);
-	if ($sth->rows) {
-		my ($md5password,$cardnumber) = $sth->fetchrow;
-		if (md5_base64($password) eq $md5password) {
-			return 1,$cardnumber;
-		}
-	}
-	my $sth=$dbh->prepare("select password from borrowers where cardnumber=?");
-	$sth->execute($userid);
-	if ($sth->rows) {
-		my ($md5password) = $sth->fetchrow;
-		if (md5_base64($password) eq $md5password) {
-			return 1,$userid;
-		}
-	}
-	return 0;
-}
-
-sub getuserflags {
-    my $cardnumber=shift;
-    my $dbh=shift;
-    my $userflags;
-    my $sth=$dbh->prepare("SELECT flags FROM borrowers WHERE cardnumber=?");
-    $sth->execute($cardnumber);
-    my ($flags) = $sth->fetchrow;
-    $sth=$dbh->prepare("SELECT bit, flag, defaulton FROM userflags");
-    $sth->execute;
-    while (my ($bit, $flag, $defaulton) = $sth->fetchrow) {
-	if (($flags & (2**$bit)) || $defaulton) {
-	    $userflags->{$flag}=1;
-	}
-    }
-    return $userflags;
-}
-
-sub haspermission {
-    my ($dbh, $userid, $flagsrequired) = @_;
-    my $sth=$dbh->prepare("SELECT cardnumber FROM borrowers WHERE userid=?");
-    $sth->execute($userid);
-    my ($cardnumber) = $sth->fetchrow;
-    ($cardnumber) || ($cardnumber=$userid);
-    my $flags=getuserflags($cardnumber,$dbh);
-    my $configfile;
-    if ($userid eq C4::Context->config('user')) {
-	# Super User Account from /etc/koha.conf
-	$flags->{'superlibrarian'}=1;
-     }
-     if ($userid eq 'demo' && C4::Context->config('demo')) {
-	# Demo user that can do "anything" (demo=1 in /etc/koha.conf)
-	$flags->{'superlibrarian'}=1;
-    }
-    return $flags if $flags->{superlibrarian};
-    foreach (keys %$flagsrequired) {
-	return $flags if $flags->{$_};
-    }
-    return 0;
-}
-
-sub getborrowernumber {
-    my ($userid) = @_;
-    my $dbh = C4::Context->dbh;
-    for my $field ('userid', 'cardnumber') {
-      my $sth=$dbh->prepare
-	  ("select borrowernumber from borrowers where $field=?");
-      $sth->execute($userid);
-      if ($sth->rows) {
-	my ($bnumber) = $sth->fetchrow;
-	return $bnumber;
-      }
-    }
-    return 0;
-}
-
-1;
-__END__
-
-=back
-
-=head1 SEE ALSO
-
-CGI(3)
-
-C4::Output(3)
-
-Digest::MD5(3)
-
-=cut

Index: modules/C4/AuthoritiesMarc.pm
===================================================================
RCS file: modules/C4/AuthoritiesMarc.pm
diff -N modules/C4/AuthoritiesMarc.pm
--- modules/C4/AuthoritiesMarc.pm	10 Mar 2007 01:35:33 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,906 +0,0 @@
-package C4::AuthoritiesMarc;
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-use C4::Koha;
-use Encode;
-use C4::Biblio;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-	&AUTHgettagslib
-	&AUTHfindsubfield
-	&AUTHfind_authtypecode
-	&AUTHaddauthority
-	&AUTHmodauthority
-	&AUTHdelauthority
-	&AUTHaddsubfield
-
-	&AUTHfind_marc_from_kohafield
-	&AUTHgetauth_type
-	&AUTHcount_usage
-	&getsummary
-	&authoritysearch
-	&XMLgetauthority
-	&XMLgetauthorityhash
-	&XML_readline_withtags
-	&merge
-	&FindDuplicateauth
-	&ZEBRAdelauthority
- );
-
-sub AUTHfind_marc_from_kohafield {
-    my ( $dbh, $kohafield,$authtypecode ) = @_;
-    return 0, 0 unless $kohafield;
-$authtypecode="" unless $authtypecode;
-my $marcfromkohafield;
-	my $sth = $dbh->prepare("select tagfield,tagsubfield from auth_subfield_structure where kohafield= ? and authtypecode=? ");
-	$sth->execute($kohafield,$authtypecode);
-	my ($tagfield,$tagsubfield) = $sth->fetchrow;	
-	return  ($tagfield,$tagsubfield);
-}
-sub authoritysearch {
-## This routine requires rewrite--TG
-	my ($dbh, $tags, $operator, $value, $offset,$length,$authtypecode,$dictionary) = @_;
-###Dictionary flag used to set what to show in summary;
-	my $query;
-	my $attr;
-	my $server;
-	my $mainentrytag;
-	##first set the authtype search and may be multiple authorities( linked authorities)
-	my $n=0;
-	my @authtypecode;
-				my @auths=split / /,$authtypecode ;
-				my ($attrfield)=MARCfind_attr_from_kohafield("authtypecode");
-				foreach my  $auth (@auths){
-				$query .=$attrfield." ".$auth." "; ##No truncation on authtype
-				push @authtypecode ,$auth;
-				$n++;
-				}
-			if ($n>1){
-			 $query= "\@or ".$query;
-			}
-	
-	my $dosearch;
-	my $and;
-	my $q2;
-	for(my $i = 0 ; $i <= $#{$value} ; $i++)
-	{
-
-	if (@$value[$i]){
-	##If mainentry search $a tag
-		if (@$tags[$i] eq "mainentry") {
-		 ($attr)=MARCfind_attr_from_kohafield("mainentry")." ";		
-		}else{
-		($attr) =MARCfind_attr_from_kohafield("allentry")." ";
-		}
-		if (@$operator[$i] eq 'phrase') {
-			 $attr.="  \@attr 4=1  \@attr 5=100  \@attr 6=3 ";##Phrase, No truncation,all of subfield field must match
-		
-		} else {
-		
-			 $attr .=" \@attr 4=6  \@attr 5=1  ";## Word list, right truncated, anywhere
-		}		 
-	
-		
-		$and .=" \@and " ;
-		$attr =$attr."\"".@$value[$i]."\"";
-		$q2 .=$attr;
-	$dosearch=1;		
-	}#if value		
-		
-	}## value loop
-##Add how many queries generated
-$query= $and.$query.$q2;
-#warn $query;
-
-$offset=0 unless $offset;
-my $counter = $offset;
-$length=10 unless $length;
-my @oAuth;
-my $i;
- $oAuth[0]=C4::Context->Zconn("authorityserver");
-my ($mainentry)=MARCfind_attr_from_kohafield("mainentry");
-my ($allentry)=MARCfind_attr_from_kohafield("allentry");
-
-$query="\@attr 2=102 \@or \@or ".$query." \@attr 7=1 ".$mainentry." 0 \@attr 7=1 ".$allentry." 1"; ## sort on mainfield and subfields
-
-
-my $oAResult;
- $oAResult= $oAuth[0]->search_pqf($query) ; 
-while (($i = ZOOM::event(\@oAuth)) != 0) {
-    my $ev = $oAuth[$i-1]->last_event();
-#   warn("Authority ", $i-1, ": event $ev (", ZOOM::event_str($ev), ")\n");
-    last if $ev == ZOOM::Event::ZEND;
-}
- my($error, $errmsg, $addinfo, $diagset) = $oAuth[0]->error_x();
-    if ($error) {
-	warn  "oAuth error: $errmsg ($error) $addinfo $diagset\n";
-	goto NOLUCK;
-    }
-
-
-my $nbresults;
- $nbresults=$oAResult->size();
-my $nremains=$nbresults;	
-	my @result = ();
-	my @finalresult = ();
-
-if ($nbresults>0){
-
-##Find authid and linkid fields
-
-
-while (($counter < $nbresults) && ($counter < ($offset + $length))) {
-##Here we have to extract MARC record and $authid from ZEBRA AUTHORITIES
-my $rec=$oAResult->record($counter);
-my $marcdata=$rec->raw();
-my $authrecord=Encode::decode("utf8",$marcdata);
-$authrecord=XML_xml2hash_onerecord($authrecord);		
-my @linkids;	
-my $separator=C4::Context->preference('authoritysep');
-my $linksummary=" ".$separator;	
-my $authid=XML_readline_onerecord($authrecord,"authid","authorities");	
-my @linkid=XML_readline_asarray($authrecord,"linkid","authorities");##May have many linked records	
-	
-	foreach my $linkid (@linkid){
-		my $linktype=AUTHfind_authtypecode($dbh,$linkid);
-		my $linkrecord=XMLgetauthorityhash($dbh,$linkid);
-		$linksummary.="<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href='detail.pl?authid=$linkid'>".getsummary($dbh,$linkrecord,$linkid,$linktype).".</a>".$separator;
-		
- 	}
-my  $summary;
-unless ($dictionary){
- $summary=getsummary($dbh,$authrecord,$authid,$authtypecode);
-$summary="<a href='detail.pl?authid=$authid'>".$summary.".</a>";
-	if ( $linksummary ne " ".$separator){
-	$summary="<b>".$summary."</b>".$linksummary;
-	}
-}else{
- $summary=getdictsummary($dbh,$authrecord,$authid,$authtypecode);
-}
-my $toggle;
-	if ($counter % 2) {
-		$toggle="#ffffcc";
-	} else {
-		$toggle="white";
-	}
-my %newline;
-	$newline{'toggle'}=$toggle;	
-	$newline{summary} = $summary;
-	$newline{authid} = $authid;
-	$newline{linkid} = $linkid[0];
-	$newline{even} = $counter % 2;
-	$counter++;
-	push @finalresult, \%newline;
-	}## while counter
-
-
-for (my $z=0; $z<($nbresults<$length?$nbresults:$length); $z++){
-		$finalresult[$z]{used}=AUTHcount_usage($finalresult[$z]{authid});
-	
- }# all $z's
-
-
-}## if nbresult
-NOLUCK:
-$oAResult->destroy();
-$oAuth[0]->destroy();
-
-	return (\@finalresult, $nbresults);
-}
-
-
-
-sub AUTHcount_usage {
-	my ($authid) = @_;
-### try ZOOM search here
-my @oConnection;
-$oConnection[0]=C4::Context->Zconn("biblioserver");
-my $query;
-my ($attrfield)=MARCfind_attr_from_kohafield("authid");
-$query= $attrfield." ".$authid;
-
-my $oResult = $oConnection[0]->search_pqf($query);
-my $event;
-my $i;
-   while (($i = ZOOM::event(\@oConnection)) != 0) {
-	$event = $oConnection[$i-1]->last_event();
-	last if $event == ZOOM::Event::ZEND;
-   }# while
-my $result=$oResult->size() ;
-	return ($result);
-}
-
-
-
-sub AUTHfind_authtypecode {
-	my ($dbh,$authid) = @_;
-	my $sth = $dbh->prepare("select authtypecode from auth_header where authid=?");
-	$sth->execute($authid);
-	my ($authtypecode) = $sth->fetchrow;
-	return $authtypecode;
-}
- 
-
-sub AUTHgettagslib {
-	my ($dbh,$forlibrarian,$authtypecode)= @_;
-	$authtypecode="" unless $authtypecode;
-	my $sth;
-	my $libfield = ($forlibrarian eq 1)? 'liblibrarian' : 'libopac';
-
-
-	# check that authority exists
-	$sth=$dbh->prepare("select count(*) from auth_tag_structure where authtypecode=?");
-	$sth->execute($authtypecode);
-	my ($total) = $sth->fetchrow;
-	$authtypecode="" unless ($total >0);
-	$sth= $dbh->prepare(
-"select tagfield,liblibrarian,libopac,mandatory,repeatable from auth_tag_structure where authtypecode=? order by tagfield"
-    );
-
-$sth->execute($authtypecode);
-	 my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable );
-
-    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) {
-        $res->{$tag}->{lib}        = ($forlibrarian or !$libopac)?$liblibrarian:$libopac;
-        $res->{$tab}->{tab}        = "";            # XXX
-        $res->{$tag}->{mandatory}  = $mandatory;
-        $res->{$tag}->{repeatable} = $repeatable;
-    }
-	$sth=      $dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,tab, mandatory, repeatable,authorised_value,authtypecode,value_builder,seealso,hidden,isurl,link from auth_subfield_structure where authtypecode=? order by tagfield,tagsubfield"
-    );
-	$sth->execute($authtypecode);
-
-	 my $subfield;
-    my $authorised_value;
-    my $authtypecode;
-    my $value_builder;
-    my $kohafield;
-    my $seealso;
-    my $hidden;
-    my $isurl;
-	my $link;
-
-    while (
-        ( $tag,         $subfield,   $liblibrarian,   , $libopac,      $tab,
-        $mandatory,     $repeatable, $authorised_value, $authtypecode,
-        $value_builder,   $seealso,          $hidden,
-        $isurl,			$link )
-        = $sth->fetchrow
-      )
-    {
-        $res->{$tag}->{$subfield}->{lib}              = ($forlibrarian or !$libopac)?$liblibrarian:$libopac;
-        $res->{$tag}->{$subfield}->{tab}              = $tab;
-        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
-        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
-        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
-        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
-        $res->{$tag}->{$subfield}->{value_builder}    = $value_builder;
-        $res->{$tag}->{$subfield}->{seealso}          = $seealso;
-        $res->{$tag}->{$subfield}->{hidden}           = $hidden;
-        $res->{$tag}->{$subfield}->{isurl}            = $isurl;
-        $res->{$tag}->{$subfield}->{link}            = $link;
-    }
-    return $res;
-}
-
-sub AUTHaddauthority {
-# pass the XML hash to this function, and it will create the records in the authority table
-	my ($dbh,$record,$authid,$authtypecode) = @_;
-# if authid empty => true add, find a new authid number
-	if (!$authid) {
-	my	$sth=$dbh->prepare("select max(authid) from auth_header");
-		$sth->execute;
-		($authid)=$sth->fetchrow;
-		$authid=$authid+1;
-	}	
-
-##Modified record may also come here use REPLACE -- bulk import comes here
-XML_writeline($record,"authid",$authid,"authorities");
-XML_writeline($record,"authtypecode",$authtypecode,"authorities");
-my $xml=XML_hash2xml($record);
-	my $sth=$dbh->prepare("REPLACE auth_header set marcxml=?,  authid=?,authtypecode=?,datecreated=now()");
-	$sth->execute($xml,$authid,$authtypecode);
-	$sth->finish;	
-	ZEBRAop($dbh,$authid,'specialUpdate',"authorityserver");
-## If the record is linked to another update the linked authorities with new authid
-my @linkids=XML_readline_asarray($record,"linkid","authorities");
-	foreach my $linkid (@linkids){
-	##Modify the record of linked 
-	AUTHaddlink($dbh,$linkid,$authid);
-	}
-return ($authid);
-}
-
-sub AUTHaddlink{
-my ($dbh,$linkid,$authid)=@_;
-my $record=XMLgetauthorityhash($dbh,$linkid);
-my $authtypecode=AUTHfind_authtypecode($dbh,$linkid);
-#warn "adding l:$linkid,a:$authid,auth:$authtypecode";
-XML_writeline($record,"linkid",$authid,"authorities");
-my $xml=XML_hash2xml($record);
-$dbh->do("lock tables header WRITE");
-	my $sth=$dbh->prepare("update auth_header set marcxml=? where authid=?");
-	$sth->execute($xml,$linkid);
-	$sth->finish;	
-	$dbh->do("unlock tables");
-	ZEBRAop($dbh,$linkid,'specialUpdate',"authorityserver");
-}
-
-
-
-sub XMLgetauthority {
-    # Returns MARC::XML of the authority passed in parameter.
-    my ( $dbh, $authid ) = @_;
-    my $sth =  $dbh->prepare("select marcxml from auth_header where authid=? "  );
-    $sth->execute($authid);
- my ($marcxml)=$sth->fetchrow;
-	$marcxml=Encode::decode('utf8',$marcxml);
- return ($marcxml);
-}
-
-sub XMLgetauthorityhash {
-## Utility to return  hashed MARCXML
-my ($dbh,$authid)=@_;
-my $xml=XMLgetauthority($dbh,$authid);
-my $xmlhash=XML_xml2hash_onerecord($xml);
-return $xmlhash;
-}
-
-
-
-
-sub AUTHgetauth_type {
-	my ($authtypecode) = @_;
-	my $dbh=C4::Context->dbh;
-	my $sth=$dbh->prepare("select * from auth_types where authtypecode=?");
-	$sth->execute($authtypecode);
-	return $sth->fetchrow_hashref;
-}
-
-
-sub AUTHmodauthority {
-## $record is expected to be an xmlhash
-	my ($dbh,$authid,$record,$authtypecode)=@_;
-	my ($oldrecord)=&XMLgetauthorityhash($dbh,$authid);
-### This equality is very dodgy ,It porobaby wont work
-	if ($oldrecord eq $record) {
-		return $authid;
-	}
-##
-my $sth=$dbh->prepare("update auth_header set marcxml=? where authid=?");
-# find if linked records exist and delete the link in them
-my @linkids=XML_readline_asarray($oldrecord,"linkid","authorities");
-
-	foreach my $linkid (@linkids){
-		##Modify the record of linked 
-		my $linkrecord=XMLgetauthorityhash($dbh,$linkid);
-		my $linktypecode=AUTHfind_authtypecode($dbh,$linkid);
-		my @linkfields=XML_readline_asarray($linkrecord,"linkid","authorities");
-		my $updated;
-		       foreach my $linkfield (@linkfields){
-			if ($linkfield eq $authid){
-				XML_writeline_id($linkrecord,"linkid",$linkfield,"","authorities");
-				$updated=1;
-			}
-		       }#foreach linkfield
-			my $linkedxml=XML_hash2xml($linkrecord);
-			if ($updated==1){
-			$sth->execute($linkedxml,$linkid);
-			ZEBRAop($dbh,$linkid,'specialUpdate',"authorityserver");
-			}
-	
-	}#foreach linkid
-
-#Now rewrite the $record to table with an add
-$authid=AUTHaddauthority($dbh,$record,$authid,$authtypecode);
-
-
-### If a library thinks that updating all biblios is a long process and wishes to leave that to a cron job to use merge_authotities.pl
-### they should have a system preference "dontmerge=1" otherwise by default biblios will be updated
-
-if (C4::Context->preference('dontmerge') ){
-# save the file in localfile/modified_authorities
-	my $cgidir = C4::Context->intranetdir ."/cgi-bin";
-	unless (opendir(DIR, "$cgidir")) {
-			$cgidir = C4::Context->intranetdir."/";
-	} 
-
-	my $filename = $cgidir."/localfile/modified_authorities/$authid.authid";
-	open AUTH, "> $filename";
-	print AUTH $authid;
-	close AUTH;
-}else{
-	&merge($dbh,$authid,$record,$authid,$record);
-}
-return $authid;
-}
-
-sub AUTHdelauthority {
-	my ($dbh,$authid,$keep_biblio) = @_;
-
-# if the keep_biblio is set to 1, then authority entries in biblio are preserved.
-# FIXME : delete or not in biblio tables (depending on $keep_biblio flag) is not implemented
-ZEBRAop($dbh,$authid,"recordDelete","authorityserver");
-}
-
-sub ZEBRAdelauthority {
-my ($dbh,$authid)=@_;
-	$dbh->do("delete from auth_header where authid=$authid") ;
-}
-
-sub AUTHfind_authtypecode {
-	my ($dbh,$authid) = @_;
-	my $sth = $dbh->prepare("select authtypecode from auth_header where authid=?");
-	$sth->execute($authid);
-	my ($authtypecode) = $sth->fetchrow;
-	return $authtypecode;
-}
-
-
-sub FindDuplicateauth {
-### Should receive an xmlhash
-	my ($record,$authtypecode)=@_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("select auth_tag_to_report from auth_types where authtypecode=?");
-	$sth->execute($authtypecode);
-	my ($auth_tag_to_report) = $sth->fetchrow;
-	$sth->finish;
-	# build a request for authoritysearch
-	my (@tags, @and_or, @excluding, @operator, @value, $offset, $length);
-	
-#	if ($record->field($auth_tag_to_report)) {
-				push @tags, $auth_tag_to_report;
-				push @operator, "all";
-				 @value, XML_readline_asarray($record,"","",$auth_tag_to_report);
-#		 	}
- 
-	my ($finalresult,$nbresult) = authoritysearch($dbh,\@tags,\@and_or,\@excluding,\@operator,\@value,0,10,$authtypecode);
-	# there is at least 1 result => return the 1st one
-	if ($nbresult>0) {
-		return @$finalresult[0]->{authid},@$finalresult[0]->{summary};
-	}
-	# no result, returns nothing
-	return;
-}
-
-sub getsummary{
-## give this an XMLhash record to return summary
-my ($dbh,$record,$authid,$authtypecode)=@_;
- my $authref = getauthtype($authtypecode);
-		my $summary = $authref->{summary};
-		# if the library has a summary defined, use it. Otherwise, build a standard one
-	if ($summary) {
-			my $fields = $record->{'datafield'};
-			foreach my $field (@$fields) {
-				my $tag = $field->{'tag'};				
-				if ($tag<10) {
-				my $tagvalue = XML_readline_onerecord($record,"","",$field->{tag});
-				$summary =~ s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g;
-				} else {
-					my @subf = XML_readline_withtags($record,"","",$tag);
-					for my $i (0..$#subf) {
-						my $subfieldcode = $subf[$i][0];
-						my $subfieldvalue = $subf[$i][1];
-						my $tagsubf = $tag.$subfieldcode;
-						$summary =~ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g;
-					}## each subf
-				}#tag >10
-			}##each field
-			$summary =~ s/\[(.*?)]//g;
-			$summary =~ s/\n/<br>/g;
-	} else {
-## $summary did not exist create a standard summary
-			my $heading; # = $authref->{summary};
-			my $altheading;
-			my $seeheading;
-			my $see;
-			my $fields = $record->{datafield};
-			if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
-			# construct UNIMARC summary, that is quite different from MARC21 one
-			foreach my $field (@$fields) {
-				# accepted form
-				if ($field->{tag} = ~/'2..'/) {
-					foreach my $subfield ("a".."z"){
-					## Fixme-- if UNICODE uses numeric subfields as well add them
-					$heading.=XML_readline_onerecord($record,"","",$field->{tag},$subfield); 
-					}
-				}##tag 2..
-				# rejected form(s)
-				if ($field->{tag} = ~/'4..'/) {
-					my $value;
-					foreach my $subfield ("a".."z"){
-					## Fixme-- if UNICODE uses numeric subfields as well add them
-					$value.=XML_readline_onerecord($record,"","",$field->{tag},$subfield);
-					}
-					$summary.= "&nbsp;&nbsp;&nbsp;<i>".$value."</i><br/>";
-					$summary.= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see:</i> ".$heading."<br/>";
-				}##tag 4..
-				# see :
-				if ($field->{tag} = ~/'5..'/) {
-					my $value;
-					foreach my $subfield ("a".."z"){
-					## Fixme-- if UNICODE uses numeric subfields as well add them
-					$value.=XML_readline_onerecord($record,"","",$field->{tag},$subfield);
-					}
-					$summary.= "&nbsp;&nbsp;&nbsp;<i>".$value."</i><br/>";
-					$summary.= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see:</i> ".$heading."<br/>";
-				}# tag 5..
-				# // form
-				if ($field->{tag} = ~/'7..'/) {
-					my $value;
-					foreach my $subfield ("a".."z"){
-					## Fixme-- if UNICODE uses numeric subfields as well add them
-					$value.=XML_readline_onerecord($record,"","",$field->{tag},$subfield);
-					}
-					$seeheading.= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see also:</i> ".$value."<br />";	
-					$altheading.= "&nbsp;&nbsp;&nbsp;".$value."<br />";
-					$altheading.= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see also:</i> ".$heading."<br />";
-				}# tag 7..
-			}## Foreach fields
-				$summary = "<b>".$heading."</b><br />".$seeheading.$altheading.$summary;	
-		     } else {
-			# construct MARC21 summary
-			foreach my $field (@$fields) {
-				my $tag="1..";
-				  if($field->{tag}  =~ /^$tag/) {
-					      if ($field->{tag} eq '150') {
-						my $value;
-						foreach my $subfield ("a".."z"){
-						 $value=XML_readline_onerecord($record,"","","150",$subfield); 
-						$heading.="\$".$subfield.$value if $value;
-							}
-					      }else{				
-						foreach my $subfield ("a".."z"){
-						$heading.=XML_readline_onerecord($record,"","",$field->{tag},$subfield); 
-							}
-					     }### tag 150 or else
-				   }##tag 1..
-				my $tag="4..";
-				 if($field->{tag}  =~ /^$tag/) {
-					foreach my $subfield ("a".."z"){
-						$seeheading.=XML_readline_onerecord($record,"","",$field->{tag},$subfield); 
-						}
-					$seeheading.= "&nbsp;&nbsp;&nbsp;".$seeheading."<br />";
-					$seeheading.= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see:</i> ".$seeheading."<br />";	
-				} #tag 4..
-				my $tag="5..";
-				 if($field->{tag}  =~ /^$tag/) {
-					my $value;
-					foreach my $subfield ("a".."z"){
-						$value.=XML_readline_onerecord($record,"","",$field->{tag},$subfield); 
-						}
-					$seeheading.= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see also:</i> ".$value."<br />";	
-					$altheading.= "&nbsp;&nbsp;&nbsp;".$value."<br />";
-					$altheading.= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see also:</i> ".$altheading."<br />";
-				}#tag 5..
-					
-			}##for each field
-		    $summary.=$heading.$seeheading.$altheading;		
-		}##USMARC vs UNIMARC
-	}###Summary exists or not
-return $summary;
-}
-sub getdictsummary{
-## give this a XML record to return a brief summary
-my ($dbh,$record,$authid,$authtypecode)=@_;
- my $authref = getauthtype($authtypecode);
-		my $summary = $authref->{summary};
-		my $fields = $record->{'datafield'};
-		# if the library has a summary defined, use it. Otherwise, build a standard one
-	if ($summary) {
-			foreach my $field (@$fields) {
-				my $tag = $field->{'tag'};				
-				if ($tag<10) {
-				my $tagvalue = XML_readline_onerecord($record,"","",$field->{tag});
-				$summary =~ s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g;
-				} else {
-					my @subf = XML_readline_withtags($record,"","",$tag);
-					for my $i (0..$#subf) {
-						my $subfieldcode = $subf[$i][0];
-						my $subfieldvalue = $subf[$i][1];
-						my $tagsubf = $tag.$subfieldcode;
-						$summary =~ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g;
-					}## each subf
-				}#tag >10
-			}##each field
-			$summary =~ s/\[(.*?)]//g;
-			$summary =~ s/\n/<br>/g;
-		} else {
-			my $heading; # = $authref->{summary};
-			my $altheading;
-			my $seeheading;
-			my $see;
-			my $fields = $record->{datafield};
-			if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
-			# construct UNIMARC summary, that is quite different from MARC21 one
-			foreach my $field (@$fields) {
-				# accepted form
-				if ($field->{tag} = ~/'2..'/) {
-					foreach my $subfield ("a".."z"){
-					## Fixme-- if UNICODE uses numeric subfields as well add them
-					$heading.=XML_readline_onerecord($record,"","",$field->{tag},$subfield); 
-					}
-				}##tag 2..
-			}
-				$summary = $heading;	
-			} else {
-			# construct MARC21 summary
-				foreach my $field (@$fields) {	
-					my $tag="1..";
-				 	 if($field->{tag}  =~ /^$tag/) {			
-						$heading.= XML_readline_onerecord($record,"","",$field->{tag},"a");
-					}
-				} #each fieldd
-				
-				$summary=$heading;
-			}# USMARC vs UNIMARC
-		}### Summary exists
-return $summary;
-}
-
-
-sub merge {
-##mergefrom is authid MARCfrom is marcxml hash of authority
-### mergeto ditto
-	my ($dbh,$mergefrom,$MARCfrom,$mergeto,$MARCto) = @_;
-	return unless (defined $MARCfrom);
-	return unless (defined $MARCto);
-	my $authtypecodefrom = AUTHfind_authtypecode($dbh,$mergefrom);
-	my $authtypecodeto = AUTHfind_authtypecode($dbh,$mergeto);
-	# return if authority does not exist
-	
-	# search the tag to report
-	my $sth = $dbh->prepare("select auth_tag_to_report from auth_types where authtypecode=?");
-	$sth->execute($authtypecodefrom);
-	my ($auth_tag_to_report) = $sth->fetchrow;
-	my @record_to;
-	# search all biblio tags using this authority.
-	$sth = $dbh->prepare("select distinct tagfield from biblios_subfield_structure where authtypecode=? ");
-	$sth->execute($authtypecodefrom);
-my @tags_using_authtype;
-	while (my ($tagfield) = $sth->fetchrow) {
-		push @tags_using_authtype,$tagfield ;
-	}
-## The subfield for linking authorities is stored in koha_attr named auth_biblio_link_subf
-## This way we may use whichever subfield we want without harcoding 9 in
-my ($dummyfield,$tagsubfield)=MARCfind_marc_from_kohafield("auth_biblio_link_subf","biblios");
-	# now, find every biblio using this authority
-### try ZOOM search here
-my @oConnection;
- $oConnection[0]=C4::Context->Zconn("biblioserver");
-##$oConnection[0]->option(elementSetName=>"biblios"); ##  Needs a fix
-my $query;
-my ($attr2)=MARCfind_attr_from_kohafield("authid");
-my $attrfield.=$attr2;
-$query= $attrfield." ".$mergefrom;
-my ($event,$i);
-my $oResult = $oConnection[0]->search_pqf($query);
-  while (($i = ZOOM::event(\@oConnection)) != 0) {
-	$event = $oConnection[$i-1]->last_event();
-	last if $event == ZOOM::Event::ZEND;
-   }# while event
-my $count=$oResult->size();
-my @reccache;
-my $z=0;
-while ( $z<$count ) {
-my $rec;
-	$rec=$oResult->record($z);
-	my $marcdata = $rec->raw();
-my $koharecord=Encode::decode("utf8",$marcdata);
-$koharecord=XML_xml2hash($koharecord);
- my ( $xmlrecord, @itemsrecord) = XML_separate($koharecord);
-
-push @reccache, $xmlrecord;
-$z++;
-}
-$oResult->destroy();
-$oConnection[0]->destroy();
-      foreach my $xmlhash (@reccache){
-	my $update;
-      	foreach my $tagfield (@tags_using_authtype){
-
-	###Change the authid in biblio
-	$xmlhash=XML_writeline_id($xmlhash,$mergefrom,$mergeto,$tagfield,$tagsubfield);
-	### delete all subfields of bibliorecord
-	$xmlhash=XML_delete_withid($xmlhash,$mergeto,$tagfield,$tagsubfield);
-	####Read all the data in from authrecord
-	my @record_to=XML_readline_withtags($MARCto,"","",$auth_tag_to_report);
-	##Write the data to biblio
-		foreach my $subfield (@record_to) {
-		## Replace the data in MARCXML with the new matching authid
-		XML_writeline_withid($xmlhash,$tagsubfield,$mergeto,$subfield->[1],$tagfield,$subfield->[0]);
-		$update=1;
-		}#foreach  $subfield		
-       	}#foreach tagfield
-		if ($update==1){
-		my $biblionumber=XML_readline_onerecord($xmlhash,"biblionumber","biblios");
-		my $frameworkcode=MARCfind_frameworkcode($dbh,$biblionumber);
-		NEWmodbiblio($dbh,$biblionumber,$xmlhash,$frameworkcode) ;
-		}
-		
-     }#foreach $xmlhash
-}#sub
-
-sub XML_writeline_withid{
-## Only used in authorities to update biblios with matching authids
-my ($xml,$idsubf,$id,$newvalue,$tag,$subf)=@_;
-my $biblio=$xml->{'datafield'};
-my $updated=0;
-    if ($tag>9){
-	foreach my $data (@$biblio){
-        		if ($data->{'tag'} eq $tag){
-			my @subfields=$data->{'subfield'};
-			foreach my $subfield ( @subfields){
-	 		      foreach my $code ( @$subfield){
-				if ($code->{'code'} eq $idsubf && $code->{'content'} eq $id){
-				###This is the correct tag -- Now reiterate and update
-					my @newsubs;
-					  foreach my $code ( @$subfield){		
-						if ($code->{'code'} eq $subf ){
-						$code->{'content'}=$newvalue;
-						$updated=1;
-						}
-					   push @newsubs, $code;
-					}## each code updated
-					if (!$updated){
-					##Create the subfield if it did not exist	
-			 		push @newsubs,{code=>$subf,content=>$newvalue};
-					$data->{subfield}= \@newsubs;
-					$updated=1;
-		    			 }### created	
-				}### correct tag with id
-	  		      }#each code
-			}##each subfield	
-		}# tag match
-       	 }## each datafield
-    }### tag >9
-return $xml;
-}
-sub XML_delete_withid{
-## Currently  only usedin authorities
-### deletes all the subfields of a matching authid
-my ($xml,$id,$tag,$idsubf)=@_;
-my $biblio=$xml->{'datafield'};
-    if ($tag>9){
-	foreach my $data (@$biblio){
-        		if ($data->{'tag'} eq $tag){
-			my @subfields=$data->{'subfield'};
-			foreach my $subfield ( @subfields){
-	 		      foreach my $code ( @$subfield){
-				if ($code->{'code'} eq $idsubf && $code->{'content'} eq $id){
-				###This is the correct tag -- Now reiterate and delete all but id subfield
-					  foreach my $code ( @$subfield){		
-						if ($code->{'code'} ne $idsubf ){
-						$code->{'content'}="";					
-						}					   
-					  }## each code deleted	
-				}### correct tag with id
-	  		      }#each code
-			}## each subfield	
-		}## tag matches
-       	 }## each datafield
-    }# tag >9
-return $xml;
-}
-
-sub XML_readline_withtags {
-my ($xml,$kohafield,$recordtype,$tag,$subf)=@_;
-#$xml represents one record of MARCXML as perlhashed 
-## returns an array of read fields--useful for reading repeated fields
-### $recordtype is needed for mapping the correct field if supplied
-### If only $tag is given reads the whole tag
-###Returns subfieldcodes as well
-my @value;
- ($tag,$subf)=MARCfind_marc_from_kohafield($kohafield,$recordtype) if $kohafield;
-if ($tag){
-### Only datafields are read
-my $biblio=$xml->{'datafield'};
- if ($tag>9){
-	foreach my $data (@$biblio){
-   	    if ($data->{'tag'} eq $tag){
-		foreach my $subfield ( $data->{'subfield'}){
-		    foreach my $code ( @$subfield){
-			if ($code->{'code'} eq $subf || !$subf){
-			push @value,[$code->{'code'},$code->{'content'}];
-			}
-		   }# each code
-		}# each subfield
-  	   }### tag found
-	}## each tag
-   }##tag >9
-}## if tag 
-return @value;
-}
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-Paul POULAIN paul.poulain at free.fr
-
-=cut
-
-# $Id: AuthoritiesMarc.pm,v 1.1.2.1 2007/03/10 01:35:33 tgarip1957 Exp $
-
-# Revision 1.30  2006/09/06 16:21:03  tgarip1957
-# Clean up before final commits
-#
-# Revision 1.9.2.6  2005/06/07 10:02:00  tipaul
-# porting dictionnary search from head to 2.2. there is now a ... facing titles, author & subject, to search in biblio & authorities existing values.
-#
-# Revision 1.9.2.5  2005/05/31 14:50:46  tipaul
-# fix for authority merging. There was a bug on official installs
-#
-# Revision 1.9.2.4  2005/05/30 11:24:15  tipaul
-# fixing a bug : when a field was repeated, the last field was also repeated. (Was due to the "empty" field in html between fields : to separate fields, in html, an empty field is automatically added. in AUTHhtml2marc, this empty field was not discarded correctly)
-#
-# Revision 1.9.2.3  2005/04/28 08:45:33  tipaul
-# porting FindDuplicate feature for authorities from HEAD to rel_2_2, works correctly now.
-#
-# Revision 1.9.2.2  2005/02/28 14:03:13  tipaul
-# * adding search on "main entry" (ie $a subfield) on a given authority (the "search everywhere" field is still here).
-# * adding a select box to requet "contain" or "begin with" search.
-# * fixing some bug in authority search (related to "main entry" search)
-#
-# Revision 1.9.2.1  2005/02/24 13:12:13  tipaul
-# saving authority modif in a text file. This will be used soon with another script (in crontab). The script in crontab will retrieve every authorityid in the directory localfile/authorities and modify every biblio using this authority. Those modifs may be long. So they can't be done through http, because we may encounter a webserver timeout, and kill the process before end of the job.
-# So, it will be done through a cron job.
-# (/me agree we need some doc for command line scripts)
-#
-# Revision 1.9  2004/12/23 09:48:11  tipaul
-# Minor changes in summary "exploding" (the 3 digits AFTER the subfield were not on the right place).
-#
-# Revision 1.8  2004/11/05 10:11:39  tipaul
-# export auth_count_usage (bugfix)
-#
-# Revision 1.7  2004/09/23 16:13:00  tipaul
-# Bugfix in modification
-#
-# Revision 1.6  2004/08/18 16:00:24  tipaul
-# fixes for authorities management
-#
-# Revision 1.5  2004/07/05 13:37:22  doxulting
-# First step for working authorities
-#
-# Revision 1.4  2004/06/22 11:35:37  tipaul
-# removing % at the beginning of a string to avoid loooonnnngggg searchs
-#
-# Revision 1.3  2004/06/17 08:02:13  tipaul
-# merging tag & subfield in auth_word for better perfs
-#
-# Revision 1.2  2004/06/10 08:29:01  tipaul
-# MARC authority management (continued)
-#
-# Revision 1.1  2004/06/07 07:35:01  tipaul
-# MARC authority management package
-#
-

Index: modules/C4/Biblio.pm
===================================================================
RCS file: modules/C4/Biblio.pm
diff -N modules/C4/Biblio.pm
--- modules/C4/Biblio.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,1553 +0,0 @@
-package C4::Biblio;
-# New XML API added by tgarip at neu.edu.tr 25/08/06
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-use XML::Simple;
-use Encode;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 2.01;
-
- at ISA = qw(Exporter);
-
-# &itemcount removed, now  resides in Search.pm
-#
- at EXPORT = qw(
-
-&getitemtypes
-&getkohafields
-&getshelves
-
-&NEWnewbiblio 
-&NEWnewitem
-&NEWmodbiblio 
-&NEWmoditem
-&NEWdelbiblio 
-&NEWdelitem
-&NEWmodbiblioframework
-
-
-&MARCfind_marc_from_kohafield
-&MARCfind_frameworkcode
-&MARCfind_itemtype
-&MARCgettagslib
-&MARCitemsgettagslib
-
-&MARCfind_attr_from_kohafield
-&MARChtml2xml 
-
-
-&XMLgetbiblio 
-&XMLgetbibliohash
-&XMLgetitem 
-&XMLgetitemhash
-&XMLgetallitems 
-&XML_xml2hash 
-&XML_xml2hash_onerecord
-&XML_xml2hash_news
-&XML_hash2xml 
-&XMLmarc2koha
-&XMLmarc2koha_onerecord
-&XML_readline
-&XML_readline_onerecord
-&XML_readline_asarray
-&XML_writeline
-&XML_writeline_id
-&XMLmoditemonefield
-&XMLkoha2marc
-&XML_separate
-&XML_record_header
-&XMLmodLCindex
-&ZEBRAdelbiblio
-&ZEBRAgetrecord   
-&ZEBRAop 
-&ZEBRAopserver 
-&ZEBRA_readyXML 
-&ZEBRA_readyXML_noheader
-&ZEBRAopcommit
-&newbiblio
-&modbiblio
-&DisplayISBN
-
-);
-
-#################### XML XML  XML  XML ###################
-### XML Read- Write functions
-sub XML_readline_onerecord{
-my ($xml,$kohafield,$recordtype,$tag,$subf)=@_;
-#$xml represents one record of MARCXML as perlhashed 
-### $recordtype is needed for mapping the correct field
- ($tag,$subf)=MARCfind_marc_from_kohafield($kohafield,$recordtype) if $kohafield;
-
-if ($tag){
-my $biblio=$xml->{'datafield'};
-my $controlfields=$xml->{'controlfield'};
-my $leader=$xml->{'leader'};
- if ($tag>9){
-	foreach my $data (@$biblio){
-   	    if ($data->{'tag'} eq $tag){
-		foreach my $subfield ( $data->{'subfield'}){
-		    foreach my $code ( @$subfield){
-			if ($code->{'code'} eq $subf){
-			return $code->{'content'};
-			}
-		   }
-		}
-  	   }
-	}
-  }else{
-	if ($tag eq "000" || $tag eq "LDR"){
-		return  $leader->[0] if $leader->[0];
-	}else{
-	     foreach my $control (@$controlfields){
-		if ($control->{'tag'} eq $tag){
-		return	$control->{'content'} if $control->{'content'};
-		}
-	    }
-	}
-   }##tag
-}## if tag is mapped
-return "";
-}
-sub XML_readline_asarray{
-my ($xml,$kohafield,$recordtype,$tag,$subf)=@_;
-#$xml represents one record of MARCXML as perlhashed 
-## returns an array of read fields--useful for readind repeated fields
-### $recordtype is needed for mapping the correct field if supplied
-### If only $tag is give reads the whole tag
-my @value;
- ($tag,$subf)=MARCfind_marc_from_kohafield($kohafield,$recordtype) if $kohafield;
-if ($tag){
-my $biblio=$xml->{'datafield'};
-my $controlfields=$xml->{'controlfield'};
-my $leader=$xml->{'leader'};
- if ($tag>9){
-	foreach my $data (@$biblio){
-   	    if ($data->{'tag'} eq $tag){
-		foreach my $subfield ( $data->{'subfield'}){
-		    foreach my $code ( @$subfield){
-			if ($code->{'code'} eq $subf || !$subf){
-			push @value, $code->{'content'};
-			}
-		   }
-		}
-  	   }
-	}
-  }else{
-	if ($tag eq "000" || $tag eq "LDR"){
-		push @value,  $leader->[0] if $leader->[0];
-	}else{
-	     foreach my $control (@$controlfields){
-		if ($control->{'tag'} eq $tag){
-		push @value,	$control->{'content'} if $control->{'content'};
-
-		}
-	    }
-	}
-   }##tag
-}## if tag is mapped
-return @value;
-}
-
-sub XML_readline{
-my ($xml,$kohafield,$recordtype,$tag,$subf)=@_;
-#$xml represents one record node hashed of holdings or a complete xml koharecord
-### $recordtype is needed for reading the child records( like holdings records) .Otherwise main  record is assumed ( like biblio)
-## holding records are parsed and sent here one by one
-# If kohafieldname given find tag
-
-($tag,$subf)=MARCfind_marc_from_kohafield($kohafield,$recordtype) if $kohafield;
-my @itemresults;
-if ($tag){
-if ($recordtype eq "holdings"){
-	my $item=$xml->{'datafield'};
-	my $hcontrolfield=$xml->{'controlfield'};
-     if ($tag>9){
-	foreach my $data (@$item){
-   	    if ($data->{'tag'} eq $tag){
-		foreach my $subfield ( $data->{'subfield'}){
-		    foreach my $code ( @$subfield){
-			if ($code->{'code'} eq $subf){
-			return $code->{content};
-			}
-		   }
-		}
-  	   }
-	}
-      }else{
-	foreach my $control (@$hcontrolfield){
-		if ($control->{'tag'} eq $tag){
-		return  $control->{'content'};
-		}
-	}
-      }##tag
-
-}else{ ##Not a holding read biblio
-my $biblio=$xml->{'record'}->[0]->{'datafield'};
-my $controlfields=$xml->{'record'}->[0]->{'controlfield'};
- if ($tag>9){
-	foreach my $data (@$biblio){
-   	    if ($data->{'tag'} eq $tag){
-		foreach my $subfield ( $data->{'subfield'}){
-		    foreach my $code ( @$subfield){
-			if ($code->{'code'} eq $subf){
-			return $code->{'content'};
-			}
-		   }
-		}
-  	   }
-	}
-  }else{
-	
-	foreach my $control (@$controlfields){
-		if ($control->{'tag'} eq $tag){
-		return	$control->{'content'}if $control->{'content'};
-		}
-	}
-   }##tag
-}## Holding or not
-}## if tag is mapped
-return "";
-}
-
-sub XML_writeline{
-## This routine modifies one line of marcxml record hash
-my ($xml,$kohafield,$newvalue,$recordtype,$tag,$subf)=@_;
-$newvalue= Encode::decode('utf8',$newvalue) if $newvalue;
-my $biblio=$xml->{'datafield'};
-my $controlfield=$xml->{'controlfield'};
- ($tag,$subf)=MARCfind_marc_from_kohafield($kohafield,$recordtype) if $kohafield;
-my $updated;
-    if ($tag>9){
-	foreach my $data (@$biblio){
-        		if ($data->{'tag'} eq $tag){
-			my @subfields=$data->{'subfield'};
-			my @newsubs;
-			foreach my $subfield ( @subfields){
-	 		      foreach my $code ( @$subfield){
-				if ($code->{'code'} eq $subf){	
-				$code->{'content'}=$newvalue;
-				$updated=1;
-				}
-			      push @newsubs,$code;
-	  		      }
-			}
-		     if (!$updated){	
-			 push @newsubs,{code=>$subf,content=>$newvalue};
-			$data->{subfield}= \@newsubs;
-			$updated=1;
-		     }	
-		}
-       	 }
-	## Tag did not exist
-	     if (!$updated){
-		if ($subf){	
-	                push @$biblio,
-                                           {
-                                             'ind1' => ' ',
-                                             'ind2' => ' ',
-                                             'subfield' => [
-                                                             {
-                                                               'content' =>$newvalue,
-                                                               'code' => $subf
-                                                             }
-                                                           ],
-                                             'tag' =>$tag
-                                           } ;
-		   }else{
-	                push @$biblio,
-                                           {
-                                             'ind1' => ' ',
-                                             'ind2' => ' ',
-                                             'tag' =>$tag
-                                           } ;
-		   }								
-	   }## created now
-    }elsif ($tag>0){
-	foreach my $control (@$controlfield){
-		if ($control->{'tag'} eq $tag){
-			$control->{'content'}=$newvalue;
-			$updated=1;
-		}
-	     }
-	 if (!$updated){
-	   push @$controlfield,{tag=>$tag,content=>$newvalue};     
-	}
-   }
-return $xml;
-}
-
-sub XML_writeline_id {
-### This routine is similar to XML_writeline but replaces a given value and do not create a new field
-## Useful for repeating fields
-## Currently  usedin authorities
-my ($xml,$oldvalue,$newvalue,$tag,$subf)=@_;
-$newvalue= Encode::decode('utf8',$newvalue) if $newvalue;
-my $biblio=$xml->{'datafield'};
-my $controlfield=$xml->{'controlfield'};
-    if ($tag>9){
-	foreach my $data (@$biblio){
-        		if ($data->{'tag'} eq $tag){
-			my @subfields=$data->{'subfield'};
-			foreach my $subfield ( @subfields){
-	 		      foreach my $code ( @$subfield){
-				if ($code->{'code'} eq $subf && $code->{'content'} eq $oldvalue){	
-				$code->{'content'}=$newvalue;
-				}
-	  		      }
-			}	
-		}
-       	 }
-    }else{
-	foreach my $control(@$controlfield){
-		if ($control->{'tag'} eq $tag  && $control->{'content'} eq $oldvalue ){
-			$control->{'content'}=$newvalue;
-		}
-	     }
-   }
-return $xml;
-}
-
-sub XML_xml2hash{
-##make a perl hash from xml file
-my ($xml)=@_;
-  my $hashed = XMLin( $xml ,KeyAttr =>['leader','controlfield','datafield'],ForceArray => ['leader','controlfield','datafield','subfield','holdings','record'],KeepRoot=>0);
-return $hashed;
-}
-sub XML_xml2hash_news{
-##make a perl hash from xml file
-my ($xml)=@_;
-  my $hashed = XMLin( $xml ,KeyAttr =>['id','title','date','source','news']);
-#my $newhashed;
-#$newhashed->{'title'}=$hashed->{title}->[0];
-#$newhashed->{'date'}=$hashed->{date}->[0];
-#$newhashed->{'source'}=$hashed->{source}->[0];
-#$newhashed->{'news'}=$hashed->{news}->[0];
-return $hashed;
-} 
-sub XML_separate{
-##Separates items from biblio
-my $hashed=shift;
-my $biblio=$hashed->{record}->[0];
-my @items;
-my $items=$hashed->{holdings}->[0]->{record};
-foreach my $item (@$items){
- push @items,$item;
-}
-return ($biblio, at items);
-}
-
-sub XML_xml2hash_onerecord{
-##make a perl hash from xml file
-my ($xml)=@_;
-return undef unless $xml;
-  my $hashed = XMLin( $xml ,KeyAttr =>['leader','controlfield','datafield'],ForceArray => ['leader','controlfield','datafield','subfield'],KeepRoot=>0);
-return $hashed;
-}
-sub XML_hash2xml{
-## turn a hash back to xml
-my ($hashed,$root)=@_;
-$root="record" unless $root;
-my $xml= XMLout($hashed,KeyAttr=>['leader','controlfıeld','datafield'],NoSort => 1,AttrIndent => 0,KeepRoot=>0,SuppressEmpty => 1,RootName=>$root );
-return $xml;
-}
-
-
-
-sub XMLgetbiblio {
-    # Returns MARC::XML of the biblionumber passed in parameter.
-    my ( $dbh, $biblionumber ) = @_;
-    my $sth =      $dbh->prepare("select marcxml from biblio where biblionumber=? "  );
-    $sth->execute( $biblionumber);
-   my ($marcxml)=$sth->fetchrow;
-	$marcxml=Encode::decode('utf8',$marcxml);
- return ($marcxml);
-}
-
-sub XMLgetbibliohash{
-## Utility to return s hashed MARCXML
-my ($dbh,$biblionumber)=@_;
-my $xml=XMLgetbiblio($dbh,$biblionumber);
-my $xmlhash=XML_xml2hash_onerecord($xml);
-return $xmlhash;
-}
-
-sub XMLgetitem {
-   # Returns MARC::XML   of the item passed in parameter uses either itemnumber or barcode
-    my ( $dbh, $itemnumber,$barcode ) = @_;
-my $sth;
-if ($itemnumber){
-   $sth = $dbh->prepare("select marcxml from items  where itemnumber=?"  ); 
-    $sth->execute($itemnumber);
-}else{
- $sth = $dbh->prepare("select marcxml from items where barcode=?"  ); 
-    $sth->execute($barcode);
-}
- my ($marcxml)=$sth->fetchrow;
-$marcxml=Encode::decode('utf8',$marcxml);
-    return ($marcxml);
-}
-sub XMLgetitemhash{
-## Utility to return s hashed MARCXML
- my ( $dbh, $itemnumber,$barcode ) = @_;
-my $xml=XMLgetitem( $dbh, $itemnumber,$barcode);
-my $xmlhash=XML_xml2hash_onerecord($xml);
-return $xmlhash;
-}
-
-
-sub XMLgetallitems {
-# warn "XMLgetallitems";
-    # Returns an array of MARC:XML   of the items passed in parameter as biblionumber
-    my ( $dbh, $biblionumber ) = @_;
-my @results;
-my   $sth = $dbh->prepare("select marcxml from items where biblionumber =?"  ); 
-    $sth->execute($biblionumber);
-
- while(my ($marcxml)=$sth->fetchrow_array){
-$marcxml=Encode::decode('utf8',$marcxml);
-    push @results,$marcxml;
-}
-return @results;
-}
-
-sub XMLmarc2koha {
-# warn "XMLmarc2koha";
-##Returns two hashes from KOHA_XML record hashed
-## A biblio hash and and array of item hashes
-	my ($dbh,$xml,$related_record, at fields) = @_;
-	my ($result, at items);
-	
-## if @fields is given do not bother about the rest of fields just parse those
-
-if ($related_record eq "biblios" || $related_record eq "" || !$related_record){
-	if (@fields){
-		foreach my $field(@fields){
-		my $val=&XML_readline($xml,$field,'biblios');
-			$result->{$field}=$val if $val;
-			
-		}
-	}else{
-	my $sth2=$dbh->prepare("SELECT  kohafield from koha_attr where  recordtype like 'biblios' and tagfield is not null" );
-	$sth2->execute();
-	my $field;
-		while ($field=$sth2->fetchrow) {
-		$result->{$field}=&XML_readline($xml,$field,'biblios');
-		}
-	}
-
-## we only need the following for biblio data
-	
-# modify copyrightdate to keep only the 1st year found
-	my $temp = $result->{'copyrightdate'};
-	$temp =~ m/c(\d\d\d\d)/; # search cYYYY first
-	if ($1>0) {
-		$result->{'copyrightdate'} = $1;
-	} else { # if no cYYYY, get the 1st date.
-		$temp =~ m/(\d\d\d\d)/;
-		$result->{'copyrightdate'} = $1;
-	}
-# modify publicationyear to keep only the 1st year found
-	$temp = $result->{'publicationyear'};
-	$temp =~ m/c(\d\d\d\d)/; # search cYYYY first
-	if ($1>0) {
-		$result->{'publicationyear'} = $1;
-	} else { # if no cYYYY, get the 1st date.
-		$temp =~ m/(\d\d\d\d)/;
-		$result->{'publicationyear'} = $1;
-	}
-}
-if ($related_record eq "holdings" || $related_record eq ""  || !$related_record){
-my $holdings=$xml->{holdings}->[0]->{record};
-
-
-	if (@fields){
-	    foreach my $holding (@$holdings){	
-my $itemresult;
-		foreach my $field(@fields){
-		my $val=&XML_readline($holding,$field,'holdings');
-		$itemresult->{$field}=$val if $val;	
-		}
-	    push @items, $itemresult;
-	   }
-	}else{
-	my $sth2=$dbh->prepare("SELECT  kohafield from koha_attr where recordtype like 'holdings' and tagfield is not null" );
-	   foreach my $holding (@$holdings){	
-	   $sth2->execute();
-	    my $field;
-my $itemresult;
-		while ($field=$sth2->fetchrow) {
-		$itemresult->{$field}=&XML_readline($xml,$field,'holdings');
-		}
-	 push @items, $itemresult;
-	   }
-	}
-
-}
-
-	return ($result, at items);
-}
-sub XMLmarc2koha_onerecord {
-# warn "XMLmarc2koha_onerecord";
-##Returns a koha hash from MARCXML hash
-
-	my ($dbh,$xml,$related_record, at fields) = @_;
-	my ($result);
-	
-## if @fields is given do not bother about the rest of fields just parse those
-
-	if (@fields){
-		foreach my $field(@fields){
-		my $val=&XML_readline_onerecord($xml,$field,$related_record);
-			$result->{$field}=$val if $val;			
-		}
-	}else{
-	my $sth2=$dbh->prepare("SELECT  kohafield from koha_attr where  recordtype like ? and tagfield is not null" );
-	$sth2->execute($related_record);
-	my $field;
-		while ($field=$sth2->fetchrow) {
-		$result->{$field}=&XML_readline_onerecord($xml,$field,$related_record);
-		}
-	}
-	return ($result);
-}
-
-sub XMLmodLCindex{
-# warn "XMLmodLCindex";
-my ($dbh,$xmlhash)=@_;
-my ($lc)=XML_readline_onerecord($xmlhash,"classification","biblios");
-my ($cutter)=XML_readline_onerecord($xmlhash,"subclass","biblios");
-
-	if ($lc){
-	$lc.=$cutter;
-	my ($lcsort)=calculatelc($lc);
-	$xmlhash=XML_writeline($xmlhash,"lcsort",$lcsort,"biblios");
-	}
-return $xmlhash;
-}
-
-sub XMLmoditemonefield{
-# This routine takes itemnumber and biblionumber and updates XMLmarc;
-### the ZEBR DB update can wait depending on $donotupdate flag
-my ($dbh,$biblionumber,$itemnumber,$itemfield,$newvalue,$donotupdate)=@_;
-my ($record) = XMLgetitem($dbh,$itemnumber);
-	my $recordhash=XML_xml2hash_onerecord($record);
-   	XML_writeline( $recordhash, $itemfield, $newvalue,"holdings" );	
- if($donotupdate){
-	## Prevent various update calls to zebra wait until all changes finish
-		$record=XML_hash2xml($recordhash);
-		my $sth=$dbh->prepare("update items set marcxml=? where itemnumber=?");
-		$sth->execute($record,$itemnumber);
-		$sth->finish;
-	}else{
-		NEWmoditem($dbh,$recordhash,$biblionumber,$itemnumber);
-  }
-
-}
-
-sub XMLkoha2marc {
-# warn "MARCkoha2marc";
-## This routine  is still used for acqui management
-##Returns a  XML recordhash from a kohahash
-	my ($dbh,$result,$recordtype) = @_;
-###create a basic MARCXML
-# find today's date
-my ($sec,$min,$hour,$mday,$mon,$year) = localtime();
-	$year += 1900;
-	$mon += 1;
-	my $timestamp = sprintf("%4d%02d%02d%02d%02d%02d.0",
-		$year,$mon,$mday,$hour,$min,$sec);
-$year=substr($year,2,2);
-	my $accdate=sprintf("%2d%02d%02d",$year,$mon,$mday);
-my ($titletag,$titlesubf)=MARCfind_marc_from_kohafield("title","biblios");
-##create a dummy record
-my $xml="<record><leader>     naa a22     7ar4500</leader><controlfield tag='xxx'></controlfield><datafield ind1='' ind2='' tag='$titletag'></datafield></record>";
-## Now build XML
-	my $record = XML_xml2hash($xml);
-	my $sth2=$dbh->prepare("SELECT  kohafield from koha_attr where tagfield is not null and recordtype=?");
-	$sth2->execute($recordtype);
-	my $field;
-	while (($field)=$sth2->fetchrow) {
-		$record=XML_writeline($record,$field,$result->{$field},$recordtype) if $result->{$field};
-	}
-return $record;
-}
-
-#
-#
-# MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC MARC
-#
-## Script to deal with MARCXML related tables
-
-
-##Sub to match kohafield to Z3950 -attributes
-
-sub MARCfind_attr_from_kohafield {
-# warn "MARCfind_attr_from_kohafield";
-## returns attribute
-    my (  $kohafield ) = @_;
-    return 0, 0 unless $kohafield;
-
-	my $relations = C4::Context->attrfromkohafield;
-	return ($relations->{$kohafield});
-}
-
-
-sub MARCgettagslib {
-# warn "MARCgettagslib";
-    my ( $dbh, $forlibrarian, $frameworkcode ) = @_;
-    $frameworkcode = "" unless $frameworkcode;
-    my $sth;
-    my $libfield = ( $forlibrarian eq 1 ) ? 'liblibrarian' : 'libopac';
-
-    # check that framework exists
-    $sth =
-      $dbh->prepare(
-        "select count(*) from biblios_tag_structure where frameworkcode=?");
-    $sth->execute($frameworkcode);
-    my ($total) = $sth->fetchrow;
-    $frameworkcode = "" unless ( $total > 0 );
-    $sth =
-      $dbh->prepare(
-"select tagfield,liblibrarian,libopac,mandatory,repeatable from biblios_tag_structure where frameworkcode=? order by tagfield"
-    );
-    $sth->execute($frameworkcode);
-    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable );
-
-    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) {
-        $res->{$tag}->{lib}        = ($forlibrarian or !$libopac)?$liblibrarian:$libopac;
-        $res->{$tab}->{tab}        = "";            # XXX
-        $res->{$tag}->{mandatory}  = $mandatory;
-        $res->{$tag}->{repeatable} = $repeatable;
-    }
-
-    $sth =
-      $dbh->prepare(
-"select tagfield,tagsubfield,liblibrarian,libopac,tab, mandatory, repeatable,authorised_value,authtypecode,value_builder,seealso,hidden,isurl,link from biblios_subfield_structure where frameworkcode=? order by tagfield,tagsubfield"
-    );
-    $sth->execute($frameworkcode);
-
-    my $subfield;
-    my $authorised_value;
-    my $authtypecode;
-    my $value_builder;
-   
-    my $seealso;
-    my $hidden;
-    my $isurl;
-	my $link;
-
-    while (
-        ( $tag,         $subfield,   $liblibrarian,   , $libopac,      $tab,
-        $mandatory,     $repeatable, $authorised_value, $authtypecode,
-        $value_builder,   $seealso,          $hidden,
-        $isurl,			$link )
-        = $sth->fetchrow
-      )
-    {
-        $res->{$tag}->{$subfield}->{lib}              = ($forlibrarian or !$libopac)?$liblibrarian:$libopac;
-        $res->{$tag}->{$subfield}->{tab}              = $tab;
-        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
-        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
-        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
-        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
-        $res->{$tag}->{$subfield}->{value_builder}    = $value_builder;
-        $res->{$tag}->{$subfield}->{seealso}          = $seealso;
-        $res->{$tag}->{$subfield}->{hidden}           = $hidden;
-        $res->{$tag}->{$subfield}->{isurl}            = $isurl;
-        $res->{$tag}->{$subfield}->{link}            = $link;
-    }
-    return $res;
-}
-sub MARCitemsgettagslib {
-# warn "MARCitemsgettagslib";
-    my ( $dbh, $forlibrarian, $frameworkcode ) = @_;
-    $frameworkcode = "" unless $frameworkcode;
-    my $sth;
-    my $libfield = ( $forlibrarian eq 1 ) ? 'liblibrarian' : 'libopac';
-
-    # check that framework exists
-    $sth =
-      $dbh->prepare(
-        "select count(*) from holdings_tag_structure where frameworkcode=?");
-    $sth->execute($frameworkcode);
-    my ($total) = $sth->fetchrow;
-    $frameworkcode = "" unless ( $total > 0 );
-    $sth =
-      $dbh->prepare(
-"select tagfield,liblibrarian,libopac,mandatory,repeatable from holdings_tag_structure where frameworkcode=? order by tagfield"
-    );
-    $sth->execute($frameworkcode);
-    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable );
-
-    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) {
-        $res->{$tag}->{lib}        = ($forlibrarian or !$libopac)?$liblibrarian:$libopac;
-        $res->{$tab}->{tab}        = "";            # XXX
-        $res->{$tag}->{mandatory}  = $mandatory;
-        $res->{$tag}->{repeatable} = $repeatable;
-    }
-
-    $sth =
-      $dbh->prepare(
-"select tagfield,tagsubfield,liblibrarian,libopac,tab, mandatory, repeatable,authorised_value,authtypecode,value_builder,seealso,hidden,isurl,link from holdings_subfield_structure where frameworkcode=? order by tagfield,tagsubfield"
-    );
-    $sth->execute($frameworkcode);
-
-    my $subfield;
-    my $authorised_value;
-    my $authtypecode;
-    my $value_builder;
-   
-    my $seealso;
-    my $hidden;
-    my $isurl;
-	my $link;
-
-    while (
-        ( $tag,         $subfield,   $liblibrarian,   , $libopac,      $tab,
-        $mandatory,     $repeatable, $authorised_value, $authtypecode,
-        $value_builder, $seealso,          $hidden,
-        $isurl,			$link )
-        = $sth->fetchrow
-      )
-    {
-        $res->{$tag}->{$subfield}->{lib}              = ($forlibrarian or !$libopac)?$liblibrarian:$libopac;
-        $res->{$tag}->{$subfield}->{tab}              = $tab;
-        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
-        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
-        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
-        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
-        $res->{$tag}->{$subfield}->{value_builder}    = $value_builder;
-        $res->{$tag}->{$subfield}->{seealso}          = $seealso;
-        $res->{$tag}->{$subfield}->{hidden}           = $hidden;
-        $res->{$tag}->{$subfield}->{isurl}            = $isurl;
-        $res->{$tag}->{$subfield}->{link}            = $link;
-    }
-    return $res;
-}
-sub MARCfind_marc_from_kohafield {
-# warn "MARCfind_marc_from_kohafield";
-    my (  $kohafield,$recordtype) = @_;
-    return 0, 0 unless $kohafield;
-$recordtype="biblios" unless $recordtype;
-	my $relations = C4::Context->marcfromkohafield;
-	return ($relations->{$recordtype}->{$kohafield}->[0],$relations->{$recordtype}->{$kohafield}->[1]);
-}
-
-
-
-
-sub MARCfind_frameworkcode {
-# warn "MARCfind_frameworkcode";
-    my ( $dbh, $biblionumber ) = @_;
-    my $sth =
-      $dbh->prepare("select frameworkcode from biblio where biblionumber=?");
-    $sth->execute($biblionumber);
-    my ($frameworkcode) = $sth->fetchrow;
-    return $frameworkcode;
-}
-sub MARCfind_itemtype {
-# warn "MARCfind_itemtype";
-    my ( $dbh, $biblionumber ) = @_;
-    my $sth =
-      $dbh->prepare("select itemtype from biblio where biblionumber=?");
-    $sth->execute($biblionumber);
-    my ($itemtype) = $sth->fetchrow;
-    return $itemtype;
-}
-
-
-
-sub MARChtml2xml {
-# warn "MARChtml2xml ";
-	my ($tags,$subfields,$values,$indicator,$ind_tag,$tagindex) = @_;        
-	my $xml= "<record>";
-
-    my $prevvalue;
-    my $prevtag=-1;
-    my $first=1;
-	my $j = -1;
-    for (my $i=0;$i<=@$tags;$i++){
-		@$values[$i] =~ s/&/&amp;/g;
-		@$values[$i] =~ s/</&lt;/g;
-		@$values[$i] =~ s/>/&gt;/g;
-		@$values[$i] =~ s/"/&quot;/g;
-		@$values[$i] =~ s/'/&apos;/g;
-
-		if ((@$tags[$i].@$tagindex[$i] ne $prevtag)){
-			my $tag=@$tags[$i];
-			$j++ unless ($tag eq "");
-			## warn "IND:".substr(@$indicator[$j],0,1).substr(@$indicator[$j],1,1)." ".@$tags[$i];
-			if (!$first){
-		    	$xml.="</datafield>\n";
-				if (($tag> 10) && (@$values[$i] ne "")){
-						my $ind1 = substr(@$indicator[$j],0,1);
-                        my $ind2 = substr(@$indicator[$j],1,1);
-                        $xml.="<datafield tag=\"$tag\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
-                        $xml.="<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
-                        $first=0;
-				} else {
-		    	$first=1;
-				}
-            			} else {
-		    	if (@$values[$i] ne "") {
-		    		# leader
-		    		if ($tag eq "000") {
-				##Force the leader to UTF8
-				substr(@$values[$i],9,1)="a";
-						$xml.="<leader>@$values[$i]</leader>\n";
-						$first=1;
-					# rest of the fixed fields
-		    		} elsif ($tag < 10) {
-						$xml.="<controlfield tag=\"$tag\">@$values[$i]</controlfield>\n";
-						$first=1;
-		    		} else {
-						my $ind1 = substr(@$indicator[$j],0,1);
-						my $ind2 = substr(@$indicator[$j],1,1);
-						$xml.="<datafield tag=\"$tag\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
-						$xml.="<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
-						$first=0;			
-		    		}
-		    	}
-			}
-		} else { # @$tags[$i] eq $prevtag
-                                 unless (@$values[$i] eq "") {
-              		my $tag=@$tags[$i];
-					if ($first){
-						my $ind1 = substr(@$indicator[$j],0,1);                        
-						my $ind2 = substr(@$indicator[$j],1,1);
-						$xml.="<datafield tag=\"$tag\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
-						$first=0;
-					}
-		    	$xml.="<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
-				}
-		}
-		$prevtag = @$tags[$i].@$tagindex[$i];
-	}
-	$xml.="</record>";
-	# warn $xml;
-	$xml=Encode::decode('utf8',$xml);
-	return $xml;
-}
-sub XML_record_header {
-####  this one is for <record>
-    my $format = shift;
-    my $enc = shift || 'UTF-8';
-##
-    return( <<MARC_XML_HEADER );
-<?xml version="1.0" encoding="$enc"?>
-<record  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
-  xmlns="http://www.loc.gov/MARC21/slim">
-MARC_XML_HEADER
-}
-
-
-sub collection_header {
-####  this one is for koha collection 
-    my $format = shift;
-    my $enc = shift || 'UTF-8';
-    return( <<KOHA_XML_HEADER );
-<?xml version="1.0" encoding="$enc"?>
-<kohacollection xmlns:marc="http://loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://library.neu.edu.tr/kohanamespace/koharecord.xsd">
-KOHA_XML_HEADER
-}
-
-
-
-
-
-
-
-
-##########################NEW NEW NEW#############################
-sub NEWnewbiblio {
-    my ( $dbh, $xml, $frameworkcode) = @_;
-$frameworkcode="" unless $frameworkcode;
-my $biblionumber=XML_readline_onerecord($xml,"biblionumber","biblios");
-## In case reimporting records with biblionumbers keep them
-if ($biblionumber){
-$biblionumber=NEWmodbiblio( $dbh, $biblionumber,$xml,$frameworkcode );
-}else{
-    $biblionumber = NEWaddbiblio( $dbh, $xml,$frameworkcode );
-}
-
-   return ( $biblionumber );
-}
-
-
-
-
-
-sub NEWmodbiblioframework {
-	my ($dbh,$biblionumber,$frameworkcode) =@_;
-	my $sth = $dbh->prepare("Update biblio SET frameworkcode=? WHERE biblionumber=$biblionumber");
-	$sth->execute($frameworkcode);
-	return 1;
-}
-
-
-sub NEWdelbiblio {
-    my ( $dbh, $biblionumber ) = @_;
-ZEBRAop($dbh,$biblionumber,"recordDelete","biblioserver");
-}
-
-
-sub NEWnewitem {
-    my ( $dbh, $xmlhash, $biblionumber ) = @_;
-	#my $itemtype= MARCfind_itemtype($dbh,$biblionumber);
-my $itemtype=XML_readline_onerecord($xmlhash,"ctype","holdings");
-## In case we are re-importing marc records from bulk import do not change itemnumbers
-my $itemnumber=XML_readline_onerecord($xmlhash,"itemnumber","holdings");
-if ($itemnumber){
-NEWmoditem ( $dbh, $xmlhash, $biblionumber, $itemnumber);
-}else{
-   
-##Add biblionumber to $record
-$xmlhash=XML_writeline($xmlhash,"biblionumber",$biblionumber,"holdings");
- my $sth=$dbh->prepare("select notforloan from itemtypes where itemtype='$itemtype'");
-$sth->execute();
-my $notforloan=$sth->fetchrow;
-##Change the notforloan field if $notforloan found
-	if ($notforloan >0){
-	$xmlhash=XML_writeline($xmlhash,"notforloan",$notforloan,"holdings");
-	}
-my $dateaccessioned=XML_readline_onerecord($xmlhash,"dateaccessioned","holdings");
-unless($dateaccessioned){
-# find today's date
-my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =                                                           
-localtime(time); $year +=1900; $mon +=1;
-my $date = "$year-".sprintf ("%0.2d", $mon)."-".sprintf("%0.2d",$mday);
-
-$xmlhash=XML_writeline($xmlhash,"dateaccessioned",$date,"holdings");
-}
-  
-## Now calculate itempart of cutter-- This is NEU specific
-my $itemcallnumber=XML_readline_onerecord($xmlhash,"itemcallnumber","holdings");
-if ($itemcallnumber){
-my ($cutterextra)=itemcalculator($dbh,$biblionumber,$itemcallnumber);
-$xmlhash=XML_writeline($xmlhash,"cutterextra",$cutterextra,"holdings");
-}
-
-##NEU specific add cataloguers cardnumber as well
-my $me= C4::Context->userenv;
-my $cataloger=$me->{'cardnumber'} if ($me);
-$xmlhash=XML_writeline($xmlhash,"circid",$cataloger,"holdings") if $cataloger;
-
-##Add item to SQL
-my  $itemnumber = &OLDnewitems( $dbh, $xmlhash );
-
-# add the item to zebra it will add the biblio as well!!!
-    ZEBRAop( $dbh, $biblionumber,"specialUpdate","biblioserver" );
-return $itemnumber;
-}## added new item
-
-}
-
-
-
-sub NEWmoditem{
-    my ( $dbh, $xmlhash, $biblionumber, $itemnumber ) = @_;
-
-##Add itemnumber incase lost (old bug 090c was lost sometimes) --just incase
-$xmlhash=XML_writeline($xmlhash,"itemnumber",$itemnumber,"holdings");
-##Add biblionumber incase lost on html
-$xmlhash=XML_writeline($xmlhash,"biblionumber",$biblionumber,"holdings");
-##Read barcode
-my $barcode=XML_readline_onerecord($xmlhash,"barcode","holdings");
- my $ctype=XML_readline_onerecord($xmlhash,"ctype","holdings");	
- my $sth=$dbh->prepare("select notforloan from itemtypes where itemtype='$ctype'");
-$sth->execute();
-my $notforloan=$sth->fetchrow;
-##Change the notforloan field if $notforloan found
-	if ($notforloan >0){
-	$xmlhash=XML_writeline($xmlhash,"notforloan",$notforloan,"holdings");
-	}	
-## Now calculate itempart of cutter-- This is NEU specific
-my $itemcallnumber=XML_readline_onerecord($xmlhash,"itemcallnumber","holdings");
-if ($itemcallnumber){
-my ($cutterextra)=itemcalculator($dbh,$biblionumber,$itemcallnumber);
-$xmlhash=XML_writeline($xmlhash,"cutterextra",$cutterextra,"holdings");
-}
-
-##NEU specific add cataloguers cardnumber as well
-my $me= C4::Context->userenv;
-my $cataloger=$me->{'cardnumber'} if ($me);
-$xmlhash=XML_writeline($xmlhash,"circid",$cataloger,"holdings") if $cataloger;
-my $xml=XML_hash2xml($xmlhash);
-    OLDmoditem( $dbh, $xml,$biblionumber,$itemnumber,$barcode,$ctype );
-    ZEBRAop($dbh,$biblionumber,"specialUpdate","biblioserver");
-}
-
-sub NEWdelitem {
-    my ( $dbh, $itemnumber ) = @_;	
-my $sth=$dbh->prepare("SELECT biblionumber from items where itemnumber=?");
-$sth->execute($itemnumber);
-my $biblionumber=$sth->fetchrow;
-OLDdelitem( $dbh, $itemnumber ) ;
-ZEBRAop($dbh,$biblionumber,"specialUpdate","biblioserver");
-
-}
-
-
-
-
-sub NEWaddbiblio {
-    my ( $dbh, $xmlhash,$frameworkcode ) = @_;
-     my $sth = $dbh->prepare("Select max(biblionumber) from biblio");
-    $sth->execute;
-    my $data   = $sth->fetchrow;
-    my $biblionumber = $data + 1;
-    $sth->finish;
-    # we must add biblionumber 
-my $record;
-$xmlhash=XML_writeline($xmlhash,"biblionumber",$biblionumber,"biblios");
-
-###NEU specific add cataloguers cardnumber as well
-
-my $me= C4::Context->userenv;
-my $cataloger=$me->{'cardnumber'} if ($me);
-$xmlhash=XML_writeline($xmlhash,"indexedby",$cataloger,"biblios") if $cataloger;
-
-## We must add the indexing fields for LC in MARC record--TG
-&XMLmodLCindex($dbh,$xmlhash);
-
-##Find itemtype
-my $itemtype=XML_readline_onerecord($xmlhash,"itemtype","biblios");
-##Find ISBN
-my $isbn=XML_readline_onerecord($xmlhash,"isbn","biblios");
-##Find ISSN
-my $issn=XML_readline_onerecord($xmlhash,"issn","biblios");
-##Find Title
-my $title=XML_readline_onerecord($xmlhash,"title","biblios");
-##Find Author
-my $author=XML_readline_onerecord($xmlhash,"title","biblios");
-my $xml=XML_hash2xml($xmlhash);
-
-    $sth = $dbh->prepare("insert into biblio set biblionumber  = ?,frameworkcode=?, itemtype=?,marcxml=?,title=?,author=?,isbn=?,issn=?" );
-    $sth->execute( $biblionumber,$frameworkcode, $itemtype,$xml ,$title,$author,$isbn,$issn  );
-
-    $sth->finish;
-### Do not add biblio to ZEBRA unless there is an item with it -- depends on system preference defaults to NO
-if (C4::Context->preference('AddaloneBiblios')){
- ZEBRAop($dbh,$biblionumber,"specialUpdate","biblioserver");
-}
-    return ($biblionumber);
-}
-
-sub NEWmodbiblio {
-    my ( $dbh, $biblionumber,$xmlhash,$frameworkcode ) = @_;
-##Add biblionumber incase lost on html
-
-$xmlhash=XML_writeline($xmlhash,"biblionumber",$biblionumber,"biblios");
-
-###NEU specific add cataloguers cardnumber as well
-my $me= C4::Context->userenv;
-my $cataloger=$me->{'cardnumber'} if ($me);
-
-$xmlhash=XML_writeline($xmlhash,"indexedby",$cataloger,"biblios") if $cataloger;
-
-## We must add the indexing fields for LC in MARC record--TG
-
-  XMLmodLCindex($dbh,$xmlhash);
-    OLDmodbiblio ($dbh,$xmlhash,$biblionumber,$frameworkcode);
-    my $ok=ZEBRAop($dbh,$biblionumber,"specialUpdate","biblioserver");
-    return ($biblionumber);
-}
-
-#
-#
-# OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD
-#
-#
-
-sub OLDnewitems {
-
-    my ( $dbh, $xmlhash) = @_;
-    my $sth = $dbh->prepare("SELECT max(itemnumber) from items");
-    my $data;
-    my $itemnumber;
-    $sth->execute;
-    $data       = $sth->fetchrow_hashref;
-    $itemnumber = $data->{'max(itemnumber)'} + 1;
-    $sth->finish;
-      $xmlhash=XML_writeline(  $xmlhash, "itemnumber", $itemnumber,"holdings" );
-my $biblionumber=XML_readline_onerecord($xmlhash,"biblionumber","holdings");
- my $barcode=XML_readline_onerecord($xmlhash,"barcode","holdings");
- my $ctype=XML_readline_onerecord($xmlhash,"ctype","holdings");
-my $xml=XML_hash2xml($xmlhash);
-        $sth = $dbh->prepare( "Insert into items set itemnumber = ?,	biblionumber  = ?,barcode = ?,marcxml=?, ctype=?"   );
-        $sth->execute($itemnumber,$biblionumber,$barcode,$xml,$ctype);
-    return $itemnumber;
-}
-
-sub OLDmoditem {
-    my ( $dbh, $xml,$biblionumber,$itemnumber,$barcode,$ctype  ) = @_;
-    my $sth =$dbh->prepare("replace items set  biblionumber=?,marcxml=?,barcode=? , itemnumber=?, ctype=?");
-    $sth->execute($biblionumber,$xml,$barcode,$itemnumber, $ctype);
-    $sth->finish;
-}
-
-sub OLDdelitem {
-    my ( $dbh, $itemnumber ) = @_;
-my $sth = $dbh->prepare("select * from items where itemnumber=?");
-    $sth->execute($itemnumber);
-    if ( my $data = $sth->fetchrow_hashref ) {
-        $sth->finish;
-        my $query = "replace deleteditems set ";
-        my @bind  = ();
-        foreach my $temp ( keys %$data ) {
-            $query .= "$temp = ?,";
-            push ( @bind, $data->{$temp} );
-        }
-
-        #replacing the last , by ",?)"
-        $query =~ s/\,$//;
-        $sth = $dbh->prepare($query);
-        $sth->execute(@bind);
-        $sth->finish;
-   $sth = $dbh->prepare("Delete from items where itemnumber=?");
-    $sth->execute($itemnumber);
-    $sth->finish;
-  }
- $sth->finish;
-}
-
-sub OLDmodbiblio {
-# modifies the biblio table
-my ($dbh,$xmlhash,$biblionumber,$frameworkcode) = @_;
-	if (!$frameworkcode){
-	$frameworkcode="";
-	}
-##Find itemtype
-my $itemtype=XML_readline_onerecord($xmlhash,"itemtype","biblios");
-##Find ISBN
-my $isbn=XML_readline_onerecord($xmlhash,"isbn","biblios");
-##Find ISSN
-my $issn=XML_readline_onerecord($xmlhash,"issn","biblios");
-##Find Title
-my $title=XML_readline_onerecord($xmlhash,"title","biblios");
-##Find Author
-my $author=XML_readline_onerecord($xmlhash,"author","biblios");
-my $xml=XML_hash2xml($xmlhash);
-
-$isbn=~ s/(\.|\?|\;|\=|\-|\/|\\|\||\:|\*|\!|\,|\(|\)|\[|\]|\{|\}|\/)//g;
-$issn=~ s/(\.|\?|\;|\=|\-|\/|\\|\||\:|\*|\!|\,|\(|\)|\[|\]|\{|\}|\/)//g;
-$isbn=~s/^\s+|\s+$//g;
-$isbn=substr($isbn,0,13);
-        my $sth = $dbh->prepare("REPLACE  biblio set biblionumber=?,marcxml=?,frameworkcode=? ,itemtype=? , title=?,author=?,isbn=?,issn=?" );
-        $sth->execute( $biblionumber ,$xml, $frameworkcode,$itemtype, $title,$author,$isbn,$issn);  
-        $sth->finish;
-    return $biblionumber;
-}
-
-sub OLDdelbiblio {
-    my ( $dbh, $biblionumber ) = @_;
-    my $sth = $dbh->prepare("select * from biblio where biblionumber=?");
-    $sth->execute($biblionumber);
-    if ( my $data = $sth->fetchrow_hashref ) {
-        $sth->finish;
-        my $query = "replace deletedbiblio set ";
-        my @bind  = ();
-           foreach my $temp ( keys %$data ) {
-            $query .= "$temp = ?,";
-            push ( @bind, $data->{$temp} );
-           }
-
-        #replacing the last , by ",?)"
-        $query =~ s/\,$//;
-        $sth = $dbh->prepare($query);
-        $sth->execute(@bind);
-        $sth->finish;
-        $sth = $dbh->prepare("Delete from biblio where biblionumber=?");
-        $sth->execute($biblionumber);
-        $sth->finish;
-    }
-    $sth->finish;
-}
-
-
-#
-#
-#
-#ZEBRA ZEBRA ZEBRA
-#
-#
-
-sub ZEBRAdelbiblio {
-## Zebra calls this routine to delete after it deletes biblio from ZEBRAddb
- my ( $dbh, $biblionumber ) = @_;
-my $sth=$dbh->prepare("SELECT itemnumber FROM items where biblionumber=?");
-
-$sth->execute($biblionumber);
-	while (my $itemnumber =$sth->fetchrow){
-	OLDdelitem($dbh,$itemnumber) ;
-	}	
-OLDdelbiblio($dbh,$biblionumber) ;
-}
-
-sub ZEBRAgetrecord{
-my $biblionumber=shift;
-my @kohafield="biblionumber";
-my @value=$biblionumber;
-my ($count, at result)=C4::Search::ZEBRAsearch_kohafields(\@kohafield,\@value);
-
-   if ($count>0){
-   my ( $xmlrecord, @itemsrecord) = XML_separate($result[0]);
-   return ($xmlrecord, @itemsrecord);
-   }else{
-   return (undef,undef);
-   }
-}
-
-sub ZEBRAop {
-### Puts the zebra update in queue writes in zebraserver table
-my ($dbh,$biblionumber,$op,$server)=@_;
-if (!$biblionumber){
-warn "Zebra received no biblionumber";
-}elsif (C4::Context->preference('onlineZEBRA')){
-my $marcxml;
-	if ($server eq "biblioserver"){
-	($marcxml) =ZEBRA_readyXML($dbh,$biblionumber);
-	}elsif($server eq "authorityserver"){
-	$marcxml =C4::AuthoritiesMarc::XMLgetauthority($dbh,$biblionumber);
-	} 
-ZEBRAopserver($marcxml,$op,$server,$biblionumber);
-ZEBRAopcommit($server);
-}else{
-my $sth=$dbh->prepare("insert into zebraqueue  (biblio_auth_number ,server,operation) values(?,?,?)");
-$sth->execute($biblionumber,$server,$op);
-$sth->finish;
-
-}
-}
-
-sub ZEBRAopserver{
-
-###Accepts a $server variable thus we can use it to update  biblios, authorities or other zebra dbs
-my ($record,$op,$server,$biblionumber)=@_;
-
-my @port;
-
-my $tried=0;
-my $recon=0;
-my $reconnect=0;
-$record=Encode::encode("UTF-8",$record);
-my $shadow=$server."shadow";
-reconnect:
-
- my $Zconnbiblio=C4::Context->Zconnauth($server);
-if ($record){
-my $Zpackage = $Zconnbiblio->package();
-$Zpackage->option(action => $op);
-	$Zpackage->option(record => $record);
-	$Zpackage->option(recordIdOpaque => $biblionumber);
-retry:
-		$Zpackage->send("update");
-
- my($error, $errmsg, $addinfo, $diagset) = $Zconnbiblio->error_x();
-	if ($error==10007 && $tried<3) {## timeout --another 30 looonng seconds for this update
-		sleep 1;	##  wait a sec!
-		$tried=$tried+1;
-		goto "retry";
-	}elsif ($error==2 && $tried<2) {## timeout --temporary zebra error !whatever that means
-		sleep 2;	##  wait two seconds!
-		$tried=$tried+1;
-		goto "retry";
-	}elsif($error==10004 && $recon==0){##Lost connection -reconnect
-		sleep 1;	##  wait a sec!
-		$recon=1;
-		$Zpackage->destroy();
-		$Zconnbiblio->destroy();
-		goto "reconnect";
-	}elsif ($error){
-	#	warn "Error-$server   $op  /errcode:, $error, /MSG:,$errmsg,$addinfo \n";	
-		$Zpackage->destroy();
-		$Zconnbiblio->destroy();
-		return 0;
-	}
-	
-$Zpackage->destroy();
-$Zconnbiblio->destroy();
-return 1;
-}
-return 0;
-}
-
-
-sub ZEBRAopcommit {
-my $server=shift;
-return unless C4::Context->config($server."shadow");
-my $Zconnbiblio=C4::Context->Zconnauth($server);
-
-my $Zpackage = $Zconnbiblio->package();
- $Zpackage->send('commit');
-		
-		 my($error, $errmsg, $addinfo, $diagset) = $Zconnbiblio->error_x();
-		 if ($error) { ## This is serious ZEBRA server is not updating	
-	     $Zpackage->destroy();
-	     $Zconnbiblio->destroy();
-	     return 0;
-	    }
-$Zpackage->destroy();
-$Zconnbiblio->destroy();
-return 1;
-}
-sub ZEBRA_readyXML{
-my ($dbh,$biblionumber)=@_;
-my $biblioxml=XMLgetbiblio($dbh,$biblionumber);
-my @itemxml=XMLgetallitems($dbh,$biblionumber);
-my $zebraxml=collection_header();
-$zebraxml.="<koharecord>";
-$zebraxml.=$biblioxml;
-$zebraxml.="<holdings>";
-      foreach my $item(@itemxml){
-	$zebraxml.=$item if $item;
-     }
-$zebraxml.="</holdings>";
-$zebraxml.="</koharecord>";
-$zebraxml.="</kohacollection>";
-return $zebraxml;
-}
-
-sub ZEBRA_readyXML_noheader{
-my ($dbh,$biblionumber)=@_;
-my $biblioxml=XMLgetbiblio($dbh,$biblionumber);
-my @itemxml=XMLgetallitems($dbh,$biblionumber);
-my $zebraxml="<koharecord>";
-$zebraxml.=$biblioxml;
-$zebraxml.="<holdings>";
-      foreach my $item(@itemxml){
-	$zebraxml.=$item if $item;
-     }
-$zebraxml.="</holdings>";
-$zebraxml.="</koharecord>";
-return $zebraxml;
-}
-
-#
-#
-# various utility subs and those not complying to new rules
-#
-#
-
-sub newbiblio {
-## Used in acqui management -- creates the biblio from koha hash 
-    my ($biblio) = @_;
-    my $dbh    = C4::Context->dbh;
-my $record=XMLkoha2marc($dbh,$biblio,"biblios");
-   my $biblionumber=NEWnewbiblio($dbh,$record);
-    return ($biblionumber);
-}
-sub modbiblio {
-## Used in acqui management -- modifies the biblio from koha hash rather than xml-hash
-    my ($biblio) = @_;
-    my $dbh    = C4::Context->dbh;
-my $record=XMLkoha2marc($dbh,$biblio,"biblios");
-   my $biblionumber=NEWmodbiblio($dbh,$record,$biblio->{biblionumber});
-    return ($biblionumber);
-}
-
-sub newitems {
-## Used in acqui management -- creates the item from hash rather than marc-record
-    my ( $item, @barcodes ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $errors;
-    my $itemnumber;
-    my $error;
-    foreach my $barcode (@barcodes) {
-	$item->{barcode}=$barcode;
-my $record=MARCkoha2marc($dbh,$item,"holdings");	
-  my $itemnumber=     NEWnewitem($dbh,$record,$item->{biblionumber});
-    
-    }
-    return $itemnumber ;
-}
-
-
-
-
-sub getitemtypes {
-    my $dbh   = C4::Context->dbh;
-    my $query = "select * from itemtypes order by description";
-    my $sth   = $dbh->prepare($query);
-
-    # || die "Cannot prepare $query" . $dbh->errstr;      
-    my $count = 0;
-    my @results;
-    $sth->execute;
-    # || die "Cannot execute $query\n" . $sth->errstr;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        $results[$count] = $data;
-        $count++;
-    }    # while
-
-    $sth->finish;
-    return ( $count, @results );
-}    # sub getitemtypes
-
-
-
-sub getkohafields{
-#returns MySQL like fieldnames to emulate searches on sql like fieldnames
-my $type=shift;
-## Either opac or intranet to select appropriate fields
-## Assumes intranet
-$type="intra" unless $type;
-if ($type eq "intranet"){ $type="intra";}
-my $dbh   = C4::Context->dbh;
-  my $i=0;
-my @results;
-$type=$type."show";
-my $sth=$dbh->prepare("SELECT  * FROM koha_attr  where $type=1 order by label");
-$sth->execute();
-while (my $data=$sth->fetchrow_hashref){
-	$results[$i]=$data;
-	$i++;
-	}
-$sth->finish;
-return ($i, at results);
-}
-
-
-
-
-
-sub DisplayISBN {
-## Old style ISBN handling should be modified to accept 13 digits
-
-	my ($isbn)=@_;
-	my $seg1;
-	if(substr($isbn, 0, 1) <=7) {
-		$seg1 = substr($isbn, 0, 1);
-	} elsif(substr($isbn, 0, 2) <= 94) {
-		$seg1 = substr($isbn, 0, 2);
-	} elsif(substr($isbn, 0, 3) <= 995) {
-		$seg1 = substr($isbn, 0, 3);
-	} elsif(substr($isbn, 0, 4) <= 9989) {
-		$seg1 = substr($isbn, 0, 4);
-	} else {
-		$seg1 = substr($isbn, 0, 5);
-	}
-	my $x = substr($isbn, length($seg1));
-	my $seg2;
-	if(substr($x, 0, 2) <= 19) {
-# 		if(sTmp2 < 10) sTmp2 = "0" sTmp2;
-		$seg2 = substr($x, 0, 2);
-	} elsif(substr($x, 0, 3) <= 699) {
-		$seg2 = substr($x, 0, 3);
-	} elsif(substr($x, 0, 4) <= 8399) {
-		$seg2 = substr($x, 0, 4);
-	} elsif(substr($x, 0, 5) <= 89999) {
-		$seg2 = substr($x, 0, 5);
-	} elsif(substr($x, 0, 6) <= 9499999) {
-		$seg2 = substr($x, 0, 6);
-	} else {
-		$seg2 = substr($x, 0, 7);
-	}
-	my $seg3=substr($x,length($seg2));
-	$seg3=substr($seg3,0,length($seg3)-1) ;
-	my $seg4 = substr($x, -1, 1);
-	return "$seg1-$seg2-$seg3-$seg4";
-}
-sub calculatelc{
-## Function to create padded LC call number for sorting items with their LC code. Not exported
-my  ($classification)=@_;
-$classification=~s/^\s+|\s+$//g;
-my $i=0;
-my $lc2;
-my $lc1;
-for  ($i=0; $i<length($classification);$i++){
-my $c=(substr($classification,$i,1));
-	if ($c ge '0' && $c le '9'){
-	
-	$lc2=substr($classification,$i);
-	last;
-	}else{
-	$lc1.=substr($classification,$i,1);
-	
-	}
-}#while
-
-my $other=length($lc1);
-if(!$lc1){$other=0;}
-my $extras;
-if ($other<4){
-	for (1..(4-$other)){
-	$extras.="0";
-	}
-}
- $lc1.=$extras;
-$lc2=~ s/^ //g;
-
-$lc2=~ s/ //g;
-$extras="";
-##Find the decimal part of $lc2
-my $pos=index($lc2,".");
-if ($pos<0){$pos=length($lc2);}
-if ($pos>=0 && $pos<5){
-##Pad lc2 with zeros to create a 5digit decimal needed in marc record to sort as numeric
-
-	for (1..(5-$pos)){
-	$extras.="0";
-	}
-}
-$lc2=$extras.$lc2;
-return($lc1.$lc2);
-}
-
-sub itemcalculator{
-## Sublimentary function to obtain sorted LC for items. Not exported
-my ($dbh,$biblionumber,$callnumber)=@_;
-my $xmlhash=XMLgetbibliohash($dbh,$biblionumber);
-my $lc=XML_readline_onerecord($xmlhash,"classification","biblios");
-my $cutter=XML_readline_onerecord($xmlhash,"subclass","biblios");
-my $all=$lc." ".$cutter;
-my $total=length($all);
-my $cutterextra=substr($callnumber,$total);
-return $cutterextra;
-
-}
-
-
-#### This function allows decoding of only title and author out of a MARC record
-  sub func_title_author {
-        my ($tagno,$tagdata) = @_;
-my ($titlef,$subf,$authf);
-   ($titlef,$subf)=&MARCfind_marc_from_kohafield("title","biblios");
-   ($authf,$subf)=&MARCfind_marc_from_kohafield("author","biblios");
-	return ($tagno == $titlef || $tagno == $authf);
-    }
-
-
-
-
-1;
-__END__
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-
-

Index: modules/C4/Biblioadd.pm
===================================================================
RCS file: modules/C4/Biblioadd.pm
diff -N modules/C4/Biblioadd.pm
--- modules/C4/Biblioadd.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,521 +0,0 @@
-package C4::Biblioadd;
-# New PackageI added by tgarip at neu.edu.tr 25/02/07
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-use XML::Simple;
-use Encode;
-use MARC::Record;
-use MARC::File::USMARC;
-use C4::Biblio;
-use Data::Dumper;
-use vars qw( $tagslib);
-use vars qw( $authorised_values_sth);
-
-my $format="USMARC";
-$format="UNIMARC" if (C4::Context->preference('marcflavour') eq 'UNIMARC');
-use MARC::File::XML(RecordFormat =>$format);
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 4.01;
-
- at ISA = qw(Exporter);
-
-
- at EXPORT = qw(
-&MARCfindbreeding
-&ImportDVD
-&build_authorized_values_list
-&create_input
-&build_tabs
-&build_hidden_data
-);
-
-=item MARCfindbreeding
-
-    $record = MARCfindbreeding($dbh, $breedingid,$frameworkcode);
-
-Look up the breeding farm with database handle $dbh, for the
-record with id $breedingid.  If found, returns the decoded
-MARC::Record; otherwise, -1 is returned (FIXME).
-Returns as second parameter the character encoding.
-
-=cut
-
-sub MARCfindbreeding {
-	my ($dbh,$id,$oldbiblionumber) = @_;
-	my $sth = $dbh->prepare("select marc,encoding from marc_breeding where id=?");
-	$sth->execute($id);
-	my ($marc,$encoding) = $sth->fetchrow;
-	$sth->finish;
-	if ($marc) {
-		my $record = MARC::File::USMARC::decode($marc);
-		if (ref($record) eq undef) {
-			return -1;
-		} 
-	if (C4::Context->preference("z3950NormalizeAuthor") and C4::Context->preference("z3950AuthorAuthFields")){
-				my ($tag,$subfield) = MARCfind_marc_from_kohafield("author","biblios");
-				my $auth_fields = C4::Context->preference("z3950AuthorAuthFields");
-				my @auth_fields= split /,/,$auth_fields;
-				my $field;
-				if ($record->field($tag)){
-					foreach my $tmpfield ($record->field($tag)->subfields){
-						my $subfieldcode=shift @$tmpfield;
-						my $subfieldvalue=shift @$tmpfield;
-						if ($field){
-							$field->add_subfields("$subfieldcode"=>$subfieldvalue) if ($subfieldcode ne $subfield);
-						} else {
-							$field=MARC::Field->new($tag,"","",$subfieldcode=>$subfieldvalue) if ($subfieldcode ne $subfield);
-						}
-					}
-				}
-				$record->delete_field($record->field($tag));
-				foreach my $fieldtag (@auth_fields){
-					next unless ($record->field($fieldtag));
-					my $lastname = $record->field($fieldtag)->subfield('a');
-					my $firstname= $record->field($fieldtag)->subfield('b');
-					my $title = $record->field($fieldtag)->subfield('c');
-					my $number= $record->field($fieldtag)->subfield('d');
-					if ($title){
-						$field->add_subfields("$subfield"=>ucfirst($title)." ".ucfirst($firstname)." ".$number);
-					}else{
-						$field->add_subfields("$subfield"=>ucfirst($firstname).", ".ucfirst($lastname));
-					}
-				}
-				$record->insert_fields_ordered($field);
-			}
-##Delete biblionumber tag in case a similar tag is used in imported MARC ## 
-	my  (  $tagfield,  $tagsubfield )  =MARCfind_marc_from_kohafield("biblionumber","biblios");
-		my $old_field = $record->field($tagfield);
-		$record->delete_field($old_field);
-		##add the old biblionumber if a modif but coming from breedingfarm
-		if ($oldbiblionumber){
-			my $newfield;
-			if ($tagfield<10){
-	 		$newfield = MARC::Field->new($tagfield,  $oldbiblionumber);
-			}else{
- 			$newfield = MARC::Field->new($tagfield, '', '', "$tagsubfield" => $oldbiblionumber);
-			}	
-		$record->insert_fields_ordered($newfield);
-		}
-	my $xml=MARC::File::XML::record($record);
-	
-	my $xmlhash=XML_xml2hash_onerecord($xml);
-		return $xmlhash,$encoding;
-		
-	}
-	return -1;
-}
-
-=item ImportDVD
-
-=cut
-
-sub ImportDVD {
-my ($filename,$oldbiblionumber)=@_;
-
-## Fixme the path to be variable
-my $fullname=C4::Context->config('intranetdir')."/htdocs/uploaded-files/tmp-pdf/".$filename;
-
-my $xml;
-my $xmlhash;
-open(IN,"<" ,$fullname) or die $!;
-while (<IN>){
-$xml.=$_;
-}
-close(IN);
-$xml=Encode::encode('utf8',$xml);
-$xmlhash=XML_xml2hash_onerecord($xml);
-if ($oldbiblionumber){
-$xmlhash=XML_writeline($xmlhash,"biblionumber",$oldbiblionumber,"biblios");
-}
-return $xmlhash;
-}
-=item build_authorized_values_list
-
-=cut
-
-sub build_authorized_values_list  {
-	my($tag, $subfield, $value, $dbh,$authorised_values_sth,$tagslib) = @_;
-
-	my @authorised_values;
-	my %authorised_lib;
-	my ($itemtype,$description);
-	# builds list, depending on authorised value...
-
-	#---- branch
-	if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
-	my $sth=$dbh->prepare("select branchcode,branchname from branches order by branchname");
-	$sth->execute;
-	push @authorised_values, ""
-		unless ($tagslib->{$tag}->{$subfield}->{mandatory});
-
-	while (my ($branchcode,$branchname) = $sth->fetchrow_array) {
-		push @authorised_values, $branchcode;
-		$authorised_lib{$branchcode}=$branchname;
-	}
-
-	#----- itemtypes
-	} elsif ($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") {
-		my $sth=$dbh->prepare("select itemtype,description from itemtypes order by description");
-		$sth->execute;
-		push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
-	
-		while ( ($itemtype,$description) = $sth->fetchrow_array) {
-			push @authorised_values, $itemtype;
-			$authorised_lib{$itemtype}=$description;
-		}
-		$value=$itemtype unless ($value);
-
-	#---- "true" authorised value
-	} else {
-		$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
-
-		push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
-	
-		while (my ($value,$lib) = $authorised_values_sth->fetchrow_array) {
-			push @authorised_values, $value;
-			$authorised_lib{$value}=$lib;
-		}
-    }
-    return CGI::scrolling_list( -name     => 'field_value',
-				-values   => \@authorised_values,
-				-default  => $value,
-				-labels   => \%authorised_lib,
-				-override => 1,
-				-size     => 1,
-				-multiple => 0 );
-}
-
-=item create_input
- builds the <input ...> entry for a subfield.
-=cut
-sub create_input  {
-	my ($tag,$subfield,$value,$i,$tabloop,$rec,$authorised_values_sth,$id,$tagslib) = @_;	
-	my $dbh=C4::Context->dbh;
-	$value =~ s/"/&quot;/g;
-	my %subfield_data;
-	$subfield_data{id}=$id;
-	$subfield_data{tag}=$tag;
-	$subfield_data{subfield}=$subfield;
-	$subfield_data{marc_lib}="<span id=\"error$i\">".$tagslib->{$tag}->{$subfield}->{lib}."</span>";
-	$subfield_data{marc_lib_plain}=$tagslib->{$tag}->{$subfield}->{lib};
-	$subfield_data{tag_mandatory}=$tagslib->{$tag}->{mandatory};
-	$subfield_data{mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
-	$subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
-	$subfield_data{index} = $i;
-	$subfield_data{visibility} = "display:none" if (substr($tagslib->{$tag}->{$subfield}->{hidden},2,1) gt "0") ; #check parity
-	if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
-		$subfield_data{marc_value}= build_authorized_values_list($tag, $subfield, $value, $dbh,$authorised_values_sth,$tagslib);
-	# it's an  authority field
-	} elsif ($tagslib->{$tag}->{$subfield}->{authtypecode}) {
-		
-		$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffffff;'\"\" tabindex=\"1\" type=\"text\"   name=\"field_value\" id=\"field_value$id\" value=\"$value\" size=\"40\" maxlength=\"255\" DISABLE READONLY> <a  style=\"cursor: help;\" href=\"javascript:Dopop('../authorities/auth_finder.pl?authtypecode=".$tagslib->{$tag}->{$subfield}->{authtypecode}."&index=$id',$id);\">...</a>";
-	# it's a plugin field
-	} elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
-		# opening plugin. Just check wether we are on a developper computer on a production one
-		# (the cgidir differs)
-		my $cgidir = C4::Context->intranetdir ."/cgi-bin/value_builder";
-		unless (opendir(DIR, "$cgidir")) {
-			$cgidir = C4::Context->intranetdir."/value_builder";
-		} 
-		my $plugin=$cgidir."/".$tagslib->{$tag}->{$subfield}->{'value_builder'}; 
-		do $plugin;
-		my $extended_param = plugin_parameters($dbh,$rec,$tagslib,$i,$tabloop);
-		my ($function_name,$javascript) = plugin_javascript($dbh,$rec,$tagslib,$i,$tabloop);
-		$subfield_data{marc_value}="<input tabindex=\"1\" type=\"text\"  name=\"field_value\" id=\"field_value$id\"  value=\"$value\" size=\"40\" maxlength=\"255\" DISABLE READONLY OnFocus=\"javascript:Focus$function_name($i)\" OnBlur=\"javascript:Blur$function_name($i); \"> <a  style=\"cursor: help;\" href=\"javascript:Clic$function_name($i)\">...</a> $javascript";
-	# it's an hidden field
-	} elsif  ($tag eq '') {
-		$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffffff'; \" tabindex=\"1\" type=\"hidden\" name=\"field_value\" id=\"field_value$id\"  value=\"$value\">";
-	} elsif  (substr($tagslib->{$tag}->{$subfield}->{'hidden'},2,1) gt "1") {
-
-		$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffffff'; \" tabindex=\"1\" type=\"text\" name=\"field_value\" id=\"field_value$id\"   value=\"$value\" size=\"40\" maxlength=\"255\" >";
-	# it's a standard field
-	} else {
-		if (length($value) >100) {
-			$subfield_data{marc_value}="<textarea tabindex=\"1\" name=\"field_value\" id=\"field_value$id\"  cols=\"40\" rows=\"5\" >$value</textarea>";
-		} else {
-			$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffffff'; \" tabindex=\"1\" type=\"text\" name=\"field_value\" id=\"field_value$id\"  value=\"$value\" size=\"50\">"; #"
-		}
-	}
-	return \%subfield_data;
-}
-
-sub build_tabs {
-    my($template, $xmlhash, $dbh,$addedfield,$tagslib,$authorised_values_sth) = @_;
-    # fill arrays
-    my @loop_data =();
-    my $tag;
-    my $i=0;
-my $id=100;
-
-my ($biblionumtagfield,$biblionumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblionumber","biblios");
-
-my $biblio;
-my $controlfields;
-my $leader;
-if ($xmlhash){
- $biblio=$xmlhash->{'datafield'};
- $controlfields=$xmlhash->{'controlfield'};
- $leader=$xmlhash->{'leader'};
-}
-
-    my @BIG_LOOP;
-my %built;
-
-# loop through each tab 0 through 9
-for (my $tabloop = 0; $tabloop <= 9; $tabloop++) {
-
-		my @loop_data = ();
-	foreach my $tag (sort(keys (%{$tagslib}))) {
-	next if ($tag eq $biblionumtagfield);## Otherwise biblionumber will be duplicated on modifs if user has set visibility to true
-			my $indicator;
-				# if MARC::Record is not empty => use it as master loop, then add missing subfields that should be in the tab.
-				# if MARC::Record is empty => use tab as master loop.
-		my @subfields_data;
-		
-	if ($xmlhash) {
-			####
-			my %tagdefined;
-			my %definedsubfields;
-			
-			my ($ind1,$ind2);
-			
-		 if ($tag>9){
-			foreach my $data (@$biblio){
-					my @subfields_data;
-					undef %definedsubfields;
-   	 			 if ($data->{'tag'} eq $tag){
-					$tagdefined{$tag}=1 ;
-					    $ind1="  ";
-					      $ind2="  ";		
-					      foreach my $subfieldcode ( $data->{'subfield'}){
-		   				 foreach my $code ( @$subfieldcode){	
-							next if ($tagslib->{$tag}->{$code->{'code'}}->{tab} ne $tabloop);						
-							my $subfield=$code->{'code'}  ;
-							my $value=$code->{'content'};
-							$definedsubfields{$tag.$subfield}=1 ;
-							 $built{$tag}=1;
-							push(@subfields_data, &create_input($tag,$subfield,$value,$i,$tabloop,$xmlhash,$authorised_values_sth,$id,$tagslib)) ;
-							$i++ ;
-		   				}
-					      } ##each subfield
-					    $ind1=$data->{'ind1'};
-					    $ind2=	$data->{'ind2'};
-					  
-					
-					# now, loop again to add parameter subfield that are not in the MARC::Record
-					
-					foreach my $subfield (sort( keys %{$tagslib->{$tag}})) {
-						next if (length $subfield !=1);
-						next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
-						next if ((substr($tagslib->{$tag}->{$subfield}->{hidden},2,1) gt "1")  ); #check for visibility flag
-						next if ($definedsubfields{$tag.$subfield} );
-						push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$xmlhash,$authorised_values_sth,$id,$tagslib));
-						$definedsubfields{$tag.$subfield}=1;
-						$i++;
-					}
-					if ($#subfields_data >= 0) {
-						my %tag_data;
-						$tag_data{tag} = $tag;
-						$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
-						$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
-						$tag_data{indicator} = $ind1.$ind2 if ($tag>=10);
-						$tag_data{subfield_loop} = \@subfields_data;
-						push (@loop_data, \%tag_data);
-						
-					}
-					$id++;
-  	  			     }## if tag matches
-			
-			}#eachdata
- 		}else{ ## tag <10
-			        if ($tag eq "000" || $tag eq "LDR"){
-					my $subfield="@";
-					next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
-					my @subfields_data;
-					my $value=$leader->[0] if $leader->[0];
-					$tagdefined{$tag}=1 ;
-					push(@subfields_data, &create_input($tag,$subfield,$value,$i,$tabloop,$xmlhash,$authorised_values_sth,$id,$tagslib));					
-					$i++;
-					if ($#subfields_data >= 0) {
-						my %tag_data;
-						$tag_data{tag} = $tag;
-						$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
-						$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
-						$tag_data{subfield_loop} = \@subfields_data;
-                                                			$tag_data{fixedfield} = 1;
-						push (@loop_data, \%tag_data);
-					}
-			         }else{
-	   			 foreach my $control (@$controlfields){
-					my $subfield="@";
-					next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
-					my @subfields_data;
-					if ($control->{'tag'} eq $tag){
-					$tagdefined{$tag}=1 ;
-					my $value=$control->{'content'} ;
-					$definedsubfields{$tag.'@'}=1;
-					push(@subfields_data, &create_input($tag,$subfield,$value,$i,$tabloop,$xmlhash,$authorised_values_sth,$id,$tagslib));					
-					$i++;
-					
-					   $built{$tag}=1;
-					
-					if ($#subfields_data >= 0) {
-						my %tag_data;
-						$tag_data{tag} = $tag;
-						$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
-						$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
-						$tag_data{subfield_loop} = \@subfields_data;
-						$tag_data{fixedfield} = 1;
-						push (@loop_data, \%tag_data);
-					}
-					$id++;
-					}## tag matches
-	  			 }# each control
-			       }
-   			}##tag >9
-
-
-			##### Any remaining tag
-				my @subfields_data;
-				# now, loop again to add parameter subfield that are not in the MARC::Record
-					foreach my $subfield (sort( keys %{$tagslib->{$tag}})) {
-						next if ($tagdefined{$tag} );
-						next if (length $subfield !=1);
-						next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
-						next if ((substr($tagslib->{$tag}->{$subfield}->{hidden},2,1) gt "1")  ); #check for visibility flag
-						
-						push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$xmlhash,$authorised_values_sth,$id,$tagslib));
-						$tagdefined{$tag.$subfield}=1;
-						$i++;
-					}
-					if ($#subfields_data >= 0) {
-						my %tag_data;
-						$tag_data{tag} = $tag;
-						$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
-						$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
-						$tag_data{indicator} = $ind1.$ind2 if ($tag>=10);
-						$tag_data{subfield_loop} = \@subfields_data;
-						if ($tag<10) {
-                                                			$tag_data{fixedfield} = 1;
-                                        				}
-
-						push (@loop_data, \%tag_data);
-					}
-
-					
-					if ($addedfield eq $tag) {
-						my %tag_data;
-						my @subfields_data;
-						$id++;
-						$tagdefined{$tag}=1 ;
-						foreach my $subfield (sort( keys %{$tagslib->{$tag}})) {
-						next if (length $subfield !=1);
-						next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
-						next if ((substr($tagslib->{$tag}->{$subfield}->{hidden},2,1) gt "1")  ); #check for visibility flag
-						$addedfield="";	
-						push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$xmlhash,$authorised_values_sth,$id,$tagslib));
-						$i++;
-							}
-						if ($#subfields_data >= 0) {
-						$tag_data{tag} = $tag;
-						$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
-						$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
-						$tag_data{indicator} = ' ' if ($tag>=10);
-						$tag_data{subfield_loop} = \@subfields_data;
-							if ($tag<10) {
-                                                				$tag_data{fixedfield} = 1;
-                                        					}
-						push (@loop_data, \%tag_data);
-											
-						}
-				
-					}
-				
-	# if breeding is empty
-			} else {
-				my @subfields_data;
-				foreach my $subfield (sort(keys %{$tagslib->{$tag}})) {
-					next if (length $subfield !=1);
-					next if ((substr($tagslib->{$tag}->{$subfield}->{hidden},2,1) gt "1")  ); #check for visibility flag
-					next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
-					push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$xmlhash,$authorised_values_sth,$id,$tagslib));
-					$i++;
-				}
-				if ($#subfields_data >= 0) {
-					my %tag_data;
-					$tag_data{tag} = $tag;
-					$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
-					$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
-					$tag_data{indicator} = $indicator;
-					$tag_data{subfield_loop} = \@subfields_data;
-					$tag_data{tagfirstsubfield} = $tag_data{subfield_loop}[0];
-					if ($tag<10) {
-						$tag_data{fixedfield} = 1;
-					}
-					push (@loop_data, \%tag_data);
-
-				}
-			}
-		$id++;
-	}
-	if ($#loop_data >=0) {
-            my %big_loop_line;
-            $big_loop_line{number}=$tabloop;
-            $big_loop_line{innerloop}=\@loop_data;
-            push @BIG_LOOP,\%big_loop_line;
-            }	
-
-		$template->param(BIG_LOOP => \@BIG_LOOP);
-#return \@BIG_LOOP;
-}## tab loop
-
-}
-
-
-sub build_hidden_data  {
-    # build hidden data =>
-    # we store everything, even if we show only requested subfields.
-my $tagslib=shift;
-    my @loop_data =();
-    my $i=0;
-    foreach my $tag (keys %{$tagslib}) {
-	my $previous_tag = '';
-
-	# loop through each subfield
-	foreach my $subfield (keys %{$tagslib->{$tag}}) {
-	    next if ($subfield eq 'lib');
-	    next if ($subfield eq 'tab');
-	    next if ($subfield eq 'mandatory');
-	next if ($subfield eq 'repeatable');
-	    next if ($tagslib->{$tag}->{$subfield}->{'tab'}  ne "-1");
-	    my %subfield_data;
-	    $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib};
-	    $subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
-	    $subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
-	    $subfield_data{marc_value}="<input type=\"hidden\"  name=\"field_value[]\">";
-	    push(@loop_data, \%subfield_data);
-	    $i++
-	}
-return $tagslib;
-    }
-}

Index: modules/C4/BookShelves.pm
===================================================================
RCS file: modules/C4/BookShelves.pm
diff -N modules/C4/BookShelves.pm
--- modules/C4/BookShelves.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,681 +0,0 @@
-# -*- tab-width: 8 -*-
-# Please use 8-character tabs for this file (indents are every 4 characters)
-
-package C4::BookShelves;
-
-# $Id: BookShelves.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-use C4::Circulation::Circ2;
-use C4::AcademicInfo;
-use C4::Search;
-use C4::Date;
-use C4::Biblio;
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::BookShelves - Functions for manipulating Koha virtual bookshelves
-
-=head1 SYNOPSIS
-
-  use C4::BookShelves;
-
-=head1 DESCRIPTION
-
-This module provides functions for manipulating virtual bookshelves,
-including creating and deleting bookshelves, and adding and removing
-items to and from bookshelves.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&GetShelfList &GetShelfContents &AddToShelf &AddToShelfFromBiblio
-				&RemoveFromShelf &AddShelf &RemoveShelf
-				&ShelfPossibleAction
-
-				&GetShelfListExt &AddShelfExt &EditShelfExt &RemoveShelfExt 
-				&GetShelfInfo &GetShelfContentsExt &RemoveFromShelfExt 
-				&GetShelfListOfExt &AddToShelfExt
-				
-				&AddRequestToShelf &CountShelfRequest &GetShelfRequests 
-				&RejectShelfRequest &CatalogueShelfRequest &GetShelfRequestOwner
-				&GetShelfRequest);
-
-	
-my $dbh;
-	 $dbh = C4::Context->dbh;
-
-=item ShelfPossibleAction
-
-=over 4
-
-=item C<$loggedinuser,$shelfnumber,$action>
-
-$action can be "view" or "manage".
-
-Returns 1 if the user can do the $action in the $shelfnumber shelf.
-Returns 0 otherwise.
-
-=back
-
-=cut
-sub ShelfPossibleAction {
-	my ($loggedinuser,$shelfnumber,$action)= @_;
-	my $sth = $dbh->prepare("select owner,category from bookshelf where shelfnumber=?");
-	$sth->execute($shelfnumber);
-	my ($owner,$category) = $sth->fetchrow;
-	return 1 if (($category>=3 or $owner eq $loggedinuser) && $action eq 'manage');
-	return 1 if (($category>= 2 or $owner eq $loggedinuser) && $action eq 'view');
-	return 0;
-}
-
-=item GetShelfList
-
-  $shelflist = &GetShelfList();
-  ($shelfnumber, $shelfhash) = each %{$shelflist};
-
-Looks up the virtual bookshelves, and returns a summary. C<$shelflist>
-is a reference-to-hash. The keys are the bookshelf numbers
-(C<$shelfnumber>, above), and the values (C<$shelfhash>, above) are
-themselves references-to-hash, with the following keys:
-
-=over 4
-
-=item C<$shelfhash-E<gt>{shelfname}>
-
-A string. The name of the shelf.
-
-=item C<$shelfhash-E<gt>{count}>
-
-The number of books on that bookshelf.
-
-=back
-
-=cut
-#'
-# FIXME - Wouldn't it be more intuitive to return a list, rather than
-# a reference-to-hash? The shelf number can be just another key in the
-# hash.
-sub GetShelfList {
-	my ($owner,$mincategory) = @_;
-	# mincategory : 2 if the list is for "look". 3 if the list is for "Select bookshelf for adding a book".
-	# bookshelves of the owner are always selected, whatever the category
-	my $sth=$dbh->prepare("SELECT		bookshelf.shelfnumber, bookshelf.shelfname,owner,surname,firstname, category,
-							count(shelfcontents.itemnumber) as count
-								FROM		bookshelf
-								LEFT JOIN	shelfcontents
-								ON		bookshelf.shelfnumber = shelfcontents.shelfnumber
-								left join borrowers on bookshelf.owner = borrowers.borrowernumber
-								
-								where owner=? or category>=?
-								GROUP BY	bookshelf.shelfnumber order by shelfname");
-    $sth->execute($owner,$mincategory);
-    my %shelflist;
-    while (my ($shelfnumber, $shelfname,$owner,$surname,$firstname,$category,$count) = $sth->fetchrow) {
-	$shelflist{$shelfnumber}->{'shelfname'}=$shelfname;
-	$shelflist{$shelfnumber}->{'count'}=$count;
-	$shelflist{$shelfnumber}->{'owner'}=$owner;
-	$shelflist{$shelfnumber}->{'surname'} = $surname;
-	$shelflist{$shelfnumber}->{'firstname'} = $firstname;
-	$shelflist{$shelfnumber}->{'category'} = $category;
-	
-	
-    }
-
-    return(\%shelflist);
-}
-
-=item GetShelfContents
-
-  $itemlist = &GetShelfContents($env, $shelfnumber);
-
-Looks up information about the contents of virtual bookshelf number
-C<$shelfnumber>.
-
-Returns a reference-to-array, whose elements are references-to-hash,
-as returned by C<&getiteminformation>.
-
-I don't know what C<$env> is.
-
-=cut
-#'
-sub GetShelfContents {
-    my ($env, $shelfnumber) = @_;
-    my @itemlist;
-    my $sth=$dbh->prepare("select itemnumber from shelfcontents where shelfnumber=? order by itemnumber");
-    $sth->execute($shelfnumber);
-    while (my ($itemnumber) = $sth->fetchrow) {
-	my ($item) = getiteminformation($env, $itemnumber, 0);
-	push (@itemlist, $item);
-    }
-    return (\@itemlist);
-}
-
-=item AddToShelf
-
-  &AddToShelf($env, $itemnumber, $shelfnumber);
-
-Adds item number C<$itemnumber> to virtual bookshelf number
-C<$shelfnumber>, unless that item is already on that shelf.
-
-C<$env> is ignored.
-
-=cut
-#'
-sub AddToShelf {
-	my ($env, $itemnumber, $shelfnumber) = @_;
-	return unless $itemnumber;
-	my $sth=$dbh->prepare("select * from shelfcontents where shelfnumber=? and itemnumber=?");
-
-	$sth->execute($shelfnumber, $itemnumber);
-	if ($sth->rows) {
-# already on shelf
-	} else {
-		$sth=$dbh->prepare("insert into shelfcontents (shelfnumber, itemnumber, flags) values (?, ?, 0)");
-		$sth->execute($shelfnumber, $itemnumber);
-	}
-}
-sub AddToShelfFromBiblio {
-	my ($env, $biblionumber, $shelfnumber) = @_;
-	return unless $biblionumber;
-	my $sth = $dbh->prepare("select itemnumber from items where biblionumber=?");
-	$sth->execute($biblionumber);
-	my ($itemnumber) = $sth->fetchrow;
-	$sth=$dbh->prepare("select * from shelfcontents where shelfnumber=? and itemnumber=?");
-	$sth->execute($shelfnumber, $itemnumber);
-	if ($sth->rows) {
-# already on shelf
-	} else {
-		$sth=$dbh->prepare("insert into shelfcontents (shelfnumber, itemnumber, flags,biblionumber) values (?, ?, 0,?)");
-		$sth->execute($shelfnumber, $itemnumber,$biblionumber);
-	}
-}
-
-=item RemoveFromShelf
-
-  &RemoveFromShelf($env, $itemnumber, $shelfnumber);
-
-Removes item number C<$itemnumber> from virtual bookshelf number
-C<$shelfnumber>. If the item wasn't on that bookshelf to begin with,
-nothing happens.
-
-C<$env> is ignored.
-
-=cut
-#'
-sub RemoveFromShelf {
-    my ($env, $itemnumber, $shelfnumber) = @_;
-    my $sth=$dbh->prepare("delete from shelfcontents where shelfnumber=? and itemnumber=?");
-    $sth->execute($shelfnumber,$itemnumber);
-}
-
-=item AddShelf
-
-  ($status, $msg) = &AddShelf($env, $shelfname);
-
-Creates a new virtual bookshelf with name C<$shelfname>.
-
-Returns a two-element array, where C<$status> is 0 if the operation
-was successful, or non-zero otherwise. C<$msg> is "Done" in case of
-success, or an error message giving the reason for failure.
-
-C<$env> is ignored.
-
-=cut
-#'
-# FIXME - Perhaps this could/should return the number of the new bookshelf
-# as well?
-sub AddShelf {
-    my ($env, $shelfname,$owner,$category) = @_;
-    my $sth=$dbh->prepare("select * from bookshelf where shelfname=?");
-	$sth->execute($shelfname);
-    if ($sth->rows) {
-	return(1, "Shelf \"$shelfname\" already exists");
-    } else {
-	$sth=$dbh->prepare("insert into bookshelf (shelfname,owner,category) values (?,?,?)");
-	$sth->execute($shelfname,$owner,$category);
-	return (0, "Done");
-    }
-}
-
-=item RemoveShelf
-
-  ($status, $msg) = &RemoveShelf($env, $shelfnumber);
-
-Deletes virtual bookshelf number C<$shelfnumber>. The bookshelf must
-be empty.
-
-Returns a two-element array, where C<$status> is 0 if the operation
-was successful, or non-zero otherwise. C<$msg> is "Done" in case of
-success, or an error message giving the reason for failure.
-
-C<$env> is ignored.
-
-=cut
-#'
-sub RemoveShelf {
-    my ($env, $shelfnumber) = @_;
-    my $sth=$dbh->prepare("select count(*) from shelfcontents where shelfnumber=?");
-	$sth->execute($shelfnumber);
-    my ($count)=$sth->fetchrow;
-    if ($count) {
-	return (1, "Shelf has $count items on it.  Please remove all items before deleting this shelf.");
-    } else {
-	$sth=$dbh->prepare("delete from bookshelf where shelfnumber=?");
-	$sth->execute($shelfnumber);
-	return (0, "Done");
-    }
-}
-
-sub GetShelfListOfExt {
-	my ($owner) = @_;
-	my $sth;
-	if ($owner) {
-		$sth = $dbh->prepare("SELECT	* FROM bookshelf WHERE (owner = ?) or category>=2 ORDER BY shelfname");
-		$sth->execute($owner);
-	} else {
-		$sth = $dbh->prepare("SELECT	* FROM bookshelf where category<2 ORDER BY shelfname");
-		$sth->execute();
-	}
-	
-	my $sth2 = $dbh->prepare("SELECT count(biblionumber) as bibliocount FROM shelfcontents WHERE (shelfnumber = ?)");
-	
-	my @results;
-	while (my $row = $sth->fetchrow_hashref) {
-		$sth2->execute($row->{'shelfnumber'});
-		$row->{'bibliocount'} = $sth2->fetchrow;
-		if ($row->{'category'} == 1) {
-			$row->{'private'} = 1;
-		} else {
-			$row->{'public'} = 1;
-		}
-		push @results, $row;
-	}
-    return \@results;
-}
-
-sub GetShelfListExt {
-	my ($owner,$mincategory,$id_intitution, $intra) = @_;
-
-	my $sth1 = $dbh->prepare("SELECT * FROM careers WHERE id_institution = ?");
-	$sth1->execute($id_intitution);
-	my @results;
-
-	my $total_shelves = 0;
-	while (my $row1 = $sth1->fetchrow_hashref) {
-		
-		my @shelves;
-		my $sth2;
-		if ($intra) {
-			$sth2=$dbh->prepare("SELECT		
-									bookshelf.shelfnumber, bookshelf.shelfname,owner,surname,firstname, category,
-									count(shelfcontents.biblionumber) as count
-								FROM 
-									bookshelf
-									LEFT JOIN shelfcontents ON bookshelf.shelfnumber = shelfcontents.shelfnumber
-									LEFT JOIN borrowers ON bookshelf.owner = borrowers.borrowernumber	
-								    LEFT JOIN bookshelves_careers ON bookshelves_careers.shelfnumber = bookshelf.shelfnumber
-								WHERE 
-									(id_career = ?) 
-								GROUP BY bookshelf.shelfnumber 
-								ORDER BY shelfname");
-			$sth2->execute($row1->{'id_career'});
-		
-		} else {
-			$sth2=$dbh->prepare("SELECT		
-									bookshelf.shelfnumber, bookshelf.shelfname,owner,surname,firstname, category,
-									count(shelfcontents.biblionumber) as count
-								FROM 
-									bookshelf
-									LEFT JOIN shelfcontents ON bookshelf.shelfnumber = shelfcontents.shelfnumber
-									LEFT JOIN borrowers ON bookshelf.owner = borrowers.borrowernumber	
-								    LEFT JOIN bookshelves_careers ON bookshelves_careers.shelfnumber = bookshelf.shelfnumber
-								WHERE 
-									(owner = ? OR category >= ?) AND (id_career = ?) 
-								GROUP BY bookshelf.shelfnumber 
-								ORDER BY shelfname");
-			$sth2->execute($owner,$mincategory,$row1->{'id_career'});
-		}
-		
-		$row1->{'shelfcount'} = 0;
-		while (my $row2 = $sth2->fetchrow_hashref) {
-			if ($owner == $row2->{'owner'}) {
-				$row2->{'canmanage'} = 1;
-			}
-			if ($row2->{'category'} == 1) {
-				$row2->{'private'} = 1;
-			} else {
-				$row2->{'public'} = 1;
-			}
-			$row1->{'shelfcount'}++;
-			$total_shelves++; 
-			push @shelves, $row2;
-		}
-		$row1->{'shelvesloop'} = \@shelves;
-		push @results, $row1;
-	}
-
-    return($total_shelves, \@results);
-}
-
-sub AddShelfExt {
-    my ($shelfname,$owner,$category,$careers) = @_;
-    my $sth = $dbh->prepare("SELECT * FROM bookshelf WHERE shelfname = ?");
-	$sth->execute($shelfname);
-    if ($sth->rows) {
-		return 0;
-    } else {
-		$sth = $dbh->prepare("INSERT INTO bookshelf (shelfname,owner,category) VALUES (?,?,?)");
-		$sth->execute($shelfname,$owner,$category);
-		my $shelfnumber = $dbh->{'mysql_insertid'};
-
-		foreach my $row (@{$careers}) {
-			$sth = $dbh->prepare("INSERT INTO bookshelves_careers VALUES (?,?)");
-			$sth->execute($shelfnumber, $row);
-		}
-		return $shelfnumber;
-    }
-}
-
-sub EditShelfExt {
-    my ($shelfnumber,$shelfname,$category,$careers) = @_;
-    my $sth = $dbh->prepare("SELECT * FROM bookshelf WHERE shelfname = ? AND NOT shelfnumber = ? ");
-	$sth->execute($shelfname, $shelfnumber);
-    if ($sth->rows) {
-		return 0;
-    } else {
-		$sth = $dbh->prepare("UPDATE bookshelf SET shelfname = ?, category = ? WHERE shelfnumber = ?");
-		$sth->execute($shelfname,$category,$shelfnumber);
-		
-		$sth = $dbh->prepare("DELETE FROM bookshelves_careers WHERE shelfnumber = ?");
-		$sth->execute($shelfnumber);
-
-		foreach my $row (@{$careers}) {
-			$sth = $dbh->prepare("INSERT INTO bookshelves_careers VALUES (?,?)");
-			$sth->execute($shelfnumber, $row);
-		}
-		return $shelfnumber;
-    }
-}
-
-
-sub RemoveShelfExt {
-    my ($shelfnumber) = @_;
-	my $sth = $dbh->prepare("DELETE FROM bookshelves_careers WHERE shelfnumber = ?");
-	$sth->execute($shelfnumber);
-	my $sth = $dbh->prepare("DELETE FROM shelfcontents WHERE shelfnumber = ?");
-	$sth->execute($shelfnumber);
-	$sth = $dbh->prepare("DELETE FROM bookshelf WHERE shelfnumber = ?");
-	$sth->execute($shelfnumber);
-	return 1;
-}
-
-sub GetShelfInfo {
-	my ($shelfnumber, $owner) = @_;
-	my $sth = $dbh->prepare("SELECT * FROM bookshelf WHERE shelfnumber = ?");
-	$sth->execute($shelfnumber);
-	my $result = $sth->fetchrow_hashref;
-	
-	if ($result->{'owner'} == $owner) {
-		$result->{'canmanage'} = 1;
-	}
-
-	my $sth = $dbh->prepare("SELECT id_career FROM bookshelves_careers WHERE shelfnumber = ?");
-	$sth->execute($shelfnumber);
-	my @careers;
-	while (my $row = $sth->fetchrow) {
-		push @careers, $row;
-	}
-	$result->{'careers'} = \@careers;
-	return $result;
-}
-
-sub GetShelfContentsExt {
-    my ($shelfnumber) = @_;
-    my $sth = $dbh->prepare("SELECT biblionumber FROM shelfcontents WHERE shelfnumber = ? ORDER BY biblionumber");
-    $sth->execute($shelfnumber);
-	my @biblios;
-	my $even = 0;
-    while (my ($biblionumber) = $sth->fetchrow) {
-	my $biblio=ZEBRA_readyXML_noheader($dbh,$biblionumber);
-	my  $xmlrecord=XML_xml2hash($biblio);
-	push @biblios,$xmlrecord;
-     }	
-my ($facets, at results)=parsefields($dbh,"opac", at biblios);
-    
-    return (\@results);
-}
-
-sub RemoveFromShelfExt {
-    my ($biblionumber, $shelfnumber) = @_;
-    my $sth = $dbh->prepare("DELETE FROM shelfcontents WHERE shelfnumber = ? AND biblionumber = ?");
-    $sth->execute($shelfnumber,$biblionumber);
-}
-
-sub AddToShelfExt {
-	my ($biblionumber, $shelfnumber) = @_;
-	my $sth = $dbh->prepare("SELECT * FROM shelfcontents WHERE shelfnumber = ? AND biblionumber = ?");
-	$sth->execute($shelfnumber, $biblionumber);
-	if ($sth->rows) {
-		return 0
-	} else {
-		$sth = $dbh->prepare("INSERT INTO shelfcontents (shelfnumber, biblionumber) VALUES (?, ?)");
-		$sth->execute($shelfnumber, $biblionumber);
-	}
-}
-
-sub AddRequestToShelf {
-	my ($shelfnumber, $requestType, $requestName, $comments) = @_;
-	my $sth = $dbh->prepare("INSERT INTO shelf_requests (shelfnumber, request_name, request_type, status, request_date, comments) VALUES (?,?,?,?, CURRENT_DATE(),?)");
-	$sth->execute($shelfnumber, $requestName, $requestType, "PENDING", $comments);
-	return $dbh->{'mysql_insertid'};
-}
-
-sub CountShelfRequest {
-	my ($shelfnumber, $status) = @_;
-	my $sth;
-	if ($shelfnumber) {
-		$sth = $dbh->prepare("SELECT count(idRequest) FROM shelf_requests WHERE shelfnumber = ? AND status = ?");
-		$sth->execute($shelfnumber, $status);
-	} else {
-		$sth = $dbh->prepare("SELECT count(idRequest) FROM shelf_requests WHERE status = ?");
-		$sth->execute($status);
-	}
-	my ($count) = $sth->fetchrow_array;
-	return $count;
-}
-
-sub GetShelfRequests {
-	my ($shelfnumber, $status, $type) = @_;
-	my @params;
-	my $query = "SELECT * FROM shelf_requests SR INNER JOIN bookshelf BS ON SR.shelfnumber = BS.shelfnumber WHERE status = ?";
-	push @params, $status;
-	if ($shelfnumber) {
-		$query.= " AND shelfnumber = ?";
-		push @params, $shelfnumber;
-	}
-	if ($type) {
-		$query.= " AND request_type = ?";
-		push @params, $type;
-	}
-	$query.= " ORDER BY SR.shelfnumber, SR.request_date";
-	my $sth = $dbh->prepare($query);
-	$sth->execute(@params);
-	my @results;
-
-	my $color = 0;
-	while (my $row = $sth->fetchrow_hashref) {
-		my $borrdata = borrdata('',$row->{'owner'});
-		$row->{'surname'} = $borrdata->{'surname'};
-		$row->{'firstname'} = $borrdata->{'firstname'};
-		$row->{'cardnumber'} = $borrdata->{'cardnumber'};
-		$row->{'request_date'} = format_date($row->{'request_date'});
-		$row->{$row->{'request_type'}} = 1;
-		$row->{$row->{'status'}} = 1;
-		$row->{'color'} = $color = not $color;
-		push @results, $row;
-	}
-	return (\@results);
-}
-
-sub RejectShelfRequest {
-	my ($idRequest) = @_;
-	#get the type and name request
-	my $sth = $dbh->prepare("SELECT request_type, request_name FROM shelf_requests WHERE idRequest = ?");
-	$sth->execute($idRequest);
-	my ($request_type, $request_name) = $sth->fetchrow_array;	
-	#if the request is a file, then unlink the file
-	if ($request_type eq 'file') {
-		unlink($ENV{'DOCUMENT_ROOT'}."/uploaded-files/shelf-files/$idRequest-$request_name");
-	}
-	#change tha request status to REJECTED
-	$sth = $dbh->prepare("UPDATE shelf_requests SET status = ? WHERE idRequest = ?");
-	$sth->execute("REJECTED", $idRequest);
-	return 1;
-}
-
-sub GetShelfRequestOwner {
-	my ($idRequest) = @_;
-	my $sth = $dbh->prepare("SELECT owner FROM shelf_requests R INNER JOIN bookshelf S ON R.shelfnumber = S.shelfnumber WHERE idRequest = ?");
-	$sth->execute($idRequest);
-	my ($owner) = $sth->fetchrow_array;	
-	my $bordata = &borrdata(undef, $owner);
-	#print "Content-type: text/plain \n\n  --- $owner ----- $bordata->{'emailaddress'}" ;
-	return ($bordata);
-}
-
-sub GetShelfRequest {
-	my ($idRequest) = @_;
-	my $sth = $dbh->prepare("SELECT * FROM shelf_requests R INNER JOIN bookshelf S ON R.shelfnumber = S.shelfnumber WHERE idRequest = ?");
-	$sth->execute($idRequest);
-	my $request_data = $sth->fetchrow_hashref;	
-	return $request_data;
-}
-
-sub CatalogueShelfRequest {
-	my ($idRequest, $shelfnumber, $biblionumber) = @_;
-	#find the last request status 
-	my $sth = $dbh->prepare("SELECT status, biblionumber FROM shelf_requests WHERE idRequest = ?");
-	$sth->execute($idRequest);
-	my ($prev_status, $prev_biblionumber) = $sth->fetchrow_array;
-	#if the status was not seted, inserts an entry in shelfcontents	
-	if ($prev_status ne "CATALOGUED") {
-		$sth = $dbh->prepare("INSERT INTO shelfcontents (shelfnumber, biblionumber) VALUES (?,?)");
-		$sth->execute($shelfnumber, $biblionumber);		
-	#if the request was previously catalogued, delete the entry in shelfcontens
-	} elsif ($prev_status ne "REJECTED") {
-		$sth = $dbh->prepare("DELETE FROM shelfcontents WHERE shelfnumber = ? AND biblionumber = ?");
-		$sth->execute($shelfnumber, $prev_biblionumber);		
-	}
-	#change the status to catalogued
-	$sth = $dbh->prepare("UPDATE shelf_requests SET status = ?, biblionumber = ? WHERE idRequest = ?");
-	$sth->execute("CATALOGUED", $biblionumber, $idRequest);
-	return 1;
-}
-
-END { }       # module clean-up code here (global destructor)
-
-1;
-
-#
-# $Log: BookShelves.pm,v $
-# Revision 1.1.2.1  2007/03/10 01:35:34  tgarip1957
-# fresh files for rel_TG
-#
-# Revision 1.19  2006/11/06 21:01:43  tgarip1957
-# Bug fixing and complete removal of Date::Manip
-#
-# Revision 1.18  2006/09/06 16:21:03  tgarip1957
-# Clean up before final commits
-#
-# Revision 1.13  2004/03/11 16:06:20  tipaul
-# *** empty log message ***
-#
-# Revision 1.11.2.2  2004/02/19 10:15:41  tipaul
-# new feature : adding book to bookshelf from biblio detail screen.
-#
-# Revision 1.11.2.1  2004/02/06 14:16:55  tipaul
-# fixing bugs in bookshelves management.
-#
-# Revision 1.11  2003/12/15 10:57:08  slef
-# DBI call fix for bug 662
-#
-# Revision 1.10  2003/02/05 10:05:02  acli
-# Converted a few SQL statements to use ? to fix a few strange SQL errors
-# Noted correct tab size
-#
-# Revision 1.9  2002/10/13 08:29:18  arensb
-# Deleted unused variables.
-# Removed trailing whitespace.
-#
-# Revision 1.8  2002/10/10 04:32:44  arensb
-# Simplified references.
-#
-# Revision 1.7  2002/10/05 09:50:10  arensb
-# Merged with arensb-context branch: use C4::Context->dbh instead of
-# &C4Connect, and generally prefer C4::Context over C4::Database.
-#
-# Revision 1.6.2.1  2002/10/04 02:24:43  arensb
-# Use C4::Connect instead of C4::Database, C4::Connect->dbh instead
-# C4Connect.
-#
-# Revision 1.6  2002/09/23 13:50:30  arensb
-# Fixed missing bit in POD.
-#
-# Revision 1.5  2002/09/22 17:29:17  arensb
-# Added POD.
-# Added some FIXME comments.
-# Removed useless trailing whitespace.
-#
-# Revision 1.4  2002/08/14 18:12:51  tonnesen
-# Added copyright statement to all .pl and .pm files
-#
-# Revision 1.3  2002/07/02 17:48:06  tonnesen
-# Merged in updates from rel-1-2
-#
-# Revision 1.2.2.1  2002/06/26 20:46:48  tonnesen
-# Inserting some changes I made locally a while ago.
-#
-#
-1;
-__END__
-
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=head1 SEE ALSO
-
-C4::Circulation::Circ2(3)
-
-=cut

Index: modules/C4/Bookfund.pm
===================================================================
RCS file: modules/C4/Bookfund.pm
diff -N modules/C4/Bookfund.pm
--- modules/C4/Bookfund.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,571 +0,0 @@
-package C4::Bookfund;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Bookfund.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-use strict;
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
-
-=head1 NAME
-
-C4::Bookfund - Koha functions for dealing with bookfund, currency & money.
-
-=head1 SYNOPSIS
-
-use C4::Bookfund;
-
-=head1 DESCRIPTION
-
-the functions in this modules deal with bookfund, currency and money.
-They allow to get and/or set some informations for a specific budget or currency.
-
-=cut
-
- at ISA    = qw(Exporter);
- at EXPORT = qw(
-    &GetBookFund &GetBookFunds &GetBookFundsId &GetBookFundBreakdown &GetCurrencies
-    &NewBookFund
-    &ModBookFund &ModCurrencies
-    &SearchBookFund
-    &Countbookfund 
-    &ConvertCurrency
-    &DelBookFund
-);
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
-#-------------------------------------------------------------#
-
-=head3 GetBookFund
-
-=over 4
-
-$dataaqbookfund = &GetBookFund($bookfundid);
-
-this function get the bookfundid, bookfundname, the bookfundgroup,  the branchcode
-from aqbookfund table for bookfundid given on input arg.
-return: 
-C<$dataaqbookfund> is a hashref full of bookfundid, bookfundname, bookfundgroup,
-and branchcode.
-
-=back
-
-=cut
-
-sub GetBookFund {
-    my $bookfundid = shift;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        SELECT
-            bookfundid,
-            bookfundname,
-            bookfundgroup,
-            branchcode
-        FROM aqbookfund
-        WHERE bookfundid = ?
-    ";
-    my $sth=$dbh->prepare($query);
-$sth->execute($bookfundid);
-    return $sth->fetchrow_hashref;
-}
-
-
-=head3 GetBookFundsId
-
-=over 4
-
-$sth = &GetBookFundsId
-Read on aqbookfund table and execute a simple SQL query.
-
-return:
-$sth->execute. Don't forget to fetch row from the database after using
-this function by using, for example, $sth->fetchrow_hashref;
-
-C<@results> is an array of id existing on the database.
-
-=back
-
-=cut
-
-sub GetBookFundsId {
-    my @bookfundids_loop;
-    my $dbh= C4::Context->dbh;
-    my $query = "
-        SELECT bookfundid
-        FROM aqbookfund
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute;
-    return $sth;
-}
-
-#-------------------------------------------------------------#
-
-=head3 GetBookFunds
-
-=over 4
-
- at results = &GetBookFunds;
-
-Returns a list of all book funds.
-
-C<@results> is an array of references-to-hash, whose keys are fields from the aqbookfund and aqbudget tables of the Koha database. Results are ordered
-alphabetically by book fund name.
-
-=back
-
-=cut
-
-sub GetBookFunds {
-    my ($branch) = @_;
-    my $dbh      = C4::Context->dbh;
-    my $userenv  = C4::Context->userenv;
-    my $branch   = $userenv->{branch};
-    my $strsth;
-
-    if ( $branch  ) {
-        $strsth = "
-        SELECT *
-        FROM   aqbookfund,aqbudget
-        WHERE  aqbookfund.bookfundid=aqbudget.bookfundid
-            AND startdate<=now()
-            AND enddate>now()
-            AND (aqbookfund.branchcode IS NULL OR aqbookfund.branchcode='' OR aqbookfund.branchcode= ? )
-      GROUP BY aqbookfund.bookfundid ORDER BY bookfundname";
-    }
-    else {
-        $strsth = "
-            SELECT *
-            FROM   aqbookfund,
-                   aqbudget
-            WHERE aqbookfund.bookfundid=aqbudget.bookfundid
-                AND startdate<now()
-                AND enddate>now()
-            GROUP BY aqbookfund.bookfundid ORDER BY bookfundname
-        ";
-    }
-    my $sth = $dbh->prepare($strsth);
-    if ( $branch  ) {
-        $sth->execute($branch);
-    }
-    else {
-        $sth->execute;
-    }
-    my @results = ();
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push( @results, $data );
-    }
-    $sth->finish;
-    return @results;
-}
-
-#-------------------------------------------------------------#
-
-=head3 GetCurrencies
-
-=over 4
-
- at currencies = &GetCurrencies;
-
-Returns the list of all known currencies.
-
-C<$currencies> is a array; its elements are references-to-hash, whose
-keys are the fields from the currency table in the Koha database.
-
-=back
-
-=cut
-
-sub GetCurrencies {
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        SELECT *
-        FROM   currency
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute;
-    my @results = ();
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push( @results, $data );
-    }
-    $sth->finish;
-    return @results;
-}
-
-#-------------------------------------------------------------#
-
-=head3 GetBookFundBreakdown
-
-=over 4
-
-( $spent, $comtd ) = &GetBookFundBreakdown( $id, $year, $start, $end );
-
-returns the total comtd & spent for a given bookfund, and a given year
-used in acqui-home.pl
-
-=back
-
-=cut
-
-sub GetBookFundBreakdown {
-    my ( $id, $year, $start, $end ) = @_;
-    my $dbh = C4::Context->dbh;
-
-    # if no start/end dates given defaut to everything
-    if ( !$start ) {
-        $start = '0000-00-00';
-        $end   = 'now()';
-    }
-
-    # do a query for spent totals.
-    my $query = "
-        SELECT quantity,datereceived,freight,unitprice,listprice,ecost,
-               quantityreceived,subscription
-        FROM   aqorders
-        LEFT JOIN aqorderbreakdown ON aqorders.ordernumber=aqorderbreakdown.ordernumber
-        WHERE  bookfundid=?
-            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
-            AND ((datereceived >= ? and datereceived < ?) OR (budgetdate >= ? and budgetdate < ?))
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $id, $start, $end, $start, $end );
-
-    my $spent = 0;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        if ( $data->{'subscription'} == 1 ) {
-            $spent += $data->{'quantity'} * $data->{'unitprice'};
-        }
-        else {
-
-            my $leftover = $data->{'quantity'} - $data->{'quantityreceived'};
-            $spent += ( $data->{'unitprice'} ) * $data->{'quantityreceived'};
-
-        }
-    }
-
-    # then do a seperate query for commited totals, (pervious single query was
-    # returning incorrect comitted results.
-
-    my $query = "
-        SELECT  quantity,datereceived,freight,unitprice,
-                listprice,ecost,quantityreceived AS qrev,
-                subscription,biblio.title,itemtype,aqorders.biblionumber,
-                aqorders.booksellerinvoicenumber,
-                quantity-quantityreceived AS tleft,
-                aqorders.ordernumber AS ordnum,entrydate,budgetdate,
-                booksellerid,aqbasket.basketno
-        FROM    aqorderbreakdown,
-                aqbasket,
-                aqorders
-        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
-        WHERE   bookfundid=?
-            AND aqorders.ordernumber=aqorderbreakdown.ordernumber
-            AND aqorders.basketno=aqbasket.basketno
-            AND (budgetdate >= ? AND budgetdate < ?)
-            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
-    ";
-
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $id, $start, $end );
-
-    my $comtd;
-
-    my $total = 0;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        my $left = $data->{'tleft'};
-        if ( !$left || $left eq '' ) {
-            $left = $data->{'quantity'};
-        }
-        if ( $left && $left > 0 ) {
-            my $subtotal = $left * $data->{'ecost'};
-            $data->{subtotal} = $subtotal;
-            $data->{'left'} = $left;
-            $comtd += $subtotal;
-        }
-    }
-
-    $sth->finish;
-    return ( $spent, $comtd );
-}
-
-=head3 NewBookFund
-
-=over 4
-
-&NewBookFund(bookfundid, bookfundname, branchcode);
-
-this function create a new bookfund into the database.
-
-=back
-
-=cut 
-
-sub NewBookFund{
-    my ($bookfundid, $bookfundname, $branchcode) = @_;
-    $branchcode = undef unless $branchcode;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        INSERT
-        INTO aqbookfund
-            (bookfundid, bookfundname, branchcode)
-        VALUES
-            (?, ?, ?)
-    ";
-    my $sth=$dbh->prepare($query);
-    $sth->execute($bookfundid,$bookfundname,$branchcode);
-}
-
-#-------------------------------------------------------------#
-
-=head3 ModBookFund
-
-=over 4
-
-&ModBookFund($bookfundname,$branchcode,$bookfundid);
-this function update the bookfundname and the branchcode on aqbookfund table
-on database.
-
-=back
-
-=cut
-
-sub ModBookFund {
-    my ($bookfundname,$branchcode,$bookfundid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        UPDATE aqbookfund
-        SET    bookfundname = ?,
-               branchcode = ?
-        WHERE  bookfundid = ?
-    ";
-    my $sth=$dbh->prepare($query);
-    $sth->execute($bookfundname,$branchcode,$bookfundid);
-# budgets depending on a bookfund must have the same branchcode
-# if the bookfund branchcode is set
-    if (defined $branchcode) {
-        $query = "
-            UPDATE aqbudget
-            SET branchcode = ?
-        ";
-        $sth=$dbh->prepare($query);
-        $sth->execute($branchcode);
-    }
-}
-
-#-------------------------------------------------------------#
-
-=head3 SearchBookFund
-
-=over 4
- at results = SearchBookFund(
-        $bookfundid,$filter,$filter_bookfundid,
-        $filter_bookfundname,$filter_branchcode);
-
-this function searchs among the bookfunds corresponding to our filtering rules.
-
-=back
-
-=cut
-
-sub SearchBookFund {
-    my $dbh = C4::Context->dbh;
-    my ($filter,
-        $filter_bookfundid,
-        $filter_bookfundname,
-        $filter_branchcode
-       ) = @_;
-
-    my @bindings;
-
-    my $query = "
-        SELECT  bookfundid,
-                bookfundname,
-                bookfundgroup,
-                branchcode
-        FROM aqbookfund
-        WHERE 1 = 1 ";
-
-    if ($filter) {
-        if ($filter_bookfundid) {
-            $query.= "AND bookfundid = ?";
-            push @bindings, $filter_bookfundid;
-        }
-        if ($filter_bookfundname) {
-            $query.= "AND bookfundname like ?";
-            push @bindings, '%'.$filter_bookfundname.'%';
-        }
-        if ($filter_branchcode) {
-            $query.= "AND branchcode = ?";
-            push @bindings, $filter_branchcode;
-        }
-    }
-    $query.= "ORDER BY bookfundid";
-
-    my $sth = $dbh->prepare($query);
-    $sth->execute(@bindings);
-    my @results;
-    while (my $row = $sth->fetchrow_hashref) {
-        push @results, $row;
-    }
-    return @results;
-}
-
-#-------------------------------------------------------------#
-
-=head3 ModCurrencies
-
-=over 4
-
-&ModCurrencies($currency, $newrate);
-
-Sets the exchange rate for C<$currency> to be C<$newrate>.
-
-=back
-
-=cut
-
-sub ModCurrencies {
-    my ( $currency, $rate ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        UPDATE currency
-        SET    rate=?
-        WHERE  currency=?
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $rate, $currency );
-}
-
-#-------------------------------------------------------------#
-
-=head3 Countbookfund
-
-=over 4
-
-$number = Countbookfund($bookfundid);
-
-this function count the number of bookfund with id given on input arg.
-return :
-the result of the SQL query as a number.
-
-=back
-
-=cut
-
-sub Countbookfund {
-    my $bookfundid = shift;
-    my $dbh = C4::Context->dbh;
-    my $query ="
-        SELECT COUNT(*)
-        FROM   aqbookfund
-        WHERE bookfundid = ?
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($bookfundid);
-    return $sth->fetchrow;
-}
-
-
-#-------------------------------------------------------------#
-
-=head3 ConvertCurrency
-
-=over 4
-
-$foreignprice = &ConvertCurrency($currency, $localprice);
-
-Converts the price C<$localprice> to foreign currency C<$currency> by
-dividing by the exchange rate, and returns the result.
-
-If no exchange rate is found, C<&ConvertCurrency> assumes the rate is one
-to one.
-
-=back
-
-=cut
-
-sub ConvertCurrency {
-    my ( $currency, $price ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        SELECT rate
-        FROM   currency
-        WHERE  currency=?
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($currency);
-    my $cur = ( $sth->fetchrow_array() )[0];
-    if ( $cur == 0 ) {
-        $cur = 1;
-    }
-    return ( $price / $cur );
-}
-
-#-------------------------------------------------------------#
-
-=head3 DelBookFund
-
-=over 4
-
-&DelBookFund($bookfundid);
-this function delete a bookfund which has $bokfundid as parameter on aqbookfund table and delete the approriate budget.
-
-=back
-
-=cut
-
-sub DelBookFund {
-    my $bookfundid = shift;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        DELETE FROM aqbookfund
-        WHERE bookfundid=?
-    ";
-    my $sth=$dbh->prepare($query);
-    $sth->execute($bookfundid);
-    $sth->finish;
-    $query = "
-        DELETE FROM aqbudget where bookfundid=?
-    ";
-    $sth=$dbh->prepare($query);
-    $sth->execute($bookfundid);
-    $sth->finish;
-}
-
-
-1;
-
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Bookseller.pm
===================================================================
RCS file: modules/C4/Bookseller.pm
diff -N modules/C4/Bookseller.pm
--- modules/C4/Bookseller.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,275 +0,0 @@
-package C4::Bookseller;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Bookseller.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-use strict;
-require Exporter;
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
-
- at ISA    = qw(Exporter);
- at EXPORT = qw(
-    &GetBookSeller &GetBooksellersWithLateOrders
-    &ModBookseller
-    &AddBookseller
-);
-
-
-=head1 NAME
-
-C4::Bookseller - Koha functions for dealing with booksellers.
-
-=head1 SYNOPSIS
-
-use C4::Bookseller;
-
-=head1 DESCRIPTION
-
-The functions in this module deal with booksellers. They allow to
-add a new bookseller, to modify it or to get some informations around
-a bookseller.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
-#-------------------------------------------------------------------#
-
-=head3 GetBookSeller
-
-=over 4
-
- at results = &GetBookSeller($searchstring);
-
-Looks up a book seller. C<$searchstring> may be either a book seller
-ID, or a string to look for in the book seller's name.
-
-C<@results> is an array of references-to-hash, whose keys are the fields of of the
-aqbooksellers table in the Koha database.
-
-=back
-
-=cut
-
-sub GetBookSeller {
-    my ($searchstring) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        SELECT *
-        FROM   aqbooksellers
-        WHERE  name LIKE ? OR id = ?
-    ";
-    my $sth =$dbh->prepare($query);
-    $sth->execute("$searchstring%", $searchstring );
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push( @results, $data );
-    }
-    $sth->finish;
-    return  @results ;
-}
-
-
-#-----------------------------------------------------------------#
-
-=head3 GetBooksellersWithLateOrders
-
-=over 4
-
-%results = &GetBooksellersWithLateOrders;
-
-Searches for suppliers with late orders.
-
-=back
-
-=cut
-
-sub GetBooksellersWithLateOrders {
-    my $delay = shift;
-    my $dbh   = C4::Context->dbh;
-
-# FIXME NOT quite sure that this operation is valid for DBMs different from Mysql, HOPING so
-# should be tested with other DBMs
-
-    my $strsth;
-    my $dbdriver = C4::Context->config("db_scheme") || "mysql";
-    if ( $dbdriver eq "mysql" ) {
-        $strsth = "
-            SELECT DISTINCT aqbasket.booksellerid, aqbooksellers.name
-            FROM aqorders, aqbasket
-            LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id
-            WHERE aqorders.basketno = aqbasket.basketno
-                AND (closedate < DATE_SUB(CURDATE( ),INTERVAL $delay DAY)
-                AND (datereceived = '' OR datereceived IS NULL))
-        ";
-    }
-    else {
-        $strsth = "
-            SELECT DISTINCT aqbasket.booksellerid, aqbooksellers.name
-            FROM aqorders, aqbasket
-            LEFT JOIN aqbooksellers ON aqbasket.aqbooksellerid = aqbooksellers.id
-            WHERE aqorders.basketno = aqbasket.basketno
-                AND (closedate < (CURDATE( )-(INTERVAL $delay DAY)))
-                AND (datereceived = '' OR datereceived IS NULL))
-        ";
-    }
-
-    my $sth = $dbh->prepare($strsth);
-    $sth->execute;
-    my %supplierlist;
-    while ( my ( $id, $name ) = $sth->fetchrow ) {
-        $supplierlist{$id} = $name;
-    }
-
-    return %supplierlist;
-}
-
-#--------------------------------------------------------------------#
-
-=head3 AddBookseller
-
-=over 4
-
-$id = &AddBookseller($bookseller);
-
-Creates a new bookseller. C<$bookseller> is a reference-to-hash whose
-keys are the fields of the aqbooksellers table in the Koha database.
-All fields must be present.
-
-Returns the ID of the newly-created bookseller.
-
-=back
-
-=cut
-
-sub AddBookseller {
-    my ($data) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-        INSERT INTO aqbooksellers
-            (
-                name,      address1,      address2,   address3,      address4,
-                postal,    phone,         fax,        url,           contact,
-                contpos,   contphone,     contfax,    contaltphone,  contemail,
-                contnotes, active,        listprice,  invoiceprice,  gstreg,
-                listincgst,invoiceincgst, specialty,  discount,      invoicedisc,
-                nocalc,    notes
-            )
-        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute(
-        $data->{'name'},         $data->{'address1'},
-        $data->{'address2'},     $data->{'address3'},
-        $data->{'address4'},     $data->{'postal'},
-        $data->{'phone'},        $data->{'fax'},
-        $data->{'url'},          $data->{'contact'},
-        $data->{'contpos'},      $data->{'contphone'},
-        $data->{'contfax'},      $data->{'contaltphone'},
-        $data->{'contemail'},    $data->{'contnotes'},
-        $data->{'active'},       $data->{'listprice'},
-        $data->{'invoiceprice'}, $data->{'gstreg'},
-        $data->{'listincgst'},   $data->{'invoiceincgst'},
-        $data->{'specialty'},    $data->{'discount'},
-        $data->{'invoicedisc'},  $data->{'nocalc'},
-        $data->{'notes'}
-    );
-
-    # return the id of this new supplier
-    my $query = "
-        SELECT max(id)
-        FROM   aqbooksellers
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute;
-    return scalar($sth->fetchrow);
-}
-
-#-----------------------------------------------------------------#
-
-=head3 ModSupplier
-
-=over 4
-
-&ModSupplier($bookseller);
-
-Updates the information for a given bookseller. C<$bookseller> is a
-reference-to-hash whose keys are the fields of the aqbooksellers table
-in the Koha database. It must contain entries for all of the fields.
-The entry to modify is determined by C<$bookseller-E<gt>{id}>.
-
-The easiest way to get all of the necessary fields is to look up a
-book seller with C<&booksellers>, modify what's necessary, then call
-C<&ModSupplier> with the result.
-
-=back
-
-=cut
-
-sub ModBookseller {
-    my ($data) = @_;
-    my $dbh    = C4::Context->dbh;
-    my $query = "
-        UPDATE aqbooksellers
-        SET name=?,address1=?,address2=?,address3=?,address4=?,
-            postal=?,phone=?,fax=?,url=?,contact=?,contpos=?,
-            contphone=?,contfax=?,contaltphone=?,contemail=?,
-            contnotes=?,active=?,listprice=?, invoiceprice=?,
-            gstreg=?, listincgst=?,invoiceincgst=?,
-            specialty=?,discount=?,invoicedisc=?,nocalc=?, notes=?
-        WHERE id=?
-    ";
-    my $sth    = $dbh->prepare($query);
-    $sth->execute(
-        $data->{'name'},         $data->{'address1'},
-        $data->{'address2'},     $data->{'address3'},
-        $data->{'address4'},     $data->{'postal'},
-        $data->{'phone'},        $data->{'fax'},
-        $data->{'url'},          $data->{'contact'},
-        $data->{'contpos'},      $data->{'contphone'},
-        $data->{'contfax'},      $data->{'contaltphone'},
-        $data->{'contemail'},    $data->{'contnotes'},
-        $data->{'active'},       $data->{'listprice'},
-        $data->{'invoiceprice'}, $data->{'gstreg'},
-        $data->{'listincgst'},   $data->{'invoiceincgst'},
-        $data->{'specialty'},    $data->{'discount'},
-        $data->{'invoicedisc'},  $data->{'nocalc'},
-        $data->{'notes'},        $data->{'id'}
-    );
-    $sth->finish;
-}
-
-
-
-1;
-
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Boolean.pm
===================================================================
RCS file: modules/C4/Boolean.pm
diff -N modules/C4/Boolean.pm
--- modules/C4/Boolean.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,122 +0,0 @@
-package C4::Boolean;
-
-# $Id: Boolean.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-#package to handle Boolean values in the parameters table
-# Note: This is just a utility module; it should not be instantiated.
-
-
-# Copyright 2003 Katipo Communications
-#
-# 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 strict;
-use POSIX;
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Boolean - Convenience functions to handle boolean values
-in the parameter table
-
-=head1 SYNOPSIS
-
-  use C4::Boolean;
-
-=head1 DESCRIPTION
-
-In the parameter table, there are various Boolean values that
-variously require a 0/1, no/yes, false/true, or off/on values.
-This module aims to provide scripts a means to interpret these
-Boolean values in a consistent way which makes common sense.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = (
-	&INVALID_BOOLEAN_STRING_EXCEPTION
-    );
-
- at EXPORT_OK = qw(
-	true_p
-    );
-
-sub INVALID_BOOLEAN_STRING_EXCEPTION ()
-    { 'The given value does not seem to be interpretable as a Boolean value' }
-
-use vars qw( %strings );
-
-%strings = (
-   '0'     => 0,	'1'     => 1,	# C
-   			'-1'    => 1,	# BASIC
-   'nil'   => 0,	't'     => 1,	# LISP
-   'false' => 0,	'true'  => 1,	# Pascal
-   'off'   => 0,	'on'    => 1,
-   'no'    => 0,	'yes'   => 1,
-   'n'     => 0,	'y'     => 1,
-);
-
-=item true_p
-
-    if ( C4::Boolean::true_p(C4::Context->preference("insecure")) ) {
-	...
-    }
-
-Tries to interpret the passed string as a Boolean value. Returns
-the value if the string can be interpreted as such; otherwise an
-exception is thrown.
-
-=cut
-
-sub true_p ($) {
-    my($x) = @_;
-    my $it;
-    if (!defined $x || ref($x) ne '') {
-	die INVALID_BOOLEAN_STRING_EXCEPTION;
-    }
-    $x = lc($x);
-    $x =~ s/\s//g;
-    if (defined $strings{$x}) {
-	$it = $strings{$x};
-    } else {
-	die INVALID_BOOLEAN_STRING_EXCEPTION;
-    }
-    return $it;
-}
-
-
-#---------------------------------
-
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Breeding.pm
===================================================================
RCS file: modules/C4/Breeding.pm
diff -N modules/C4/Breeding.pm
--- modules/C4/Breeding.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,200 +0,0 @@
-package C4::Breeding;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-use C4::Biblio;
-use C4::Search;
-use MARC::File::USMARC;
-use MARC::Record;
-use Encode;
-require Exporter;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Breeding : script to add a biblio in marc_breeding table.
-
-=head1 SYNOPSIS
-	&ImportBreeding($marcrecords,$overwrite_biblio,$filename,$z3950random);
-
-	C<$marcrecord> => the MARC::Record
-	C<$overwrite_biblio> => if set to 1 a biblio with the same ISBN will be overwritted.
-  								if set to 0 a biblio with the same isbn will be ignored (the previous will be kept)
-								if set to -1 the biblio will be added anyway (more than 1 biblio with the same ISBN possible in the breeding
-	C<$encoding> => USMARC
-						or UNIMARC. used for char_decoding.
-						If not present, the parameter marcflavour is used instead
-	C<$z3950random> => the random value created during a z3950 search result.
-
-=head1 DESCRIPTION
-
-This is for depository of records coming from z3950 or directly imported.
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&ImportBreeding &BreedingSearch);
-
-sub  ImportBreeding {
-	my ($marcrecords,$overwrite_biblio,$filename,$encoding,$z3950random) = @_;
-## use marc:batch send them in one by one
-#	my @marcarray = split /\x1D/, $marcrecords;
-	my $dbh = C4::Context->dbh;
-my @kohafields;
-my @values;
-my @relations;
-my $sort;
-my @and_or;
-my @results;
-my $count;
-	my $searchbreeding = $dbh->prepare("select id from marc_breeding where isbn=? and title=?");
-	my $insertsql = $dbh->prepare("insert into marc_breeding (file,isbn,title,author,marc,encoding,z3950random,classification,subclass) values(?,?,?,?,?,?,?,?,?)");
-	my $replacesql = $dbh->prepare("update marc_breeding set file=?,isbn=?,title=?,author=?,marc=?,encoding=?,z3950random=?,classification=?,subclass=? where id=?");
-	$encoding = C4::Context->preference("marcflavour") unless $encoding;
-	# fields used for import results
-	my $imported=0;
-	my $alreadyindb = 0;
-	my $alreadyinfarm = 0;
-	my $notmarcrecord = 0;
-	my $breedingid;
-#	for (my $i=0;$i<=$#marcarray;$i++) {
-		my $marcrecord = MARC::File::USMARC::decode($marcrecords);
-		my $marcxml=$marcrecord->as_xml_record($marcrecord);
-		$marcxml=Encode::encode('utf8',$marcxml);
-		my @warnings = $marcrecord->warnings();
-		if (scalar($marcrecord->fields()) == 0) {
-			$notmarcrecord++;
-		} else {
-			my $xmlhash=XML_xml2hash_onerecord($marcxml);	
-			my $oldbiblio = XMLmarc2koha_onerecord($dbh,$xmlhash,'biblios');
-			# if isbn found and biblio does not exist, add it. If isbn found and biblio exists, overwrite or ignore depending on user choice
-			# drop every "special" char : spaces, - ...
-			$oldbiblio->{isbn} =~ s/ |-|\.//g,
-			$oldbiblio->{isbn} = substr($oldbiblio->{isbn},0,10);
-			$oldbiblio->{issn} =~ s/ |-|\.//g,
-			$oldbiblio->{issn} = substr($oldbiblio->{issn},0,10);
-			# search if biblio exists
-			my $biblioitemnumber;
-			my $facets;
-		    if ( !$z3950random){
-			if ($oldbiblio->{isbn}) {
-			push @kohafields,"isbn";
-			push @values,$oldbiblio->{isbn};
-			push @relations,"";
-			push @and_or,"";
-			
-			($count,$facets, at results)=ZEBRAsearch_kohafields(\@kohafields,\@values,\@relations);
-			} else {
-			push @kohafields,"issn";
-			push @values,$oldbiblio->{issn};
-			push @relations,"";
-			push @and_or,"";
-			$sort="";
-			($count,$facets, at results)=ZEBRAsearch_kohafields(\@kohafields,\@values,\@relations);
-			}
-	    	     }
-			if ($count>0 && !$z3950random) {
-				$alreadyindb++;
-			} else {
-				# search in breeding farm
-				
-				if ($oldbiblio->{isbn}) {
-					$searchbreeding->execute($oldbiblio->{isbn},$oldbiblio->{title});
-					($breedingid) = $searchbreeding->fetchrow;
-				} elsif ($oldbiblio->{issn}){
-					$searchbreeding->execute($oldbiblio->{issn},$oldbiblio->{title});
-					($breedingid) = $searchbreeding->fetchrow;
-				}
-				if ($breedingid && $overwrite_biblio eq 0) {
-					$alreadyinfarm++;
-				} else {
-					my $recoded=MARC::Record->new_from_xml($marcxml,"UTF-8");
-					$recoded->encoding('UTF-8');
-					
-					if ($breedingid && $overwrite_biblio eq 1) {
-						$replacesql ->execute($filename,substr($oldbiblio->{isbn}.$oldbiblio->{issn},0,10),$oldbiblio->{title},$oldbiblio->{author},$recoded->as_usmarc,$encoding,$z3950random,$oldbiblio->{classification},$oldbiblio->{subclass},$breedingid);
-					} else {
-						$insertsql ->execute($filename,substr($oldbiblio->{isbn}.$oldbiblio->{issn},0,10),$oldbiblio->{title},$oldbiblio->{author},$recoded->as_usmarc,$encoding,$z3950random,$oldbiblio->{classification},$oldbiblio->{subclass});
-					
-					$breedingid=$dbh->{'mysql_insertid'};
-					}
-					$imported++;
-				}
-			}
-		}
-	#}
-	return ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$breedingid);
-}
-
-
-=item BreedingSearch
-
-  ($count, @results) = &BreedingSearch($title,$isbn,$random);
-C<$title> contains the title,
-C<$isbn> contains isbn or issn,
-C<$random> contains the random seed from a z3950 search.
-
-C<$count> is the number of items in C<@results>. C<@results> is an
-array of references-to-hash; the keys are the items from the C<marc_breeding> table of the Koha database.
-
-=cut
-
-sub BreedingSearch {
-	my ($title,$isbn,$z3950random) = @_;
-	my $dbh   = C4::Context->dbh;
-	my $count = 0;
-	my ($query, at bind);
-	my $sth;
-	my @results;
-
-	$query = "Select id,file,isbn,title,author,classification,subclass from marc_breeding where ";
-	if ($z3950random) {
-		$query .= "z3950random = ?";
-		@bind=($z3950random);
-	} else {
-	    @bind=();
-		if ($title) {
-			$query .= "title like ?";
-			push(@bind,"$title%");
-		}
-		if ($title && $isbn) {
-			$query .= " and ";
-		}
-		if ($isbn) {
-			$query .= "isbn like ?";
-			push(@bind,"$isbn%");
-		}
-	}
-	$sth   = $dbh->prepare($query);
-	$sth->execute(@bind);
-	while (my $data = $sth->fetchrow_hashref) {
-			$results[$count] = $data;
-			$count++;
-	} # while
-
-	$sth->finish;
-	return($count, @results);
-} # sub breedingsearch
-
-
-1;
-__END__
\ No newline at end of file

Index: modules/C4/Context.pm
===================================================================
RCS file: modules/C4/Context.pm
diff -N modules/C4/Context.pm
--- modules/C4/Context.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,952 +0,0 @@
-# Copyright 2002 Katipo Communications
-#
-# 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
-
-# $Id: Context.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-package C4::Context;
-use strict;
-use DBI;
-use CGI;
-use C4::Boolean;
-use XML::Simple;
-require Exporter;
-use vars qw($VERSION $AUTOLOAD),
-	qw($context),
-	qw(@context_stack);
-
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g;
-		shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
-
-=head1 NAME
-
-C4::Context - Maintain and manipulate the context of a Koha script
-
-=head1 SYNOPSIS
-
-  use C4::Context;
-
-  use C4::Context("/path/to/koha.xml");
-
-  $config_value = C4::Context->config("config_variable");
-  $db_handle = C4::Context->dbh;
-  $stopwordhash = C4::Context->stopwords;
-
-=head1 DESCRIPTION
-
-When a Koha script runs, it makes use of a certain number of things:
-configuration settings in F</etc/koha.xml>, a connection to the Koha
-databases, and so forth. These things make up the I<context> in which
-the script runs.
-
-This module takes care of setting up the context for a script:
-figuring out which configuration file to load, and loading it, opening
-a connection to the right database, and so forth.
-
-Most scripts will only use one context. They can simply have
-
-  use C4::Context;
-
-at the top.
-
-Other scripts may need to use several contexts. For instance, if a
-library has two databases, one for a certain collection, and the other
-for everything else, it might be necessary for a script to use two
-different contexts to search both databases. Such scripts should use
-the C<&set_context> and C<&restore_context> functions, below.
-
-By default, C4::Context reads the configuration from
-F</etc/koha.xml>. This may be overridden by setting the C<$KOHA_CONF>
-environment variable to the pathname of a configuration file to use.
-
-=head1 METHODS
-
-=over 2
-
-=cut
-
-#'
-# In addition to what is said in the POD above, a Context object is a
-# reference-to-hash with the following fields:
-#
-# config
-#	A reference-to-hash whose keys and values are the
-#	configuration variables and values specified in the config
-#	file (/etc/koha.xml).
-# dbh
-#	A handle to the appropriate database for this context.
-# dbh_stack
-#	Used by &set_dbh and &restore_dbh to hold other database
-#	handles for this context.
-# Zconn
-# 	A connection object for the Zebra server
-
-use constant CONFIG_FNAME => "/etc/koha.xml";
-				# Default config file, if none is specified
-
-#$context = undef;		# Initially, no context is set
- at context_stack = ();		# Initially, no saved contexts
-
-# read_config_file
-# Reads the specified Koha config file. Returns a reference-to-hash
-# whose keys are the configuration variables, and whose values are the
-# configuration values (duh).
-# Returns undef in case of error.
-#
-# Revision History:
-# 2004-08-10 A. Tarallo: Added code that checks if a variable is already
-# assigned and prints a message, otherwise create a new entry in the hash to
-# be returned. 
-# Also added code that complaints if finds a line that isn't a variable 
-# assignmet and skips the line.
-# Added a quick hack that makes the translation between the db_schema
-# and the DBI driver for that schema.
-#
-sub read_config_file
-{
-	my $fname = shift;	# Config file to read
-
-	my $retval = {};	# Return value: ref-to-hash holding the
-				# configuration
-
-my $koha = XMLin($fname, keyattr => ['id'],forcearray => ['listen']);
-
-	return $koha;
-}
-
-# db_scheme2dbi
-# Translates the full text name of a database into de appropiate dbi name
-# 
-sub db_scheme2dbi
-{
-	my $name = shift;
-
-	for ($name) {
-# FIXME - Should have other databases. 
-		if (/mysql/i) { return("mysql"); }
-		if (/Postgres|Pg|PostgresSQL/) { return("Pg"); }
-		if (/oracle/i) { return("Oracle"); }
-	}
-	return undef; 		# Just in case
-}
-
-sub import
-{
-	my $package = shift;
-	my $conf_fname = shift;		# Config file name
-	my $context;
-
-	# Create a new context from the given config file name, if
-	# any, then set it as the current context.
-	$context = new C4::Context($conf_fname);
-	return undef if !defined($context);
-	$context->set_context;
-}
-
-=item new
-
-  $context = new C4::Context;
-  $context = new C4::Context("/path/to/koha.xml");
-
-Allocates a new context. Initializes the context from the specified
-file, which defaults to either the file given by the C<$KOHA_CONF>
-environment variable, or F</etc/koha.xml>.
-
-C<&new> does not set this context as the new default context; for
-that, use C<&set_context>.
-
-=cut
-
-#'
-# Revision History:
-# 2004-08-10 A. Tarallo: Added check if the conf file is not empty
-sub new
-{
-	my $class = shift;
-	my $conf_fname = shift;		# Config file to load
-	my $self = {};
-
-	# check that the specified config file exists and is not empty
-	undef $conf_fname unless 
-	    (defined $conf_fname && -e $conf_fname && -s $conf_fname);
-	# Figure out a good config file to load if none was specified.
-	if (!defined($conf_fname))
-	{
-		# If the $KOHA_CONF environment variable is set, use
-		# that. Otherwise, use the built-in default.
-		$conf_fname = $ENV{"KOHA_CONF"} || CONFIG_FNAME;
-	}
-		# Load the desired config file.
-	$self = read_config_file($conf_fname);
-	$self->{"config_file"} = $conf_fname;
-
-
-	
-	warn "read_config_file($conf_fname) returned undef" if !defined($self->{"config"});
-	return undef if !defined($self->{"config"});
-
-	$self->{"dbh"} = undef;		# Database handle
-	$self->{"mcgi"} = undef;		# CGI handle
-	$self->{"Zconn"} = undef;	# Zebra Connection
-	$self->{"Zconnauth"} = undef;	# Zebra Connection for updating
-	$self->{"stopwords"} = undef; # stopwords list
-	$self->{"marcfromkohafield"} = undef; # the hash with relations between koha table fields and MARC field/subfield
-	$self->{"attrfromkohafield"} = undef; # the hash with relations between koha table fields and Bib1-attributes
-	$self->{"userenv"} = undef;		# User env
-	$self->{"activeuser"} = undef;		# current active user
-
-	bless $self, $class;
-	return $self;
-}
-
-=item set_context
-
-  $context = new C4::Context;
-  $context->set_context();
-or
-  set_context C4::Context $context;
-
-  ...
-  restore_context C4::Context;
-
-In some cases, it might be necessary for a script to use multiple
-contexts. C<&set_context> saves the current context on a stack, then
-sets the context to C<$context>, which will be used in future
-operations. To restore the previous context, use C<&restore_context>.
-
-=cut
-
-#'
-sub set_context
-{
-	my $self = shift;
-	my $new_context;	# The context to set
-
-	# Figure out whether this is a class or instance method call.
-	#
-	# We're going to make the assumption that control got here
-	# through valid means, i.e., that the caller used an instance
-	# or class method call, and that control got here through the
-	# usual inheritance mechanisms. The caller can, of course,
-	# break this assumption by playing silly buggers, but that's
-	# harder to do than doing it properly, and harder to check
-	# for.
-	if (ref($self) eq "")
-	{
-		# Class method. The new context is the next argument.
-		$new_context = shift;
-	} else {
-		# Instance method. The new context is $self.
-		$new_context = $self;
-	}
-
-	# Save the old context, if any, on the stack
-	push @context_stack, $context if defined($context);
-
-	# Set the new context
-	$context = $new_context;
-}
-
-=item restore_context
-
-  &restore_context;
-
-Restores the context set by C<&set_context>.
-
-=cut
-
-#'
-sub restore_context
-{
-	my $self = shift;
-
-	if ($#context_stack < 0)
-	{
-		# Stack underflow.
-		die "Context stack underflow";
-	}
-
-	# Pop the old context and set it.
-	$context = pop @context_stack;
-
-	# FIXME - Should this return something, like maybe the context
-	# that was current when this was called?
-}
-
-=item config
-
-  $value = C4::Context->config("config_variable");
-
-  $value = C4::Context->config_variable;
-
-Returns the value of a variable specified in the configuration file
-from which the current context was created.
-
-The second form is more compact, but of course may conflict with
-method names. If there is a configuration variable called "new", then
-C<C4::Config-E<gt>new> will not return it.
-
-=cut
-
-#'
-sub config
-{
-	my $self = shift;
-	my $var = shift;		# The config variable to return
-
-	return undef if !defined($context->{"config"});
-			# Presumably $self->{config} might be
-			# undefined if the config file given to &new
-			# didn't exist, and the caller didn't bother
-			# to check the return value.
-
-	# Return the value of the requested config variable
-	return $context->{"config"}->{$var};
-}
-=item zebraconfig
-$serverdir=C4::Context->zebraconfig("biblioserver")->{directory};
-
-returns the zebra server specific details for different zebra servers
-similar to C4:Context->config
-=cut
-
-sub zebraconfig
-{
-	my $self = shift;
-	my $var = shift;		# The config variable to return
-
-	return undef if !defined($context->{"server"});
-	# Return the value of the requested config variable
-	return $context->{"server"}->{$var};
-}
-=item preference
-
-  $sys_preference = C4::Context->preference("some_variable");
-
-Looks up the value of the given system preference in the
-systempreferences table of the Koha database, and returns it. If the
-variable is not set, or in case of error, returns the undefined value.
-
-=cut
-
-#'
-# FIXME - The preferences aren't likely to change over the lifetime of
-# the script (and things might break if they did change), so perhaps
-# this function should cache the results it finds.
-sub preference
-{
-	my $self = shift;
-	my $var = shift;		# The system preference to return
-	my $retval;			# Return value
-	my $dbh = C4::Context->dbh;	# Database handle
-	my $sth;			# Database query handle
-
-	# Look up systempreferences.variable==$var
-	$retval = $dbh->selectrow_array(<<EOT);
-		SELECT	value
-		FROM	systempreferences
-		WHERE	variable='$var'
-		LIMIT	1
-EOT
-	return $retval;
-}
-
-sub boolean_preference ($) {
-	my $self = shift;
-	my $var = shift;		# The system preference to return
-	my $it = preference($self, $var);
-	return defined($it)? C4::Boolean::true_p($it): undef;
-}
-
-# AUTOLOAD
-# This implements C4::Config->foo, and simply returns
-# C4::Context->config("foo"), as described in the documentation for
-# &config, above.
-
-# FIXME - Perhaps this should be extended to check &config first, and
-# then &preference if that fails. OTOH, AUTOLOAD could lead to crappy
-# code, so it'd probably be best to delete it altogether so as not to
-# encourage people to use it.
-sub AUTOLOAD
-{
-	my $self = shift;
-
-	$AUTOLOAD =~ s/.*:://;		# Chop off the package name,
-					# leaving only the function name.
-	return $self->config($AUTOLOAD);
-}
-
-=item Zconn
-
-$Zconn = C4::Context->Zconn
-$Zconnauth = C4::Context->Zconnauth
-Returns a connection to the Zebra database for the current
-context. If no connection has yet been made, this method 
-creates one and connects.
-
-=cut
-
-sub Zconn {
-        my $self = shift;
-my $server=shift;
-my $syntax=shift;
-#	  if ( defined($context->{"Zconn"}->{$server}) ) {
-#        return $context->{"Zconn"}->{$server};
-
-    # No connection object or it died. Create one.
-#    } else { 
-	$context->{"Zconn"} = &new_Zconn($server,$syntax);
-	return $context->{"Zconn"};
-#  }
-}
-
-sub Zconnauth {
-        my $self = shift;
-my $server=shift;
-my $syntax=shift;
-	my $Zconnauth;
-##We destroy each connection made so create a new one	
-		$context->{"Zconnauth"} = &new_Zconnauth($server,$syntax);
-		return $context->{"Zconnauth"};
-		
-}
-
-
-
-=item new_Zconn
-
-Internal helper function. creates a new database connection from
-the data given in the current context and returns it.
-
-=cut
-
-sub new_Zconn {
-use ZOOM;
-my $server=shift;
-my $syntax=shift;
-$syntax="xml" unless $syntax;
-my $Zconn;
-my ($tcp,$host,$port)=split /:/,$context->{"listen"}->{$server}->{"content"};
-my $o = new ZOOM::Options();
-$o->option(async => 1);
-$o->option(preferredRecordSyntax => $syntax); ## in case we use MARC
-$o->option(databaseName=>$context->{"config"}->{$server});
-
-my $o2= new ZOOM::Options();
-
- $Zconn=create ZOOM::Connection($o);
-	$Zconn->connect($host,$port);
-	
-	return $Zconn;
-}
-
-## Zebra handler with write permission
-sub new_Zconnauth {
-use ZOOM;
-my $server=shift;
-my $syntax=shift;
-$syntax="xml" unless $syntax;
-my $Zconnauth;
-my ($tcp,$host,$port)=split /:/,$context->{"listen"}->{$server}->{"content"};
-my $o = new ZOOM::Options();
-#$o->option(async => 1);
-$o->option(preferredRecordSyntax => $syntax);
-$o->option(user=>$context->{"config"}->{"zebrauser"});
-$o->option(password=>$context->{"config"}->{"zebrapass"});
-$o->option(databaseName=>$context->{"config"}->{$server});
- $o->option(charset=>"UTF8");
- $Zconnauth=create ZOOM::Connection($o);
-$Zconnauth->connect($host,$port);
-return $Zconnauth;
-}
-
-## cgi handler
-sub mcgi {
-        my $self = shift;
-	  if (defined($context->{"mcgi"})) {
-        return $context->{"mcgi"};
-    # No connection object or it died. Create one.
-    } else { 
-
-	$context->{"mcgi"} = &_new_cgi();
-	return $context->{"mcgi"};
-  }
-}
-## _new_cgi  creates a CGI handle
-
-sub _new_cgi{
-my $cgi=CGI->new();
-return $cgi;
-}
-
-# _new_dbh
-# Internal helper function (not a method!). This creates a new
-# database connection from the data given in the current context, and
-# returns it.
-sub _new_dbh
-{
-	##correct name for db_schme		
-	my $db_driver;
-	if ($context->config("db_scheme")){
-	$db_driver=db_scheme2dbi($context->config("db_scheme"));
-	}else{
-	$db_driver="mysql";
-	}
-
-	my $db_name   = $context->config("database");
-	my $db_host   = $context->config("hostname");
-	my $db_user   = $context->config("user");
-	my $db_passwd = $context->config("pass");
-	my $dbh= DBI->connect("DBI:$db_driver:$db_name:$db_host",
-			    $db_user, $db_passwd);
-	# Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config.
-	$dbh->do("set NAMES 'utf8'");
-	
-
-	return $dbh;
-}
-
-=item dbh
-
-  $dbh = C4::Context->dbh;
-
-Returns a database handle connected to the Koha database for the
-current context. If no connection has yet been made, this method
-creates one, and connects to the database.
-
-This database handle is cached for future use: if you call
-C<C4::Context-E<gt>dbh> twice, you will get the same handle both
-times. If you need a second database handle, use C<&new_dbh> and
-possibly C<&set_dbh>.
-
-=cut
-
-#'
-sub dbh
-{
-	my $self = shift;
-	if (defined($context->{"dbh"}) && !$ENV{MOD_PERL}) {
-	 my   $sth=$context->{"dbh"}->prepare("select 1");
-	    return $context->{"dbh"} if (defined($sth->execute));
-	}
-	$context->{"dbh"} = &_new_dbh();
-	return $context->{"dbh"};
-}
-
-=item new_dbh
-
-  $dbh = C4::Context->new_dbh;
-
-Creates a new connection to the Koha database for the current context,
-and returns the database handle (a C<DBI::db> object).
-
-The handle is not saved anywhere: this method is strictly a
-convenience function; the point is that it knows which database to
-connect to so that the caller doesn't have to know.
-
-=cut
-
-#'
-sub new_dbh
-{
-	my $self = shift;
-
-	return &_new_dbh();
-}
-
-=item set_dbh
-
-  $my_dbh = C4::Connect->new_dbh;
-  C4::Connect->set_dbh($my_dbh);
-  ...
-  C4::Connect->restore_dbh;
-
-C<&set_dbh> and C<&restore_dbh> work in a manner analogous to
-C<&set_context> and C<&restore_context>.
-
-C<&set_dbh> saves the current database handle on a stack, then sets
-the current database handle to C<$my_dbh>.
-
-C<$my_dbh> is assumed to be a good database handle.
-
-=cut
-
-#'
-sub set_dbh
-{
-	my $self = shift;
-	my $new_dbh = shift;
-
-	# Save the current database handle on the handle stack.
-	# We assume that $new_dbh is all good: if the caller wants to
-	# screw himself by passing an invalid handle, that's fine by
-	# us.
-	push @{$context->{"dbh_stack"}}, $context->{"dbh"};
-	$context->{"dbh"} = $new_dbh;
-}
-
-=item restore_dbh
-
-  C4::Context->restore_dbh;
-
-Restores the database handle saved by an earlier call to
-C<C4::Context-E<gt>set_dbh>.
-
-=cut
-
-#'
-sub restore_dbh
-{
-	my $self = shift;
-
-	if ($#{$context->{"dbh_stack"}} < 0)
-	{
-		# Stack underflow
-		die "DBH stack underflow";
-	}
-
-	# Pop the old database handle and set it.
-	$context->{"dbh"} = pop @{$context->{"dbh_stack"}};
-
-	# FIXME - If it is determined that restore_context should
-	# return something, then this function should, too.
-}
-
-=item marcfromkohafield
-
-  $dbh = C4::Context->marcfromkohafield;
-
-Returns a hash with marcfromkohafield.
-
-This hash is cached for future use: if you call
-C<C4::Context-E<gt>marcfromkohafield> twice, you will get the same hash without real DB access
-
-=cut
-
-#'
-sub marcfromkohafield
-{
-	my $retval = {};
-
-	# If the hash already exists, return it.
-	return $context->{"marcfromkohafield"} if defined($context->{"marcfromkohafield"});
-
-	# No hash. Create one.
-	$context->{"marcfromkohafield"} = &_new_marcfromkohafield();
-
-	return $context->{"marcfromkohafield"};
-}
-
-
-# _new_marcfromkohafield
-# Internal helper function (not a method!). 
-sub _new_marcfromkohafield
-{
-	my $dbh = C4::Context->dbh;
-	my $marcfromkohafield;
-	my $sth = $dbh->prepare("select kohafield,tagfield,tagsubfield,recordtype from koha_attr where tagfield is not null  ");
-	$sth->execute;
-	while (my ($kohafield,$tagfield,$tagsubfield,$recordtype) = $sth->fetchrow) {
-		my $retval = {};
-		$marcfromkohafield->{$recordtype}->{$kohafield} = [$tagfield,$tagsubfield];
-	}
-	
-	return $marcfromkohafield;
-}
-
-
-#item attrfromkohafield
-#To use as a hash of koha to z3950 attributes
-sub _new_attrfromkohafield
-{
-	my $dbh = C4::Context->dbh;
-	my $attrfromkohafield;
-	my $sth2 = $dbh->prepare("select kohafield,attr from koha_attr" );
-	$sth2->execute;
-	while (my ($kohafield,$attr) = $sth2->fetchrow) {
-		my $retval = {};
-		$attrfromkohafield->{$kohafield} = $attr;
-	}
-	return $attrfromkohafield;
-}
-sub attrfromkohafield
-{
-	my $retval = {};
-
-	# If the hash already exists, return it.
-	return $context->{"attrfromkohafield"} if defined($context->{"attrfromkohafield"});
-
-	# No hash. Create one.
-	$context->{"attrfromkohafield"} = &_new_attrfromkohafield();
-
-	return $context->{"attrfromkohafield"};
-}
-=item stopwords
-
-  $dbh = C4::Context->stopwords;
-
-Returns a hash with stopwords.
-
-This hash is cached for future use: if you call
-C<C4::Context-E<gt>stopwords> twice, you will get the same hash without real DB access
-
-=cut
-
-#'
-sub stopwords
-{
-	my $retval = {};
-
-	# If the hash already exists, return it.
-	return $context->{"stopwords"} if defined($context->{"stopwords"});
-
-	# No hash. Create one.
-	$context->{"stopwords"} = &_new_stopwords();
-
-	return $context->{"stopwords"};
-}
-
-# _new_stopwords
-# Internal helper function (not a method!). This creates a new
-# hash with stopwords
-sub _new_stopwords
-{
-	my $dbh = C4::Context->dbh;
-	my $stopwordlist;
-	my $sth = $dbh->prepare("select word from stopwords");
-	$sth->execute;
-	while (my $stopword = $sth->fetchrow_array) {
-		my $retval = {};
-		$stopwordlist->{$stopword} = uc($stopword);
-	}
-	$stopwordlist->{A} = "A" unless $stopwordlist;
-	return $stopwordlist;
-}
-
-=item userenv
-
-  C4::Context->userenv;
-
-Builds a hash for user environment variables.
-
-This hash shall be cached for future use: if you call
-C<C4::Context-E<gt>userenv> twice, you will get the same hash without real DB access
-
-set_userenv is called in Auth.pm
-
-=cut
-
-#'
-sub userenv
-{
-	my $var = $context->{"activeuser"};
-	return $context->{"userenv"}->{$var} if (defined $context->{"userenv"}->{$var});
-	return 0;
-	warn "NO CONTEXT for $var";
-}
-
-=item set_userenv
-
-  C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $userflags, $emailaddress);
-
-Informs a hash for user environment variables.
-
-This hash shall be cached for future use: if you call
-C<C4::Context-E<gt>userenv> twice, you will get the same hash without real DB access
-
-set_userenv is called in Auth.pm
-
-=cut
-#'
-sub set_userenv{
-	my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress,$branchprinter)= @_;
-	my $var=$context->{"activeuser"};
-	my $cell = {
-		"number"     => $usernum,
-		"id"         => $userid,
-		"cardnumber" => $usercnum,
-#		"firstname"  => $userfirstname,
-#		"surname"    => $usersurname,
-#possibly a law problem
-		"branch"     => $userbranch,
-		"branchname" => $branchname,
-		"flags"      => $userflags,
-		"emailaddress"	=> $emailaddress,
-		"branchprinter" => $branchprinter,
-	};
-	$context->{userenv}->{$var} = $cell;
-	return $cell;
-}
-
-=item _new_userenv
-
-  C4::Context->_new_userenv($session);
-
-Builds a hash for user environment variables.
-
-This hash shall be cached for future use: if you call
-C<C4::Context-E<gt>userenv> twice, you will get the same hash without real DB access
-
-_new_userenv is called in Auth.pm
-
-=cut
-
-#'
-sub _new_userenv
-{
-	shift;
-	my ($sessionID)= @_;
- 	$context->{"activeuser"}=$sessionID;
-}
-
-=item _unset_userenv
-
-  C4::Context->_unset_userenv;
-
-Destroys the hash for activeuser user environment variables.
-
-=cut
-#'
-
-sub _unset_userenv
-{
-	my ($sessionID)= @_;
-	undef $context->{"activeuser"} if ($context->{"activeuser"} eq $sessionID);
-}
-
-
-
-1;
-__END__
-
-=back
-
-=head1 ENVIRONMENT
-
-=over 4
-
-=item C<KOHA_CONF>
-
-Specifies the configuration file to read.
-
-=back
-
-=head1 SEE ALSO
-
-DBI(3)
-
-=head1 AUTHOR
-
-Andrew Arensburger <arensb at ooblick dot com>
-
-=cut
-# $Log: Context.pm,v $
-# Revision 1.1.2.1  2007/03/10 01:35:34  tgarip1957
-# fresh files for rel_TG
-#
-# Revision 1.50  2006/11/06 21:01:43  tgarip1957
-# Bug fixing and complete removal of Date::Manip
-#
-# Revision 1.49  2006/10/20 01:20:56  tgarip1957
-# A new Date.pm to use for all date calculations. Mysql date calculations removed from Circ2.pm, all modules free of DateManip, a new get_today function to call in allscripts, and some bug cleaning in authorities.pm
-#
-# Revision 1.48  2006/10/01 21:48:54  tgarip1957
-# Field weighting applied to ranked searches. A new facets table in mysql db
-#
-# Revision 1.47  2006/09/27 19:53:52  tgarip1957
-# Finalizing main components. All koha modules are now working with the new XML API
-#
-# Revision 1.46  2006/09/06 16:21:03  tgarip1957
-# Clean up before final commits
-#
-# Revision 1.43  2006/08/10 12:49:37  toins
-# sync with dev_week.
-#
-# Revision 1.42  2006/07/04 14:36:51  toins
-# Head & rel_2_2 merged
-#
-# Revision 1.41  2006/05/20 14:36:09  tgarip1957
-# Typo error. Missing '>'
-#
-# Revision 1.40  2006/05/20 14:28:02  tgarip1957
-# Adding support to read zebra database name from config files
-#
-# Revision 1.39  2006/05/19 09:52:54  alaurin
-# committing new feature ip and printer management
-# adding two fields in branches table (branchip,branchprinter)
-#
-# branchip : if the library enter an ip or ip range any librarian that connect from computer in this ip range will be temporarly affected to the corresponding branch .
-#
-# branchprinter : the library  can select a default printer for a branch
-#
-# Revision 1.38  2006/05/14 00:22:31  tgarip1957
-# Adding support for getting details of different zebra servers
-#
-# Revision 1.37  2006/05/13 19:51:39  tgarip1957
-# Now reads koha.xml rather than koha.conf.
-# koha.xml contains both the koha configuration and zebraserver configuration.
-# Zebra connection is modified to allow connection to authority zebra as well.
-# It will break head if koha.conf is not replaced with koha.xml
-#
-# Revision 1.36  2006/05/09 13:28:08  tipaul
-# adding the branchname and the librarian name in every page :
-# - modified userenv to add branchname
-# - modifier menus.inc to have the librarian name & userenv displayed on every page. they are in a librarian_information div.
-#
-# Revision 1.35  2006/04/13 08:40:11  plg
-# bug fixed: typo on Zconnauth name
-#
-# Revision 1.34  2006/04/10 21:40:23  tgarip1957
-# A new handler defined for zebra Zconnauth with read/write permission. Zconnauth should only be called in biblio.pm where write operations are. Use of this handler will break things unless koha.conf contains new variables:
-# zebradb=localhost
-# zebraport=<your port>
-# zebrauser=<username>
-# zebrapass=<password>
-#
-# The zebra.cfg file should read:
-# perm.anonymous:r
-# perm.username:rw
-# passw.c:<yourpasswordfile>
-#
-# Password file should be prepared with Apaches htpasswd utility in encrypted mode and should exist in a folder zebra.cfg can read
-#
-# Revision 1.33  2006/03/15 11:21:56  plg
-# bug fixed: utf-8 data where not displayed correctly in screens. Supposing
-# your data are truely utf-8 encoded in your database, they should be
-# correctly displayed. "set names 'UTF8'" on mysql connection (C4/Context.pm)
-# is mandatory and "binmode" to utf8 (C4/Interface/CGI/Output.pm) seemed to
-# converted data twice, so it was removed.
-#
-# Revision 1.32  2006/03/03 17:25:01  hdl
-# Bug fixing : a line missed a comment sign.
-#
-# Revision 1.31  2006/03/03 16:45:36  kados
-# Remove the search that tests the Zconn -- warning, still no fault
-# tollerance
-#
-# Revision 1.30  2006/02/22 00:56:59  kados
-# First go at a connection object for Zebra. You can now get a
-# connection object by doing:
-#
-# my $Zconn = C4::Context->Zconn;
-#
-# My initial tests indicate that as soon as your funcion ends
-# (ie, when you're done doing something) the connection will be
-# closed automatically. There may be some other way to make the
-# connection more stateful, I'm not sure...
-#
-# Local Variables:
-# tab-width: 4
-# End:

Index: modules/C4/Date-new.pm
===================================================================
RCS file: modules/C4/Date-new.pm
diff -N modules/C4/Date-new.pm
--- modules/C4/Date-new.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,232 +0,0 @@
-#!/usr/bin/perl
-## written by T Garip 2006-10-10 tgarip at neu.edu.tr
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Date-new.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-package C4::Date;
-
-use strict;
-use C4::Context;
-use Date::Calc qw(:all);
-
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
-
- at ISA = qw(Exporter);
-
- at EXPORT = qw(
-  &display_date_format
-  &format_date
-  &format_date_in_iso
-  &get_date_format_string_for_DHTMLcalendar
-  &DATE_diff &DATE_Add
-&get_today 
-&DATE_subtract
-);
-
-sub get_date_format {
-
-    #Get the database handle
-    my $dbh = C4::Context->dbh;
-    return C4::Context->preference('dateformat');
-}
-
-sub display_date_format {
-    my $dateformat = get_date_format();
-
-    if ( $dateformat eq "us" ) {
-        return "mm/dd/yyyy";
-    }
-    elsif ( $dateformat eq "metric" ) {
-        return "dd/mm/yyyy";
-    }
-    elsif ( $dateformat eq "iso" ) {
-        return "yyyy-mm-dd";
-    }
-    else {
-        return
-"Invalid date format: $dateformat. Please change in system preferences";
-    }
-}
-
-sub get_date_format_string_for_DHTMLcalendar {
-    my $dateformat = get_date_format();
-
-    if ( $dateformat eq 'us' ) {
-        return '%m/%d/%Y';
-    }
-    elsif ( $dateformat eq 'metric' ) {
-        return '%d/%m/%Y';
-    }
-    elsif ( $dateformat eq "iso" ) {
-        return '%Y-%m-%d';
-    }
-    else {
-        return 'Invalid date format: '
-          . $dateformat . '.'
-          . ' Please change in system preferences';
-    }
-}
-
-sub format_date
-{
-	my $olddate = shift;
-	my $newdate;
-
-	if ( ! $olddate )
-	{
-		return "";
-	}
-
-#     warn $olddate;
-#     $olddate=~s#/|\.|-##g;
-    my ($year,$month,$day)=Parse_Date($olddate);
-    ($year,$month,$day)=split /-|\/|\.|:/,$olddate unless ($year && $month);
-# 	warn "$olddate annee $year mois $month jour $day";
-    if ($year>0 && $month>0){
-      my $dateformat = get_date_format();
-#      $dateformat="metric" if (index(":",$olddate)>0);
-      if ( $dateformat eq "us" )
-      {
-          $newdate = sprintf("%02d/%02d/%04d",$month,$day,$year);
-      }
-      elsif ( $dateformat eq "metric" )
-      {
-          $newdate = sprintf("%02d/%02d/%04d",$day,$month,$year);
-      }
-      elsif ( $dateformat eq "iso" )
-      {
-  # 		Date_Init("DateFormat=iso");
-          $newdate = sprintf("%04d-%02d-%02d",$year,$month,$day);
-      }
-      else
-      {
-          return "Invalid date format: $dateformat. Please change in system preferences";
-      }
-#       warn "newdate :$newdate";
-    }
-    return $newdate;
-}
-
-
-sub format_date_in_iso
-{
-    my $olddate = shift;
-    my $newdate;
-
-    if ( ! $olddate )
-    {
-            return "";
-    }
-    if (check_whether_iso($olddate)){
-      return $olddate;
-    } else {
-      my $dateformat = get_date_format();
-      my ($year,$month,$day);
-      my @date;
-      my $tmpolddate=$olddate;
-      $tmpolddate=~s#/|\.|-|\\##g;
-      $dateformat="metric" if (index(":",$olddate)>0);
-      if ( $dateformat eq "us" )
-      {
-        ($month,$day,$year)=split /-|\/|\.|:/,$olddate unless ($year && $month);
-        if ($month>0 && $day >0){
-              @date = Decode_Date_US($tmpolddate);
-        } else {
-          @date=($year, $month,$day)
-        }
-      }
-      elsif ( $dateformat eq "metric" )
-      {
-        ($day,$month,$year)=split /-|\/|\.|:/,$olddate unless ($year && $month);
-        if ($month>0 && $day >0){
-              @date = Decode_Date_EU($tmpolddate);
-        } else {
-          @date=($year, $month,$day)
-        }
-      }
-      elsif ( $dateformat eq "iso" )
-      {
-        ($year,$month,$day)=split /-|\/|\.|:/,$olddate unless ($year && $month);
-        if ($month>0 && $day >0){
-          @date=($year, $month,$day) if (check_date($year,$month,$day));
-        } else {
-          @date=($year, $month,$day)
-        }
-      }
-      else
-      {
-          return "9999-99-99";
-      }
-      $newdate = sprintf("%04d-%02d-%02d",$date[0],$date[1],$date[2]);
-      return $newdate;
-    }
-}
-
-sub check_whether_iso
-{
-    my $olddate = shift;
-    my @olddate= split /\-/,$olddate ;
-    return 1 if (length($olddate[0])==4 && length($olddate[1])<=2 && length($olddate[2])<=2);
-    return 0;
-}
-
-sub get_today{
-my ($year,$month,$day)=Today();
-return sprintf("%04d-%02d-%02d",$year,$month,$day);
-}
-
-###Utility functions for serials management
-sub DATE_diff {
-## returns 1 if date1>date2 0 if date1==date2 -1 if date1<date2
-my ($date1,$date2)=@_;
-my ($year1,$month1,$day1)=Parse_Date($date1);
-my ($year2,$month2,$day2)=Parse_Date($date2);
-return Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) 
-}
-
-sub DATE_Add {
-## $amount in days
-my ($date,$amount)=@_;
-my ($year,$month,$day)=Parse_Date($date);
-($year,$month,$day) = Add_Delta_Days($year,$month,$day, $amount);
-return sprintf("%04d-%02d-%02d",$year,$month,$day);
-}
-
-
-
-
-
-
-
-
-sub DATE_subtract{
-my ($date1,$date2)=@_;
-my ($year1,$month1,$day1)=Parse_Date($date1);
-my ($year2,$month2,$day2)=Parse_Date($date2);
-my $lower = Date_to_Days($year1,$month1,$day1);
- my $upper = Date_to_Days($year2,$month2,$day2);
-
-return ($lower-$upper);
-}
-1;
-__END__

Index: modules/C4/Date.pm
===================================================================
RCS file: modules/C4/Date.pm
diff -N modules/C4/Date.pm
--- modules/C4/Date.pm	11 Mar 2007 20:03:27 -0000	1.1.2.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,232 +0,0 @@
-#!/usr/bin/perl
-## written by T Garip 2006-10-10 tgarip at neu.edu.tr
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Date.pm,v 1.1.2.2 2007/03/11 20:03:27 tgarip1957 Exp $
-##changed to use Date::Calc
-package C4::Date;
-
-use strict;
-use C4::Context;
-use Date::Calc qw(:all);
-
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-$VERSION = do { my @v = '$Revision: 1.1.2.2 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
-
- at ISA = qw(Exporter);
-
- at EXPORT = qw(
-  &display_date_format
-  &format_date
-  &format_date_in_iso
-  &get_date_format_string_for_DHTMLcalendar
-  &DATE_diff &DATE_Add
-&get_today 
-&DATE_subtract
-);
-
-sub get_date_format {
-
-    #Get the database handle
-    my $dbh = C4::Context->dbh;
-    return C4::Context->preference('dateformat');
-}
-
-sub display_date_format {
-    my $dateformat = get_date_format();
-
-    if ( $dateformat eq "us" ) {
-        return "mm/dd/yyyy";
-    }
-    elsif ( $dateformat eq "metric" ) {
-        return "dd/mm/yyyy";
-    }
-    elsif ( $dateformat eq "iso" ) {
-        return "yyyy-mm-dd";
-    }
-    else {
-        return
-"Invalid date format: $dateformat. Please change in system preferences";
-    }
-}
-
-sub get_date_format_string_for_DHTMLcalendar {
-    my $dateformat = get_date_format();
-
-    if ( $dateformat eq 'us' ) {
-        return '%m/%d/%Y';
-    }
-    elsif ( $dateformat eq 'metric' ) {
-        return '%d/%m/%Y';
-    }
-    elsif ( $dateformat eq "iso" ) {
-        return '%Y-%m-%d';
-    }
-    else {
-        return 'Invalid date format: '
-          . $dateformat . '.'
-          . ' Please change in system preferences';
-    }
-}
-
-sub format_date
-{
-	my $olddate = shift;
-	my $newdate;
-
-	if ( ! $olddate )
-	{
-		return "";
-	}
-
-#     warn $olddate;
-#     $olddate=~s#/|\.|-##g;
-    my ($year,$month,$day)=Parse_Date($olddate);
-    ($year,$month,$day)=split /-|\/|\.|:/,$olddate unless ($year && $month);
-# 	warn "$olddate annee $year mois $month jour $day";
-    if ($year>0 && $month>0){
-      my $dateformat = get_date_format();
-#      $dateformat="metric" if (index(":",$olddate)>0);
-      if ( $dateformat eq "us" )
-      {
-          $newdate = sprintf("%02d/%02d/%04d",$month,$day,$year);
-      }
-      elsif ( $dateformat eq "metric" )
-      {
-          $newdate = sprintf("%02d/%02d/%04d",$day,$month,$year);
-      }
-      elsif ( $dateformat eq "iso" )
-      {
-  # 		Date_Init("DateFormat=iso");
-          $newdate = sprintf("%04d-%02d-%02d",$year,$month,$day);
-      }
-      else
-      {
-          return "Invalid date format: $dateformat. Please change in system preferences";
-      }
-#       warn "newdate :$newdate";
-    }
-    return $newdate;
-}
-
-
-sub format_date_in_iso
-{
-    my $olddate = shift;
-    my $newdate;
-
-    if ( ! $olddate )
-    {
-            return "";
-    }
-    if (check_whether_iso($olddate)){
-      return $olddate;
-    } else {
-      my $dateformat = get_date_format();
-      my ($year,$month,$day);
-      my @date;
-      my $tmpolddate=$olddate;
-      $tmpolddate=~s#/|\.|-|\\##g;
-      $dateformat="metric" if (index(":",$olddate)>0);
-      if ( $dateformat eq "us" )
-      {
-        ($month,$day,$year)=split /-|\/|\.|:/,$olddate unless ($year && $month);
-        if ($month>0 && $day >0){
-              @date = Decode_Date_US($tmpolddate);
-        } else {
-          @date=($year, $month,$day)
-        }
-      }
-      elsif ( $dateformat eq "metric" )
-      {
-        ($day,$month,$year)=split /-|\/|\.|:/,$olddate unless ($year && $month);
-        if ($month>0 && $day >0){
-              @date = Decode_Date_EU($tmpolddate);
-        } else {
-          @date=($year, $month,$day)
-        }
-      }
-      elsif ( $dateformat eq "iso" )
-      {
-        ($year,$month,$day)=split /-|\/|\.|:/,$olddate unless ($year && $month);
-        if ($month>0 && $day >0){
-          @date=($year, $month,$day) if (check_date($year,$month,$day));
-        } else {
-          @date=($year, $month,$day)
-        }
-      }
-      else
-      {
-          return "9999-99-99";
-      }
-      $newdate = sprintf("%04d-%02d-%02d",$date[0],$date[1],$date[2]);
-      return $newdate;
-    }
-}
-
-sub check_whether_iso
-{
-    my $olddate = shift;
-    my @olddate= split /\-/,$olddate ;
-    return 1 if (length($olddate[0])==4 && length($olddate[1])<=2 && length($olddate[2])<=2);
-    return 0;
-}
-
-sub get_today{
-my ($year,$month,$day)=Today();
-return sprintf("%04d-%02d-%02d",$year,$month,$day);
-}
-
-###Utility functions for serials management
-sub DATE_diff {
-## returns 1 if date1>date2 0 if date1==date2 -1 if date1<date2
-my ($date1,$date2)=@_;
-my ($year1,$month1,$day1)=Parse_Date($date1);
-my ($year2,$month2,$day2)=Parse_Date($date2);
-return Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) 
-}
-
-sub DATE_Add {
-## $amount in days
-my ($date,$amount)=@_;
-my ($year,$month,$day)=Parse_Date($date);
-($year,$month,$day) = Add_Delta_Days($year,$month,$day, $amount);
-return sprintf("%04d-%02d-%02d",$year,$month,$day);
-}
-
-
-
-
-
-
-
-
-sub DATE_subtract{
-my ($date1,$date2)=@_;
-my ($year1,$month1,$day1)=Parse_Date($date1);
-my ($year2,$month2,$day2)=Parse_Date($date2);
-my $lower = Date_to_Days($year1,$month1,$day1);
- my $upper = Date_to_Days($year2,$month2,$day2);
-
-return ($lower-$upper);
-}
-1;
-__END__

Index: modules/C4/Format.pm
===================================================================
RCS file: modules/C4/Format.pm
diff -N modules/C4/Format.pm
--- modules/C4/Format.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,232 +0,0 @@
-package C4::Format;
-
-# $Id: Format.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Format - Functions for pretty-printing strings and numbers
-
-=head1 SYNOPSIS
-
-  use C4::Format;
-
-=head1 DESCRIPTION
-
-These functions return pretty-printed versions of strings and numbers.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&fmtstr &fmtdec);
-
-=item fmtstr
-
-  $str = &fmtstr($env, $string, $format);
-
-Returns C<$string>, padded with space to a given length.
-
-C<$format> is either C<Ln> or C<Rn>, where I<n> is a positive integer.
-C<$str> will be either left-padded or right-padded, respectively.
-
-C<&fmtstr> is almost equivalent to
-
-  sprintf("%-n.ns", $string);
-
-or
-
-  sprintf("%n.ns", $string);
-
-The only difference is that if I<n> is less than the length of
-C<$string>, then C<&fmtstr> will return the last I<n> characters of
-C<$string>, whereas C<sprintf> will return the first I<n> characters.
-
-C<$env> is ignored.
-
-=cut
-#'
-sub fmtstr {
-  # format (space pad) a string
-  # $fmt is Ln.. or Rn.. where n is the length
-  my ($env,$strg,$fmt)=@_;
-  my $align = substr($fmt,0,1);
-  my $lenst = substr($fmt,1,length($fmt)-1);
-  if ($align eq"R" ) {
-     $strg = substr((" "x$lenst).$strg,0-$lenst,$lenst);
-  } elsif  ($align eq "C" ) {
-     $strg =
-       substr((" "x(($lenst/2)-(length($strg)/2))).$strg.(" "x$lenst),0,$lenst);
-  } else {
-     $strg = substr($strg.(" "x$lenst),0,$lenst);
-  }
-  return ($strg);
-}
-
-=item fmtdec
-
-  $str = &fmtdec($env, $number, $format)
-
-Returns a pretty-printed version of C<$number>.
-
-C<$format> specifies how to print the number. It is of the form
-
-  [$][,]n[m]
-
-where I<n> and I<m> are digits, specifying the number of digits to use
-before and after the decimal, respectively. Thus,
-
-  &fmtdec(undef, 123.456, "42")
-
-will return
-
-  " 123.45"
-
-If I<n> is smaller than the size of the integer part, only the last
-I<n> digits will be returned. If I<m> is greater than the number of
-digits after the decimal in C<$number>, the result will be
-right-padded with zeros.
-
-If C<$format> has a leading dollar sign, the number is assumed to be a
-monetary amount. C<$str> will have a dollar sign prepended to the
-value.
-
-If C<$format> has a comma after the optional dollar sign, the integer
-part will be split into three-digit groups separated by commas.
-
-C<$env> is effectively ignored.
-
-=cut
-#'
-# FIXME - This is all terribly provincial, not at all
-# internationalized. I'm pretty sure there's already something out
-# there that'll figure out the current locale, look up the local
-# currency symbol (and whether it goes on the left or right), figure
-# out how numbers are grouped (commas, periods, or what? And how many
-# digits per group?), and will print the whole thing prettily.
-# But I can't find it just now. Maybe POSIX::setlocale() or
-# perllocale(1) might help.
-# FIXME - Bug:
-#	fmtdec(undef, 12345.6, ',82') prints "     345.60"
-#	fmtdec(undef, 12345.6, '$,82') prints ".60"
-sub fmtdec {
-  # format a decimal
-  # $fmt is [$][,]n[m]
-  my ($env,$numb,$fmt)=@_;
-
-  # FIXME - Use $fmt =~ /^(\$)?(,)?(\d)(\d)?$/ instead of this mess of
-  # substr()s.
-
-  # See if there's a leading dollar sign.
-  my $curr = substr($fmt,0,1);
-  if ($curr eq "\$") {
-    $fmt = substr($fmt,1,length($fmt)-1);
-  };
-  # See if there's a leading comma
-  my $comma = substr($fmt,0,1);
-  if ($comma eq ",") {
-    $fmt = substr($fmt,1,length($fmt)-1);
-  };
-  # See whether one number was given, or two.
-  my $right;
-  my $left = substr($fmt,0,1);
-  if (length($fmt) == 1) {
-    $right = 0;
-  } else {
-    $right = substr($fmt,1,1);
-  }
-  # See if $numb is a floating-point number.
-  my $fnumb = "";
-  my $tempint = "";
-  my $tempdec = "";
-  # FIXME - Use
-  #	$numb =~ /(\d+)\.(\d+)/;
-  #	$tempint = $1 + 0;
-  #	$tempdec = $2;
-  if (index($numb,".") == 0 ){
-     $tempint = 0;
-     $tempdec = substr($numb,1,length($numb)-1);
-  } else {
-     if (index($numb,".") > 0) {
-       my $decpl = index($numb,".");
-       $tempint = substr($numb,0,$decpl);
-       $tempdec = substr($numb,$decpl+1,length($numb)-1-$decpl);
-     } else {
-       $tempint = $numb;
-       $tempdec = 0;
-     }
-     # If a comma was specified, then comma-separate the integer part
-     # FIXME - From the Perl Cookbook (ISBN 1-56592-243-3), sec. 2.1.7:
-     #	sub commify {
-     #		my $test = reverse $_[0];
-     #		$text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
-     #		return scalar reverse $text;
-     #	}
-     if ($comma eq ",") {
-        while (length($tempdec) > 3) {
-           $fnumb = ",".substr($tempint,-3,3).$fnumb;
-	   substr($tempint,-3,3) = "";
-	}
-	$fnumb = substr($tempint,-3,3).$fnumb;
-     } else {
-        $fnumb = $tempint;
-     }
-  }
-  # If a dollar sign was specified, prepend a dollar sign and
-  # right-justify the number
-  if ($curr eq "\$") {
-     $fnumb = fmtstr($env,$curr.$fnumb,"R".$left+1);
-  } else {
-     if ($left==0) {
-        $fnumb = "";
-     } else {
-        $fnumb = fmtstr($env,$fnumb,"R".$left);
-     }
-  }
-  # Right-pad the decimal part to the given number of digits.
-  if ($right > 0) {
-     $tempdec .= "0"x$right;
-     $tempdec = substr($tempdec,0,$right);
-     $fnumb .= ".".$tempdec;
-  }
-  return $fnumb;	# FIXME - Shouldn't return a list.
-}
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Input.pm
===================================================================
RCS file: modules/C4/Input.pm
diff -N modules/C4/Input.pm
--- modules/C4/Input.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,220 +0,0 @@
-package C4::Input; #assumes C4/Input
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Input - Miscellaneous sanity checks
-
-=head1 SYNOPSIS
-
-  use C4::Input;
-
-=head1 DESCRIPTION
-
-This module provides functions to see whether a given library card
-number or ISBN is valid.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-	&checkdigit &checkvalidisbn
-	&buildCGIsort
-);
-
-# FIXME - This is never used.
-#sub checkflds {
-#  my ($env,$reqflds,$data) = @_;
-#  my $numrflds = @$reqflds;
-#  my @probarr;
-#  my $i = 0;
-#  while ($i < $numrflds) {
-#    if ($data->{@$reqflds[$i]} eq "") {
-#      push(@probarr, @$reqflds[$i]);
-#    }
-#    $i++
-#  }
-#  return (\@probarr);
-#}
-
-=item checkdigit
-
-  $valid = &checkdigit($env, $cardnumber $nounique);
-
-Takes a card number, computes its check digit, and compares it to the
-checkdigit at the end of C<$cardnumber>. Returns a true value iff
-C<$cardnumber> has a valid check digit.
-
-C<$env> is ignored.
-
-=cut
-#'
-sub checkdigit {
-
-	my ($env,$infl, $nounique) =  @_;
-	$infl = uc $infl;
-
-
-	#Check to make sure the cardnumber is unique
-
-	#FIXME: We should make the error for a nonunique cardnumber
-	#different from the one where the checkdigit on the number is
-	#not correct
-
-	unless ( $nounique )
-	{
-		my $dbh=C4::Context->dbh;
-		my $query=qq{SELECT * FROM borrowers WHERE cardnumber=?};
-		my $sth=$dbh->prepare($query);
-		$sth->execute($infl);
-		my %results = $sth->fetchrow_hashref();
-		if ( $sth->rows != 0 )
-		{
-			return 0;
-		}
-	}
-	if (C4::Context->preference("checkdigit") eq "none") {
-		return 1;
-	}
-
-	my @weightings = (8,4,6,3,5,2,1);
-	my $sum;
-	my $i = 1;
-	my $valid = 0;
-
-	foreach $i (1..7) {
-		my $temp1 = $weightings[$i-1];
-		my $temp2 = substr($infl,$i,1);
-		$sum += $temp1 * $temp2;
-	}
-	my $rem = ($sum%11);
-	if ($rem == 10) {
-	$rem = "X";
-	}
-	if ($rem eq substr($infl,8,1)) {
-		$valid = 1;
-	}
-	return $valid;
-} # sub checkdigit
-
-=item checkvalidisbn
-
-  $valid = &checkvalidisbn($isbn);
-
-Returns a true value iff C<$isbn> is a valid ISBN: it must be ten
-digits long (counting "X" as a digit), and must have a valid check
-digit at the end.
-
-=cut
-#'
-#--------------------------------------
-# Determine if a number is a valid ISBN number, according to length
-#   of 10 digits and valid checksum
-sub checkvalidisbn {
-	use strict;
-	my ($q)=@_ ;	# Input: ISBN number
-	
-	my $isbngood = 0; # Return: true or false
-	
-	$q=~s/x$/X/g;   # upshift lower case X
-	$q=~s/[^X\d]//g;
-	$q=~s/X.//g;
-	
-		#return 0 if $q is not ten digits long
-		if (length($q)!=10) {
-			return 0;
-		}
-		
-		#If we get to here, length($q) must be 10
-	my $checksum=substr($q,9,1);
-	my $isbn=substr($q,0,9);
-	my $i;
-	my $c=0;
-	for ($i=0; $i<9; $i++) {
-		my $digit=substr($q,$i,1);
-		$c+=$digit*(10-$i);
-	}
-	$c %= 11;
-	($c==10) && ($c='X');
-	$isbngood = $c eq $checksum;
-	return $isbngood;
-
-} # sub checkvalidisbn
-
-=item buildCGISort
-
-  $CGIScrollingList = &BuildCGISort($name string, $input_name string);
-
-Returns the scrolling list with name $input_name, built on authorised Values named $name.
-Returns NULL if no authorised values found
-
-=cut
-sub buildCGIsort {
-    use strict;
-	my ($name,$input_name,$data) = @_;
-	my $dbh=C4::Context->dbh;
-	my $query=qq{SELECT * FROM authorised_values WHERE category=? order by lib};
-	my $sth=$dbh->prepare($query);
-	$sth->execute($name);
-	my $CGISort;
-	if ($sth->rows>0){
-		my @values;
-		my %labels;
-		for (my $i =0;$i<=$sth->rows;$i++){
-			my $results = $sth->fetchrow_hashref;
- 			push @values, $results->{authorised_value};
- 			$labels{$results->{authorised_value}}=$results->{lib};
-		}
- 		$CGISort= CGI::scrolling_list(
- 					-name => $input_name,
- 					-values => \@values,
- 					-labels => \%labels,
-					-default=> $data,
- 					-size => 1,
- 					-multiple => 0);
-	}
-	$sth->finish; 
-	return $CGISort;
-}
-END { }       # module clean-up code here (global destructor)
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Koha.pm
===================================================================
RCS file: modules/C4/Koha.pm
diff -N modules/C4/Koha.pm
--- modules/C4/Koha.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,961 +0,0 @@
-package C4::Koha;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Koha.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-use strict;
-require Exporter;
-use C4::Context;
-use C4::Biblio;
-use CGI;
-use vars qw($VERSION @ISA @EXPORT);
-
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g; shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
-
-=head1 NAME
-
-C4::Koha - Perl Module containing convenience functions for Koha scripts
-
-=head1 SYNOPSIS
-
-  use C4::Koha;
-
-
-=head1 DESCRIPTION
-
-Koha.pm provides many functions for Koha scripts.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-            &subfield_is_koha_internal_p
-            &GetBranches &getbranch &getbranchdetail
-            &getprinters &getprinter
-            &GetItemTypes &getitemtypeinfo &ItemType
-                        get_itemtypeinfos_of
-            &getframeworks &getframeworkinfo
-            &getauthtypes &getauthtype
-            &getallthemes &getalllanguages
-            &GetallBranches &getletters
-            &getbranchname
-                        getnbpages
-                        getitemtypeimagedir
-                        getitemtypeimagesrc
-                        getitemtypeimagesrcfromurl
-            &getcities
-            &getroadtypes
-                        get_branchinfos_of
-                        get_notforloan_label_of
-                        get_infos_of
-                        &getFacets
-			
-            $DEBUG);
-
-use vars qw();
-
-my $DEBUG = 0;
-
-# FIXME.. this should be moved to a MARC-specific module
-sub subfield_is_koha_internal_p  {
-    my($subfield) = @_;
-
-    # We could match on 'lib' and 'tab' (and 'mandatory', & more to come!)
-    # But real MARC subfields are always single-character
-    # so it really is safer just to check the length
-
-    return length $subfield != 1;
-}
-
-=head2 GetBranches
-
-  $branches = &GetBranches();
-  returns informations about branches.
-  Create a branch selector with the following code
-  Is branchIndependant sensitive
-   When IndependantBranches is set AND user is not superlibrarian, displays only user's branch
-  
-=head3 in PERL SCRIPT
-
-my $branches = GetBranches;
-my @branchloop;
-foreach my $thisbranch (sort keys %$branches) {
-    my $selected = 1 if $thisbranch eq $branch;
-    my %row =(value => $thisbranch,
-                selected => $selected,
-                branchname => $branches->{$thisbranch}->{'branchname'},
-            );
-    push @branchloop, \%row;
-}
-
-
-=head3 in TEMPLATE  
-            <select name="branch">
-                <option value="">Default</option>
-            <!-- TMPL_LOOP name="branchloop" -->
-                <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
-            <!-- /TMPL_LOOP -->
-            </select>
-
-=cut
-
-sub GetBranches {
-# returns a reference to a hash of references to branches...
-    my ($type) = @_;
-    my %branches;
-    my $branch;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if (C4::Context->preference("IndependantBranches") && (C4::Context->userenv->{flags}!=1)){
-        my $strsth ="Select * from branches ";
-        $strsth.= " WHERE branchcode = ".$dbh->quote(C4::Context->userenv->{branch});
-        $strsth.= " order by branchname";
-        $sth=$dbh->prepare($strsth);
-    } else {
-        $sth = $dbh->prepare("Select * from branches order by branchname");
-    }
-    $sth->execute;
-    while ($branch=$sth->fetchrow_hashref) {
-        my $nsth = $dbh->prepare("select categorycode from branchrelations where branchcode = ?");
-            if ($type){
-            $nsth = $dbh->prepare("select categorycode from branchrelations where branchcode = ? and categorycode = ?");
-            $nsth->execute($branch->{'branchcode'},$type);
-      	  } else {
-	            $nsth = $dbh->prepare("select categorycode from branchrelations where branchcode = ? ");
- 
-            $nsth->execute($branch->{'branchcode'});
-      	  }
-        while (my ($cat) = $nsth->fetchrow_array) {
-            # FIXME - This seems wrong. It ought to be
-            # $branch->{categorycodes}{$cat} = 1;
-            # otherwise, there's a namespace collision if there's a
-            # category with the same name as a field in the 'branches'
-            # table (i.e., don't create a category called "issuing").
-            # In addition, the current structure doesn't really allow
-            # you to list the categories that a branch belongs to:
-            # you'd have to list keys %$branch, and remove those keys
-            # that aren't fields in the "branches" table.
-            $branch->{$cat} = 1;
-            }
-	$branches{$branch->{'branchcode'}}=$branch;
-}
-    return (\%branches);
-}
-
-sub getbranchname {
-    my ($branchcode)=@_;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-       $sth = $dbh->prepare("Select branchname from branches where branchcode=?");
-    $sth->execute($branchcode);
-    my $branchname = $sth->fetchrow_array;
-    $sth->finish;
-    
-    return($branchname);
-}
-
-=head2 getallbranches
-
-  @branches = &GetallBranches();
-  returns informations about ALL branches.
-  Create a branch selector with the following code
-  IndependantBranches Insensitive...
-  
-
-=cut
-
-
-sub GetallBranches {
-# returns an array to ALL branches...
-    my @branches;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-       $sth = $dbh->prepare("Select * from branches order by branchname");
-    $sth->execute;
-    while (my $branch=$sth->fetchrow_hashref) {
-        push @branches,$branch;
-    }
-    return (@branches);
-}
-
-=head2 getletters
-
-  $letters = &getletters($category);
-  returns informations about letters.
-  if needed, $category filters for letters given category
-  Create a letter selector with the following code
-  
-=head3 in PERL SCRIPT
-
-my $letters = getletters($cat);
-my @letterloop;
-foreach my $thisletter (keys %$letters) {
-    my $selected = 1 if $thisletter eq $letter;
-    my %row =(value => $thisletter,
-                selected => $selected,
-                lettername => $letters->{$thisletter},
-            );
-    push @letterloop, \%row;
-}
-
-
-=head3 in TEMPLATE  
-            <select name="letter">
-                <option value="">Default</option>
-            <!-- TMPL_LOOP name="letterloop" -->
-                <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="lettername" --></option>
-            <!-- /TMPL_LOOP -->
-            </select>
-
-=cut
-
-sub getletters {
-# returns a reference to a hash of references to ALL letters...
-    my $cat =@_;
-    my %letters;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-       if ($cat ne ""){
-        $sth = $dbh->prepare("Select * from letter where module = \'".$cat."\' order by name");
-    } else {
-        $sth = $dbh->prepare("Select * from letter order by name");
-    }
-    $sth->execute;
-    my $count;
-    while (my $letter=$sth->fetchrow_hashref) {
-            $letters{$letter->{'code'}}=$letter->{'name'};
-            $count++;
-    }
-    return ($count,\%letters);
-}
-
-=head2 GetItemTypes
-
-  $itemtypes = &GetItemTypes();
-
-Returns information about existing itemtypes.
-
-build a HTML select with the following code :
-
-=head3 in PERL SCRIPT
-
-my $itemtypes = GetItemTypes;
-my @itemtypesloop;
-foreach my $thisitemtype (sort keys %$itemtypes) {
-    my $selected = 1 if $thisitemtype eq $itemtype;
-    my %row =(value => $thisitemtype,
-                selected => $selected,
-                description => $itemtypes->{$thisitemtype}->{'description'},
-            );
-    push @itemtypesloop, \%row;
-}
-$template->param(itemtypeloop => \@itemtypesloop);
-
-=head3 in TEMPLATE
-
-<form action='<!-- TMPL_VAR name="script_name" -->' method=post>
-    <select name="itemtype">
-        <option value="">Default</option>
-    <!-- TMPL_LOOP name="itemtypeloop" -->
-        <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="description" --></option>
-    <!-- /TMPL_LOOP -->
-    </select>
-    <input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->">
-    <input type="submit" value="OK" class="button">
-</form>
-
-
-=cut
-
-sub GetItemTypes {
-# returns a reference to a hash of references to branches...
-    my %itemtypes;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT *
-        FROM   itemtypes
-    |;
-    my $sth=$dbh->prepare($query);
-    $sth->execute;
-    while (my $IT=$sth->fetchrow_hashref) {
-            $itemtypes{$IT->{'itemtype'}}=$IT;
-    }
-    return (\%itemtypes);
-}
-
-# FIXME this function is better and should replace GetItemTypes everywhere
-sub get_itemtypeinfos_of {
-    my @itemtypes = @_;
-
-    my $query = '
-SELECT itemtype,
-       description,
-       notforloan
-  FROM itemtypes
-  WHERE itemtype IN ('.join(',', map({"'".$_."'"} @itemtypes)).')
-';
-
-    return get_infos_of($query, 'itemtype');
-}
-
-sub ItemType {
-  my ($type)=@_;
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("select description from itemtypes where itemtype=?");
-  $sth->execute($type);
-  my $dat=$sth->fetchrow_hashref;
-  $sth->finish;
-  return ($dat->{'description'});
-}
-=head2 getauthtypes
-
-  $authtypes = &getauthtypes();
-
-Returns information about existing authtypes.
-
-build a HTML select with the following code :
-
-=head3 in PERL SCRIPT
-
-my $authtypes = getauthtypes;
-my @authtypesloop;
-foreach my $thisauthtype (keys %$authtypes) {
-    my $selected = 1 if $thisauthtype eq $authtype;
-    my %row =(value => $thisauthtype,
-                selected => $selected,
-                authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
-            );
-    push @authtypesloop, \%row;
-}
-$template->param(itemtypeloop => \@itemtypesloop);
-
-=head3 in TEMPLATE
-
-<form action='<!-- TMPL_VAR name="script_name" -->' method=post>
-    <select name="authtype">
-    <!-- TMPL_LOOP name="authtypeloop" -->
-        <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="authtypetext" --></option>
-    <!-- /TMPL_LOOP -->
-    </select>
-    <input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->">
-    <input type="submit" value="OK" class="button">
-</form>
-
-
-=cut
-
-sub getauthtypes {
-# returns a reference to a hash of references to authtypes...
-    my %authtypes;
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("select * from auth_types order by authtypetext");
-    $sth->execute;
-    while (my $IT=$sth->fetchrow_hashref) {
-            $authtypes{$IT->{'authtypecode'}}=$IT;
-    }
-    return (\%authtypes);
-}
-
-sub getauthtype {
-    my ($authtypecode) = @_;
-# returns a reference to a hash of references to authtypes...
-    my %authtypes;
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("select * from auth_types where authtypecode=?");
-    $sth->execute($authtypecode);
-    my $res=$sth->fetchrow_hashref;
-    return $res;
-}
-
-=head2 getframework
-
-  $frameworks = &getframework();
-
-Returns information about existing frameworks
-
-build a HTML select with the following code :
-
-=head3 in PERL SCRIPT
-
-my $frameworks = frameworks();
-my @frameworkloop;
-foreach my $thisframework (keys %$frameworks) {
-    my $selected = 1 if $thisframework eq $frameworkcode;
-    my %row =(value => $thisframework,
-                selected => $selected,
-                description => $frameworks->{$thisframework}->{'frameworktext'},
-            );
-    push @frameworksloop, \%row;
-}
-$template->param(frameworkloop => \@frameworksloop);
-
-=head3 in TEMPLATE
-
-<form action='<!-- TMPL_VAR name="script_name" -->' method=post>
-    <select name="frameworkcode">
-        <option value="">Default</option>
-    <!-- TMPL_LOOP name="frameworkloop" -->
-        <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="frameworktext" --></option>
-    <!-- /TMPL_LOOP -->
-    </select>
-    <input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->">
-    <input type="submit" value="OK" class="button">
-</form>
-
-
-=cut
-
-sub getframeworks {
-# returns a reference to a hash of references to branches...
-    my %itemtypes;
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("select * from biblios_framework");
-    $sth->execute;
-    while (my $IT=$sth->fetchrow_hashref) {
-            $itemtypes{$IT->{'frameworkcode'}}=$IT;
-    }
-    return (\%itemtypes);
-}
-=head2 getframeworkinfo
-
-  $frameworkinfo = &getframeworkinfo($frameworkcode);
-
-Returns information about an frameworkcode.
-
-=cut
-
-sub getframeworkinfo {
-    my ($frameworkcode) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("select * from biblios_framework where frameworkcode=?");
-    $sth->execute($frameworkcode);
-    my $res = $sth->fetchrow_hashref;
-    return $res;
-}
-
-
-=head2 getitemtypeinfo
-
-  $itemtype = &getitemtype($itemtype);
-
-Returns information about an itemtype.
-
-=cut
-
-sub getitemtypeinfo {
-    my ($itemtype) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("select * from itemtypes where itemtype=?");
-    $sth->execute($itemtype);
-    my $res = $sth->fetchrow_hashref;
-
-        $res->{imageurl} = getitemtypeimagesrcfromurl($res->{imageurl});
-
-    return $res;
-}
-
-sub getitemtypeimagesrcfromurl {
-    my ($imageurl) = @_;
-
-    if (defined $imageurl and $imageurl !~ m/^http/) {
-        $imageurl =
-            getitemtypeimagesrc()
-            .'/'.$imageurl
-            ;
-    }
-
-    return $imageurl;
-}
-
-sub getitemtypeimagedir {
-    return
-        C4::Context->intrahtdocs
-        .'/'.C4::Context->preference('template')
-        .'/itemtypeimg'
-        ;
-}
-
-sub getitemtypeimagesrc {
-    return
-        '/intranet-tmpl'
-        .'/'.C4::Context->preference('template')
-        .'/itemtypeimg'
-        ;
-}
-
-=head2 getprinters
-
-  $printers = &getprinters($env);
-  @queues = keys %$printers;
-
-Returns information about existing printer queues.
-
-C<$env> is ignored.
-
-C<$printers> is a reference-to-hash whose keys are the print queues
-defined in the printers table of the Koha database. The values are
-references-to-hash, whose keys are the fields in the printers table.
-
-=cut
-
-sub getprinters {
-    my ($env) = @_;
-    my %printers;
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("select * from printers");
-    $sth->execute;
-    while (my $printer=$sth->fetchrow_hashref) {
-    $printers{$printer->{'printqueue'}}=$printer;
-    }
-    return (\%printers);
-}
-
-sub getbranch  {
-    my($query, $branches) = @_; # get branch for this query from branches
-    my $branch = $query->param('branch');
-    ($branch) || ($branch = $query->cookie('branch'));
-    ($branches->{$branch}) || ($branch=(keys %$branches)[0]);
-    return $branch;
-}
-
-=item getbranchdetail
-
-  $branchname = &getbranchdetail($branchcode);
-
-Given the branch code, the function returns the corresponding
-branch name for a comprehensive information display
-
-=cut
-
-sub getbranchdetail
-{
-    my ($branchcode) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
-    $sth->execute($branchcode);
-    my $branchname = $sth->fetchrow_hashref();
-    $sth->finish();
-    return $branchname;
-} # sub getbranchname
-
-
-sub getprinter  {
-    my($query, $printers) = @_; # get printer for this query from printers
-    my $printer = $query->param('printer');
-    ($printer) || ($printer = $query->cookie('printer')) || ($printer='');
-    ($printers->{$printer}) || ($printer = (keys %$printers)[0]);
-    return $printer;
-}
-
-=item getalllanguages
-
-  (@languages) = &getalllanguages($type);
-  (@languages) = &getalllanguages($type,$theme);
-
-Returns an array of all available languages.
-
-=cut
-
-sub getalllanguages {
-    my $type=shift;
-    my $theme=shift;
-    my $htdocs;
-    my @languages;
-    if ($type eq 'opac') {
-        $htdocs=C4::Context->config('opachtdocs');
-        if ($theme and -d "$htdocs/$theme") {
-            opendir D, "$htdocs/$theme";
-            foreach my $language (readdir D) {
-                next if $language=~/^\./;
-                next if $language eq 'all';
-                next if $language=~ /png$/;
-                next if $language=~ /css$/;
-	  next if $language=~ /images$/;
-                next if $language=~ /CVS$/;
-                next if $language=~ /itemtypeimg$/;
-		next if $language=~ /\.txt$/i; #Don't read the readme.txt !
-                push @languages, $language;
-            }
-            return sort @languages;
-        } else {
-            my $lang;
-            foreach my $theme (getallthemes('opac')) {
-                opendir D, "$htdocs/$theme";
-                foreach my $language (readdir D) {
-                    next if $language=~/^\./;
-                    next if $language eq 'all';
-                    next if $language=~ /png$/;
-                    next if $language=~ /css$/;
-	      next if $language=~ /images$/;
-                    next if $language=~ /CVS$/;
-                    next if $language=~ /itemtypeimg$/;
-		    next if $language=~ /\.txt$/i; #Don't read the readme.txt !
-                    $lang->{$language}=1;
-                }
-            }
-            @languages=keys %$lang;
-            return sort @languages;
-        }
-    } elsif ($type eq 'intranet') {
-        $htdocs=C4::Context->config('intrahtdocs');
-        if ($theme and -d "$htdocs/$theme") {
-            opendir D, "$htdocs/$theme";
-            foreach my $language (readdir D) {
-                next if $language=~/^\./;
-                next if $language eq 'all';
-                next if $language=~ /png$/;
-                next if $language=~ /css$/;
-	  next if $language=~ /images$/;
-                next if $language=~ /CVS$/;
-                next if $language=~ /itemtypeimg$/;
-                next if $language=~ /\.txt$/i; #Don't read the readme.txt !
-                push @languages, $language;
-            }
-            return sort @languages;
-        } else {
-            my $lang;
-            foreach my $theme (getallthemes('opac')) {
-                opendir D, "$htdocs/$theme";
-                foreach my $language (readdir D) {
-                    next if $language=~/^\./;
-                    next if $language eq 'all';
-                    next if $language=~ /png$/;
-                    next if $language=~ /css$/;
-	  next if $language=~ /images$/;
-                    next if $language=~ /CVS$/;
-                    next if $language=~ /itemtypeimg$/;
-		    next if $language=~ /\.txt$/i; #Don't read the readme.txt !
-                    $lang->{$language}=1;
-                }
-            }
-            @languages=keys %$lang;
-            return sort @languages;
-        }
-    } else {
-        my $lang;
-        my $htdocs=C4::Context->config('intrahtdocs');
-        foreach my $theme (getallthemes('intranet')) {
-            opendir D, "$htdocs/$theme";
-            foreach my $language (readdir D) {
-                next if $language=~/^\./;
-                next if $language eq 'all';
-                next if $language=~ /png$/;
-                next if $language=~ /css$/;
-	  next if $language=~ /images$/;
-                next if $language=~ /CVS$/;
-                next if $language=~ /itemtypeimg$/;
-		next if $language=~ /\.txt$/i; #Don't read the readme.txt !
-                $lang->{$language}=1;
-            }
-        }
-        $htdocs=C4::Context->config('opachtdocs');
-        foreach my $theme (getallthemes('opac')) {
-        opendir D, "$htdocs/$theme";
-        foreach my $language (readdir D) {
-            next if $language=~/^\./;
-            next if $language eq 'all';
-            next if $language=~ /png$/;
-            next if $language=~ /css$/;
-	  next if $language=~ /images$/;
-            next if $language=~ /CVS$/;
-            next if $language=~ /itemtypeimg$/;
-	    next if $language=~ /\.txt$/i; #Don't read the readme.txt !
-            $lang->{$language}=1;
-            }
-        }
-        @languages=keys %$lang;
-        return sort @languages;
-    }
-}
-
-=item getallthemes
-
-  (@themes) = &getallthemes('opac');
-  (@themes) = &getallthemes('intranet');
-
-Returns an array of all available themes.
-
-=cut
-
-sub getallthemes {
-    my $type=shift;
-    my $htdocs;
-    my @themes;
-    if ($type eq 'intranet') {
-    $htdocs=C4::Context->config('intrahtdocs');
-    } else {
-    $htdocs=C4::Context->config('opachtdocs');
-    }
-    opendir D, "$htdocs";
-    my @dirlist=readdir D;
-    foreach my $directory (@dirlist) {
-    -d "$htdocs/$directory/en" and push @themes, $directory;
-    }
-    return @themes;
-}
-
-=item getnbpages
-
-Returns the number of pages to display in a pagination bar, given the number
-of items and the number of items per page.
-
-=cut
-
-sub getnbpages {
-    my ($nb_items, $nb_items_per_page) = @_;
-
-    return int(($nb_items - 1) / $nb_items_per_page) + 1;
-}
-
-
-=head2 getcities (OUEST-PROVENCE)
-
-  ($id_cityarrayref, $city_hashref) = &getcities();
-
-Looks up the different city and zip in the database. Returns two
-elements: a reference-to-array, which lists the zip city
-codes, and a reference-to-hash, which maps the name of the city.
-WHERE =>OUEST PROVENCE OR EXTERIEUR
-
-=cut
-sub getcities {
-    #my ($type_city) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("Select cityid,city_name from cities order by cityid  ");
-    #$sth->execute($type_city);
-    $sth->execute();    
-    my %city;
-    my @id;
-#    insert empty value to create a empty choice in cgi popup 
-    
-while (my $data=$sth->fetchrow_hashref){
-      
-    push @id,$data->{'cityid'};
-      $city{$data->{'cityid'}}=$data->{'city_name'};
-    }
-    
-    #test to know if the table contain some records if no the function return nothing
-    my $id=@id;
-    $sth->finish;
-    if ($id eq 0)
-    {
-    return();
-    }
-    else{
-    unshift (@id ,"");
-    return(\@id,\%city);
-    }
-}
-
-
-=head2 getroadtypes (OUEST-PROVENCE)
-
-  ($idroadtypearrayref, $roadttype_hashref) = &getroadtypes();
-
-Looks up the different road type . Returns two
-elements: a reference-to-array, which lists the id_roadtype
-codes, and a reference-to-hash, which maps the road type of the road .
-
-
-=cut
-sub getroadtypes {
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("Select roadtypeid,road_type from roadtype order by road_type  ");
-    $sth->execute();
-    my %roadtype;
-    my @id;
-#    insert empty value to create a empty choice in cgi popup 
-while (my $data=$sth->fetchrow_hashref){
-    push @id,$data->{'roadtypeid'};
-      $roadtype{$data->{'roadtypeid'}}=$data->{'road_type'};
-    }
-    #test to know if the table contain some records if no the function return nothing
-    my $id=@id;
-    $sth->finish;
-    if ($id eq 0)
-    {
-    return();
-    }
-    else{
-        unshift (@id ,"");
-        return(\@id,\%roadtype);
-    }
-}
-
-=head2 get_branchinfos_of
-
-  my $branchinfos_of = get_branchinfos_of(@branchcodes);
-
-Associates a list of branchcodes to the information of the branch, taken in
-branches table.
-
-Returns a href where keys are branchcodes and values are href where keys are
-branch information key.
-
-  print 'branchname is ', $branchinfos_of->{$code}->{branchname};
-
-=cut
-sub get_branchinfos_of {
-    my @branchcodes = @_;
-
-    my $query = '
-SELECT branchcode,
-       branchname
-  FROM branches
-  WHERE branchcode IN ('.join(',', map({"'".$_."'"} @branchcodes)).')
-';
-    return get_infos_of($query, 'branchcode');
-}
-
-=head2 get_notforloan_label_of
-
-  my $notforloan_label_of = get_notforloan_label_of();
-
-Each authorised value of notforloan (information available in items and
-itemtypes) is link to a single label.
-
-Returns a href where keys are authorised values and values are corresponding
-labels.
-
-  foreach my $authorised_value (keys %{$notforloan_label_of}) {
-    printf(
-        "authorised_value: %s => %s\n",
-        $authorised_value,
-        $notforloan_label_of->{$authorised_value}
-    );
-  }
-
-=cut
-sub get_notforloan_label_of {
-    my $dbh = C4::Context->dbh;
-my($tagfield,$tagsubfield)=MARCfind_marc_from_kohafield("notforloan","holdings");
-    my $query = '
-SELECT authorised_value
-  FROM holdings_subfield_structure
-  WHERE tagfield =$tagfield and tagsubfield=$tagsubfield
-  LIMIT 0, 1
-';
-    my $sth = $dbh->prepare($query);
-    $sth->execute();
-    my ($statuscode) = $sth->fetchrow_array();
-
-    $query = '
-SELECT lib,
-       authorised_value
-  FROM authorised_values
-  WHERE category = ?
-';
-    $sth = $dbh->prepare($query);
-    $sth->execute($statuscode);
-    my %notforloan_label_of;
-    while (my $row = $sth->fetchrow_hashref) {
-        $notforloan_label_of{ $row->{authorised_value} } = $row->{lib};
-    }
-    $sth->finish;
-
-    return \%notforloan_label_of;
-}
-
-=head2 get_infos_of
-
-Return a href where a key is associated to a href. You give a query, the
-name of the key among the fields returned by the query. If you also give as
-third argument the name of the value, the function returns a href of scalar.
-
-  my $query = '
-SELECT itemnumber,
-       notforloan,
-       barcode
-  FROM items
-';
-
-  # generic href of any information on the item, href of href.
-  my $iteminfos_of = get_infos_of($query, 'itemnumber');
-  print $iteminfos_of->{$itemnumber}{barcode};
-
-  # specific information, href of scalar
-  my $barcode_of_item = get_infos_of($query, 'itemnumber', 'barcode');
-  print $barcode_of_item->{$itemnumber};
-
-=cut
-sub get_infos_of {
-    my ($query, $key_name, $value_name) = @_;
-
-    my $dbh = C4::Context->dbh;
-
-    my $sth = $dbh->prepare($query);
-    $sth->execute();
-
-    my %infos_of;
-    while (my $row = $sth->fetchrow_hashref) {
-        if (defined $value_name) {
-            $infos_of{ $row->{$key_name} } = $row->{$value_name};
-        }
-        else {
-            $infos_of{ $row->{$key_name} } = $row;
-        }
-    }
-    $sth->finish;
-
-    return \%infos_of;
-}
-sub getFacets {
-###Subfields is an array as well although MARC21 has them all in "a" in case UNIMARC has differing subfields
-my $dbh=C4::Context->dbh;
-my $query=new CGI;
-my $lang=$query->cookie('KohaOpacLanguage');
-$lang="en" unless $lang;
-my @facets;
-my $sth=$dbh->prepare("SELECT  facets_label_$lang,kohafield FROM facets  where (facets_label_$lang<>'' ) group by facets_label_$lang");
-my $sth2=$dbh->prepare("SELECT * FROM facets where facets_label_$lang=?");
-$sth->execute();
-while (my ($label,$kohafield)=$sth->fetchrow){
- $sth2->execute($label);
-my (@tags, at subfield);
-	while (my $data=$sth2->fetchrow_hashref){
-	push @tags,$data->{tagfield} ;
-	push @subfield,$data->{subfield} ;
-	}
-   	 my $facet =  {
-      	 link_value =>"kohafield=$kohafield",
-        	label_value =>$label,
-        	tags => \@tags,
-        	subfield =>\@subfield,
-        	} ;
-	 push @facets,$facet;
-}
-  return \@facets;
-}
-
-
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Team
-
-=cut

Index: modules/C4/Labels.pm
===================================================================
RCS file: modules/C4/Labels.pm
diff -N modules/C4/Labels.pm
--- modules/C4/Labels.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,457 +0,0 @@
-package C4::Labels;
-
-# Copyright 2006 Katipo Communications.
-#
-# 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 strict;
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT);
-#use Data::Dumper;
-use PDF::Reuse;
-
-
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Labels - Functions for printing spine labels and barcodes in Koha
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-  	&get_label_options &get_label_items
-  	&build_circ_barcode &draw_boundaries
-	&draw_box
-);
-
-=item get_label_options;
-
-	$options = get_label_options()
-
-
-Return a pointer on a hash list containing info from labels_conf table in Koha DB.
-
-=cut
-#'
-sub get_label_options {
-    my $dbh    = C4::Context->dbh;
-    my $query2 = " SELECT * FROM labels_conf LIMIT 1 ";
-    my $sth    = $dbh->prepare($query2);
-    $sth->execute();
-    my $conf_data = $sth->fetchrow_hashref;
-    $sth->finish;
-    return $conf_data;
-}
-
-=item get_label_items;
-
-        $options = get_label_items()
-
-
-Returns an array of references-to-hash, whos keys are the field from the biblio, biblioitems, items and labels tables in the Koha database.
-
-=cut
-#'
-sub get_label_items {
-    my $dbh = C4::Context->dbh;
-
-    # get the actual items to be printed.
-    my @data;
-    my $query3 = " Select * from labels ";
-    my $sth    = $dbh->prepare($query3);
-    $sth->execute();
-    my @resultsloop;
-    my $cnt = $sth->rows;
-    my $i1  = 1;
-    while ( my $data = $sth->fetchrow_hashref ) {
-
-        # lets get some summary info from each item
-        my $query1 =
-          " select * from biblio, biblioitems, items where itemnumber = ? and
-                                items.biblioitemnumber=biblioitems.biblioitemnumber and
-                                biblioitems.biblionumber=biblio.biblionumber";
-
-        my $sth1 = $dbh->prepare($query1);
-        $sth1->execute( $data->{'itemnumber'} );
-        my $data1 = $sth1->fetchrow_hashref();
-
-        push( @resultsloop, $data1 );
-        $sth1->finish;
-
-        $i1++;
-    }
-    $sth->finish;
-    return @resultsloop;
-}
-
-=item build_circ_barcode;
-
-  build_circ_barcode( $x_pos, $y_pos, $barcode,
-	        $barcodetype, \$item);
-
-$item is the result of a previous call to get_label_items();
-
-=cut
-#'
-sub build_circ_barcode {
-    my ( $x_pos_circ, $y_pos, $value, $barcodetype, $item ) = @_;
-
-#warn Dumper \$item;
-
-    #warn "value = $value\n";
-
-    #$DB::single = 1;
-
-    if ( $barcodetype eq 'EAN13' ) {
-
-        #testing EAN13 barcodes hack
-        $value = $value . '000000000';
-        $value =~ s/-//;
-        $value = substr( $value, 0, 12 );
-
-        #warn $value;
-        eval {
-            PDF::Reuse::Barcode::EAN13(
-                x     => ( $x_pos_circ + 27 ),
-                y     => ( $y_pos + 15 ),
-                value => $value,
-
-                #            prolong => 2.96,
-                #            xSize   => 1.5,
-
-                # ySize   => 1.2,
-
-# added for xpdf compat. doesnt use type3 fonts., but increases filesize from 20k to 200k
-# i think its embedding extra fonts in the pdf file.
-#  mode => 'graphic',
-            );
-        };
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "EAN13BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-    elsif ( $barcodetype eq 'Code39' ) {
-
-        eval {
-            PDF::Reuse::Barcode::Code39(
-                x     => ( $x_pos_circ + 9 ),
-                y     => ( $y_pos + 15 ),
-                value => $value,
-
-                #           prolong => 2.96,
-                xSize => .85,
-
-                ySize => 1.3,
-            );
-        };
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "CODE39BARCODE $value FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-
-    elsif ( $barcodetype eq 'Matrix2of5' ) {
-
-        #warn "MATRIX ELSE:";
-
-        #testing MATRIX25  barcodes hack
-        #    $value = $value.'000000000';
-        $value =~ s/-//;
-
-        #    $value = substr( $value, 0, 12 );
-        #warn $value;
-
-        eval {
-            PDF::Reuse::Barcode::Matrix2of5(
-                x     => ( $x_pos_circ + 27 ),
-                y     => ( $y_pos + 15 ),
-                value => $value,
-
-                #        prolong => 2.96,
-                #       xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-
-    elsif ( $barcodetype eq 'EAN8' ) {
-
-        #testing ean8 barcodes hack
-        $value = $value . '000000000';
-        $value =~ s/-//;
-        $value = substr( $value, 0, 8 );
-
-        #warn $value;
-
-        #warn "EAN8 ELSEIF";
-        eval {
-            PDF::Reuse::Barcode::EAN8(
-                x       => ( $x_pos_circ + 42 ),
-                y       => ( $y_pos + 15 ),
-                value   => $value,
-                prolong => 2.96,
-                xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-
-    elsif ( $barcodetype eq 'UPC-E' ) {
-        eval {
-            PDF::Reuse::Barcode::UPCE(
-                x       => ( $x_pos_circ + 27 ),
-                y       => ( $y_pos + 15 ),
-                value   => $value,
-                prolong => 2.96,
-                xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-    elsif ( $barcodetype eq 'NW7' ) {
-        eval {
-            PDF::Reuse::Barcode::NW7(
-                x       => ( $x_pos_circ + 27 ),
-                y       => ( $y_pos + 15 ),
-                value   => $value,
-                prolong => 2.96,
-                xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-    elsif ( $barcodetype eq 'ITF' ) {
-        eval {
-            PDF::Reuse::Barcode::ITF(
-                x       => ( $x_pos_circ + 27 ),
-                y       => ( $y_pos + 15 ),
-                value   => $value,
-                prolong => 2.96,
-                xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-    elsif ( $barcodetype eq 'Industrial2of5' ) {
-        eval {
-            PDF::Reuse::Barcode::Industrial2of5(
-                x       => ( $x_pos_circ + 27 ),
-                y       => ( $y_pos + 15 ),
-                value   => $value,
-                prolong => 2.96,
-                xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-    elsif ( $barcodetype eq 'IATA2of5' ) {
-        eval {
-            PDF::Reuse::Barcode::IATA2of5(
-                x       => ( $x_pos_circ + 27 ),
-                y       => ( $y_pos + 15 ),
-                value   => $value,
-                prolong => 2.96,
-                xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-
-    elsif ( $barcodetype eq 'COOP2of5' ) {
-        eval {
-            PDF::Reuse::Barcode::COOP2of5(
-                x       => ( $x_pos_circ + 27 ),
-                y       => ( $y_pos + 15 ),
-                value   => $value,
-                prolong => 2.96,
-                xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-    elsif ( $barcodetype eq 'UPC-A' ) {
-
-        eval {
-            PDF::Reuse::Barcode::UPCA(
-                x       => ( $x_pos_circ + 27 ),
-                y       => ( $y_pos + 15 ),
-                value   => $value,
-                prolong => 2.96,
-                xSize   => 1.5,
-
-                # ySize   => 1.2,
-            );
-        };
-        if ($@) {
-            $item->{'barcodeerror'} = 1;
-            #warn "BARCODE FAILED:$@";
-        }
-
-        #warn $barcodetype;
-
-    }
-
-}
-
-=item draw_boundaries
-
- sub draw_boundaries ($x_pos_spine, $x_pos_circ1, $x_pos_circ2,
-                $y_pos, $spine_width, $label_height, $circ_width)  
-
-This sub draws boundary lines where the label outlines are, to aid in printer testing, and debugging.
-
-=cut
-
-#'
-sub draw_boundaries {
-
-	my ($x_pos_spine, $x_pos_circ1, $x_pos_circ2, 
-		$y_pos, $spine_width, $label_height, $circ_width) = @_;
-
-    my $y_pos_initial = ( ( 792 - 36 ) - 90 );
-    my $y_pos         = $y_pos_initial;
-    my $i             = 1;
-
-    for ( $i = 1 ; $i <= 8 ; $i++ ) {
-
-        &drawbox( $x_pos_spine, $y_pos, ($spine_width), ($label_height) );
-
-   #warn "OLD BOXES  x=$x_pos_spine, y=$y_pos, w=$spine_width, h=$label_height";
-        &drawbox( $x_pos_circ1, $y_pos, ($circ_width), ($label_height) );
-        &drawbox( $x_pos_circ2, $y_pos, ($circ_width), ($label_height) );
-
-        $y_pos = ( $y_pos - $label_height );
-
-    }
-}
-
-=item drawbox
-
-	sub drawbox { 	$lower_left_x, $lower_left_y, 
-			$upper_right_x, $upper_right_y )
-
-this is a low level sub, that draws a pdf box, it is called by draw_boxes
-
-=cut
-
-#'
-sub drawbox {
-    my ( $llx, $lly, $urx, $ury ) = @_;
-
-    my $str = "q\n";    # save the graphic state
-    $str .= "1.0 0.0 0.0  RG\n";           # border color red
-    $str .= "1 1 1  rg\n";                 # fill color blue
-    $str .= "$llx $lly $urx $ury re\n";    # a rectangle
-    $str .= "B\n";                         # fill (and a little more)
-    $str .= "Q\n";                         # save the graphic state
-
-    prAdd($str);
-
-}
-
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Mason James <mason at katipo.co.nz>
-=cut
-

Index: modules/C4/Letters.pm
===================================================================
RCS file: modules/C4/Letters.pm
diff -N modules/C4/Letters.pm
--- modules/C4/Letters.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,274 +0,0 @@
-package C4::Letters;
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-use Mail::Sendmail;
-use C4::Date;
-use C4::Suggestions;
-use C4::Members;
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Letters - Give functions for Letters management
-
-=head1 SYNOPSIS
-
-  use C4::Letters;
-
-=head1 DESCRIPTION
-
-  "Letters" is the tool used in Koha to manage informations sent to the patrons and/or the library. This include some cron jobs like
-  late issues, as well as other tasks like sending a mail to users that have subscribed to a "serial issue alert" (= being warned every time a new issue has arrived at the library)
-  
-  Letters are managed through "alerts" sent by Koha on some events. All "alert" related functions are in this module too.
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&GetLetterList &getletter &addalert &getalert &delalert &findrelatedto &sendalerts);
-
-=head2 GetLetterList
-
-	parameter : $module : the name of the module
-	This sub returns an array of hashes with all letters from a given module
-	Each hash entry contains :
-	- module : the module name
-	- code : the code of the letter, char(20)
-	- name : the complete name of the letter, char(200)
-	- title : the title that will be used as "subject" in mails, char(200)
-	- content : the content of the letter. Each field to be replaced by a value at runtime is enclosed in << and >>. The fields usually have the same name as in the DB 
-
-=cut
-
-sub GetLetterList {
-	my ($module) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("select * from letter where module=?");
-	$sth->execute($module);
-	my @result;
-	while (my $line = $sth->fetchrow_hashref) {
-		push @result,$line;
-	}
-	return @result;
-}
-
-sub getletter {
-	my ($module,$code) = @_;
-	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;
-}
-
-=head2 addalert
-
-	parameters : 
-	- $borrowernumber : the number of the borrower subscribing to the alert
-	- $type : the type of alert.
-	- externalid : the primary key of the object to put alert on. For issues, the alert is made on subscriptionid.
-
-	create an alert and return the alertid (primary key)
-	
-=cut
-
-sub addalert {
-	my ($borrowernumber,$type,$externalid) = @_;
-	my $dbh=C4::Context->dbh;
-	my $sth = $dbh->prepare("insert into alert (borrowernumber, type, externalid) values (?,?,?)");
-	$sth->execute($borrowernumber,$type,$externalid);
-	# get the alert number newly created and return it
-	my $alertid = $dbh->{'mysql_insertid'};
-	return $alertid;
-}
-
-=head2 delalert
-	parameters :
-	- alertid : the alert id
-	deletes the alert
-=cut
-
-sub delalert {
-	my ($alertid)=@_;
-# 	warn "ALERTID : $alertid";
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("delete from alert where alertid=?");
-	$sth->execute($alertid);
-}
-
-=head2 getalert
-
-	parameters :
-	- $borrowernumber : the number of the borrower subscribing to the alert
-	- $type : the type of alert.
-	- externalid : the primary key of the object to put alert on. For issues, the alert is made on subscriptionid.
-	all parameters NON mandatory. If a parameter is omitted, the query is done without the corresponding parameter. For example, without $externalid, returns all alerts for a borrower on a topic.
-	
-=cut
-
-sub getalert {
-	my ($borrowernumber,$type,$externalid) = @_;
-	my $dbh=C4::Context->dbh;
-	my $query = "select * from alert where";
-	my @bind;
-	if ($borrowernumber) {
-		$query .= " borrowernumber=? and";
-		push @bind,$borrowernumber;
-	}
-	if ($type) {
-		$query .= " type=? and";
-		push @bind,$type;
-	}
-	if ($externalid) {
-		$query .= " externalid=? and";
-		push @bind,$externalid;
-	}
-	$query =~ s/ and$//;
-	my $sth = $dbh->prepare($query);
-	$sth->execute(@bind);
-	my @result;
-	while (my $line = $sth->fetchrow_hashref) {
-		push @result,$line;
-	}
-	return \@result if $#result >=0; # return only if there is one result.
-	return;
-}
-
-=head2 findrelatedto
-	parameters :
-	- $type : the type of alert
-	- $externalid : the id of the "object" to query
-	
-	In the table alert, a "id" is stored in the externalid field. This "id" is related to another table, depending on the type of the alert.
-	When type=issue, the id is related to a subscriptionid and this sub returns the name of the biblio.
-	When type=virtual, the id is related to a virtual shelf and this sub returns the name of the sub
-=cut
-
-sub findrelatedto {
-	my ($type,$externalid) = @_;
-	my $dbh=C4::Context->dbh;
-	my $sth;
-	if ($type eq 'issue') {
-		$sth=$dbh->prepare("select title as result from subscription left join biblio on subscription.biblionumber=biblio.biblionumber where subscriptionid=?");
-	}
-	if ($type eq 'borrower') {
-		$sth=$dbh->prepare("select concat(firstname,' ',surname) from borrowers where borrowernumber=?");
-	}
-	$sth->execute($externalid);
-	my ($result) = $sth->fetchrow;
-	return $result;
-}
-
-=head2 sendalert
-	parameters :
-	- $type : the type of alert
-	- $externalid : the id of the "object" to query
-	- $letter : 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 $dbh=C4::Context->dbh;
-	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/<<LibrarianFirstname>>/$userenv->{firstname}/g;
-		$letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
-		$letter->{content} =~ s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
-		# parsing biblio information
-		parseletter($letter,'biblio',$biblionumber);
-		parseletter($letter,'biblioitems',$biblionumber);
-		# find the list of borrowers to alert
-		my $alerts = getalert('','issue',$externalid);
-		foreach (@$alerts) {
-			# and parse borrower ...
-			my $innerletter = $letter;
-			my $borinfo = getmember('',$_->{'borrowernumber'});
-			parseletter($innerletter,'borrowers',$_->{'borrowernumber'});
-			# ... then send mail
-			if ($borinfo->{emailaddress}) {
-				my %mail = ( To => $borinfo->{emailaddress},
-							From => $userenv->{emailaddress},
-							Subject => "".$innerletter->{title},
-							Message => "".$innerletter->{content},
-							);
-				sendmail(%mail);
-# 				warn "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}";
-			}
-		}
-	}
-}
-
-=head2
-	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)
-=cut
-sub parseletter {
-	my ($letter,$table,$pk) = @_;
-# 	warn "Parseletter : ($letter,$table,$pk)";
-	my $dbh=C4::Context->dbh;
-	my $sth;
-	if ($table eq 'biblio') {
-		$sth = $dbh->prepare("select * from biblio where biblionumber=?");
-	} elsif ($table eq 'biblioitems') {
-		$sth = $dbh->prepare("select * from biblioitems where biblionumber=?");
-	} elsif ($table eq 'borrowers') {
-		$sth = $dbh->prepare("select * from borrowers where borrowernumber=?");
-	} elsif ($table eq 'branches') {
-		$sth = $dbh->prepare("select * from branches where branchcode=?");
-	}
-	$sth->execute($pk);
-	# store the result in an hash
-	my $values = $sth->fetchrow_hashref;
-	# and get all fields from the table
-	$sth = $dbh->prepare("show columns from $table");
-	$sth->execute;
-	while ((my $field) = $sth->fetchrow_array) {
-		my $replacefield="<<$table.$field>>";
-		my $replacedby = $values->{$field};
-# 		warn "REPLACE $replacefield by $replacedby";
-		$letter->{title} =~ s/$replacefield/$replacedby/g;
-		$letter->{content} =~ s/$replacefield/$replacedby/g;
-	}
-}
-
-END { }       # module clean-up code here (global destructor)

Index: modules/C4/Log.pm
===================================================================
RCS file: modules/C4/Log.pm
diff -N modules/C4/Log.pm
--- modules/C4/Log.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,202 +0,0 @@
-package C4::Log; #assumes C4/Log
-
-#package to deal with Logging Actions in DB
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-use C4::Context;
-use C4::Date;
-
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Log - Koha Log Facility functions
-
-=head1 SYNOPSIS
-
-  use C4::Log;
-
-=head1 DESCRIPTION
-
-The functions in this module perform various functions in order to log all the operations done on the Database, including deleting and undeleting books, adding/editing members, etc.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&logaction &logstatus &displaylog);
-
-=item logaction
-
-  &logaction($usernumber, $modulename, $actionname, $infos);
-
-Adds a record into action_logs table to report the different changes upon the database
-
-=cut
-#'
-sub logaction{
-  my ($usernumber,$modulename, $actionname, $objectnumber, $infos)=@_;
-	$usernumber='' unless $usernumber;
-	my $dbh = C4::Context->dbh;
-	my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)");
-	$sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos);
-	$sth->finish;
-}
-
-=item logstatus
-
-  &logstatus;
-
-returns True If Activate_Log variable is equal to On
-Activate_Log is a system preference Variable
-=cut
-#'
-sub logstatus{
-	return C4::Context->preference("Activate_Log");
-}
-
-=item displaylog
-
-  &displaylog($modulename, @filters);
-  $modulename is the name of the module on which the user wants to display logs
-  @filters is an optional table of hash containing :
-  	- name : the name of the variable to filter
-	- value : the value of the filter.... May be with * joker
-
-returns a table of hash containing who did what on which object at what time
-
-=cut
-#'
-sub displaylog{
-  my ($modulename, @filters)=@_;
-	my $dbh = C4::Context->dbh;
-	my $strsth;
-	if ($modulename eq "cataloguing"){
-		$strsth="select action_logs.timestamp, action_logs.action, action_logs.info, borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid,";
-		$strsth .= "biblio.biblionumber, biblio.title, biblio.author" ;#if ($modulename eq "acqui.simple");
-		$strsth .= " FROM borrowers,action_logs ";
-		$strsth .= ",biblio " ;#if ($modulename eq "acqui.simple");
-	
-		$strsth .=" WHERE borrowers.borrowernumber=action_logs.user";
-		$strsth .=" AND action_logs.module = 'cataloguing' AND action_logs.object=biblio.biblionumber ";# if ($modulename eq "acqui.simple");
-		if (@filters){
-			foreach my $filter (@filters){
-				if ($filter->{name} =~ /user/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND borrowers.surname like ".$filter->{value};
-				}elsif ($filter->{name} =~ /title/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND biblio.title like ".$filter->{value};
-				}elsif ($filter->{name} =~ /author/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND biblio.author like ".$filter->{value};
-				}
-			}
-		}
-	} elsif ($modulename eq "circulation")  {
-		$strsth="select a.timestamp, a.action, a.info,a.object, b.cardnumber, b.surname, b.firstname, bi.biblionumber, bi.title, bi.author,b2.firstname as first,b2.surname as last FROM action_logs a ";
-		
-		$strsth.=" LEFT JOIN borrowers b on b.borrowernumber=a.user ";
-		$strsth.=" LEFT JOIN borrowers b2 on b2.borrowernumber=a.info ";
-		$strsth.=" LEFT JOIN items i on i.barcode=a.object ";
-		$strsth.=" LEFT JOIN biblio bi on bi.biblionumber=i.biblionumber";
-		$strsth .= " WHERE a.module = 'circulation' ";# if ($modulename eq "circulation");
-		if (@filters){
-			foreach my $filter (@filters){
-				if ($filter->{name} =~ /user/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND borrowers.surname like ".$filter->{value};
-				}elsif ($filter->{name} =~ /title/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND biblio.title like ".$filter->{value};
-				}elsif ($filter->{name} =~ /action/){
-					$strsth .= " AND a.action= '$filter->{value}'";
-				}elsif ($filter->{name} =~ /from/){
-					$strsth .= " AND a.timestamp> '$filter->{value}'";
-				}elsif ($filter->{name} =~ /to/){
-					$strsth .= " AND a.timestamp<= '$filter->{value}'";
-				}
-			}
-		}
-	} elsif ($modulename eq "members"){
-		$strsth="select a.timestamp, a.action,a.info, a.object, b.surname, b.firstname, ";
-		$strsth .= "bor2.cardnumber as card, bor2.surname as last, bor2.firstname as first, bor2.userid as user";
-		$strsth .= " FROM action_logs a ";
-		$strsth.=" LEFT JOIN borrowers b on b.borrowernumber=a.user ";
-		$strsth.=" LEFT JOIN borrowers bor2 on bor2.borrowernumber=a.object ";
-		$strsth .= " WHERE a.module = 'members'  ";# if ($modulename eq "acqui.simple");
-		if (@filters){
-			foreach my $filter (@filters){
-				if ($filter->{name} =~ /user/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND b.surname like ".$filter->{value};
-				}elsif ($filter->{name} =~ /surname/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND bor2.surname like ".$filter->{value};
-				}elsif ($filter->{name} =~ /firstname/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND bor2.firsntame like ".$filter->{value};
-				}elsif ($filter->{name} =~ /cardnumber/){
-					$filter->{value}=~s/\*/%/g;
-					$strsth .= " AND bor2.cardnumber like ".$filter->{value};
-				}elsif ($filter->{name} =~ /action/){
-					$strsth .= " AND a.action= '$filter->{value}'";
-				}
-			}
-		}
-	}
-#	warn "displaylog :".$strsth;
-	if ($strsth){
-		my $sth=$dbh->prepare($strsth);
-		$sth->execute;
-		my @results;
-		my $count;
-		my $hilighted=1;
-		while (my $data = $sth->fetchrow_hashref){
-			$data->{hilighted} = ($hilighted>0);
-			$data->{info} =~ s/\n/<br\/>/g;
-			$data->{day} = format_date($data->{timestamp});
-			push @results, $data;
-			$count++;
-			$hilighted = -$hilighted;
-		}
-		return ($count, \@results);
-	} else {return 0;}
-}
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Members.pm
===================================================================
RCS file: modules/C4/Members.pm
diff -N modules/C4/Members.pm
--- modules/C4/Members.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,1655 +0,0 @@
-# -*- tab-width: 8 -*-
-
-package C4::Members;
-
-# Copyright 2000-2003 Katipo Communications
-#
-# 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
-
-# $Id: Members.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-use strict;
-require Exporter;
-use C4::Context;
-use C4::Date;
-use Digest::MD5 qw(md5_base64);
-use C4::Biblio;
-use C4::Stats;
-use C4::Reserves2;
-use C4::Koha;
-use C4::Accounts2;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
-
-=head1 NAME
-
-C4::Members - Perl Module containing convenience functions for member handling
-
-=head1 SYNOPSIS
-
-use C4::Members;
-
-=head1 DESCRIPTION
-
-This module contains routines for adding, modifying and deleting members/patrons/borrowers 
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
-#'
-
- at ISA    = qw(Exporter);
-
- at EXPORT = qw(
-&allissues
-&add_member_orgs
-&borrdata 
-&borrdata2 
-&borrdata3
-&BornameSearch 
-&borrissues
-&borrowercard_active
-&borrowercategories
-&change_user_pass
-&checkuniquemember 
-&calcexpirydate 
-&checkuserpassword
-&ethnicitycategories 
-&fixEthnicity
-&fixup_cardnumber 
-&findguarantees 
-&findguarantor  
-&fixupneu_cardnumber
-&getmember 
-&getMemberPhoto 
-&get_institutions
-&getzipnamecity 
-&getidcity 
-&getguarantordata 
-&getcategorytype
-&getboracctrecord
-&getborrowercategory
-&getborrowercategoryinfo
-&get_age 
-&getpatroninformation
-&GetBorrowersFromSurname 
-&GetBranchCodeFromBorrowers
-&GetFlagsAndBranchFromBorrower
-&GuarantornameSearch
-&NewBorrowerNumber 
-&modmember 
-&newmember 
-&expand_sex_into_predicate
-&patronflags
-	);
-
-
-
-=head2 borrowercategories
-
-  ($codes_arrayref, $labels_hashref) = &borrowercategories();
-
-Looks up the different types of borrowers in the database. Returns two
-elements: a reference-to-array, which lists the borrower category
-codes, and a reference-to-hash, which maps the borrower category codes
-to category descriptions.
-
-=cut
-#'
-
-sub borrowercategories {
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("Select categorycode,description from categories order by description");
-    $sth->execute;
-    my %labels;
-    my @codes;
-    while (my $data=$sth->fetchrow_hashref){
-      push @codes,$data->{'categorycode'};
-      $labels{$data->{'categorycode'}}=$data->{'description'};
-    }
-    $sth->finish;
-    return(\@codes,\%labels);
-}
-
-=item BornameSearch
-
-  ($count, $borrowers) = &BornameSearch($env, $searchstring, $type);
-
-Looks up patrons (borrowers) by name.
-
-C<$env> is ignored.
-
-BUGFIX 499: C<$type> is now used to determine type of search.
-if $type is "simple", search is performed on the first letter of the
-surname only.
-
-C<$searchstring> is a space-separated list of search terms. Each term
-must match the beginning a borrower's surname, first name, or other
-name.
-
-C<&BornameSearch> returns a two-element list. C<$borrowers> is a
-reference-to-array; each element is a reference-to-hash, whose keys
-are the fields of the C<borrowers> table in the Koha database.
-C<$count> is the number of elements in C<$borrowers>.
-
-=cut
-#'
-#used by member enquiries from the intranet
-#called by member.pl
-sub BornameSearch  {
-	my ($env,$searchstring,$orderby,$type)=@_;
-	my $dbh = C4::Context->dbh;
-	my $query = ""; 
-	my $count; 
-	my @data;
-	my @bind=();
-
-	if($type eq "simple")	# simple search for one letter only
-	{
-		$query="Select * from borrowers where surname like '$searchstring%' order by $orderby";
-#		@bind=("$searchstring%");
-	}
-	else	# advanced search looking in surname, firstname and othernames
-	{
-### Try to determine whether numeric like cardnumber
-	if ($searchstring+1>1) {
-	$query="Select * from borrowers where  cardnumber  like '$searchstring%' ";
-
-	}else{
-	
-	my @words=split / /,$searchstring;
-	foreach my $word(@words){
-	$word="+".$word;
-	
-	}
-	$searchstring=join " ", at words;
-	
-		$query="Select * from borrowers where  MATCH(surname,firstname,othernames) AGAINST('$searchstring'  in boolean mode)";
-
-	}
-		$query=$query." order by $orderby";
-	}
-
-	my $sth=$dbh->prepare($query);
-#	warn "Q $orderby : $query";
-	$sth->execute();
-	my @results;
-	my $cnt=$sth->rows;
-	while (my $data=$sth->fetchrow_hashref){
-	push(@results,$data);
-	}
-	#  $sth->execute;
-	$sth->finish;
-	return ($cnt,\@results);
-}
-=head2 getpatroninformation
-
-  ($borrower, $flags) = &getpatroninformation($env, $borrowernumber, $cardnumber);
-Looks up a patron and returns information about him or her. If
-C<$borrowernumber> is true (nonzero), C<&getpatroninformation> looks
-up the borrower by number; otherwise, it looks up the borrower by card
-number.
-C<$env> is effectively ignored, but should be a reference-to-hash.
-C<$borrower> is a reference-to-hash whose keys are the fields of the
-borrowers table in the Koha database. In addition,
-C<$borrower-E<gt>{flags}> is a hash giving more detailed information
-about the patron. Its keys act as flags :
-
-	if $borrower->{flags}->{LOST} {
-		# Patron's card was reported lost
-	}
-
-Each flag has a C<message> key, giving a human-readable explanation of
-the flag. If the state of a flag means that the patron should not be
-allowed to borrow any more books, then it will have a C<noissues> key
-with a true value.
-
-The possible flags are:
-
-=head3 CHARGES
-
-=over 4
-
-Shows the patron's credit or debt, if any.
-
-=back
-
-=head3 GNA
-
-=over 4
-
-(Gone, no address.) Set if the patron has left without giving a
-forwarding address.
-
-=back
-
-=head3 LOST
-
-=over 4
-
-Set if the patron's card has been reported as lost.
-
-=back
-
-=head3 DBARRED
-
-=over 4
-
-Set if the patron has been debarred.
-
-=back
-
-=head3 NOTES
-
-=over 4
-
-Any additional notes about the patron.
-
-=back
-
-=head3 ODUES
-
-=over 4
-
-Set if the patron has overdue items. This flag has several keys:
-
-C<$flags-E<gt>{ODUES}{itemlist}> is a reference-to-array listing the
-overdue items. Its elements are references-to-hash, each describing an
-overdue item. The keys are selected fields from the issues, biblio,
-biblioitems, and items tables of the Koha database.
-
-C<$flags-E<gt>{ODUES}{itemlist}> is a string giving a text listing of
-the overdue items, one per line.
-
-=back
-
-=head3 WAITING
-
-=over 4
-
-Set if any items that the patron has reserved are available.
-
-C<$flags-E<gt>{WAITING}{itemlist}> is a reference-to-array listing the
-available items. Each element is a reference-to-hash whose keys are
-fields from the reserves table of the Koha database.
-
-=back
-
-=back
-
-=cut
-
-sub getpatroninformation {
-# returns
-	my ($env, $borrowernumber,$cardnumber) = @_;
-	my $dbh = C4::Context->dbh;
-	my $query;
-	my $sth;
-	if ($borrowernumber) {
-		$sth = $dbh->prepare("select * from borrowers where borrowernumber=?");
-		$sth->execute($borrowernumber);
-	} elsif ($cardnumber) {
-		$sth = $dbh->prepare("select * from borrowers where cardnumber=?");
-		$sth->execute($cardnumber);
-	} else {
-		$env->{'apierror'} = "invalid borrower information passed to getpatroninformation subroutine";
-		return();
-	}
-	my $borrower = $sth->fetchrow_hashref;
-	my $amount = C4::Accounts2::checkaccount($env, $borrowernumber, $dbh);
-	$borrower->{'amountoutstanding'} = $amount;
-	my $flags = patronflags($env, $borrower, $dbh);
-	my $accessflagshash;
- 
-	$sth=$dbh->prepare("select bit,flag from userflags");
-	$sth->execute;
-	while (my ($bit, $flag) = $sth->fetchrow) {
-		if ($borrower->{'flags'} & 2**$bit) {
-		$accessflagshash->{$flag}=1;
-		}
-	}
-	$sth->finish;
-	$borrower->{'flags'}=$flags;
-	$borrower->{'authflags'} = $accessflagshash;
-	return ($borrower); #, $flags, $accessflagshash);
-}
-
-=item getmember
-
-  $borrower = &getmember($cardnumber, $borrowernumber);
-
-Looks up information about a patron (borrower) by either card number
-or borrower number. If $borrowernumber is specified, C<&borrdata>
-searches by borrower number; otherwise, it searches by card number.
-
-C<&getmember> returns a reference-to-hash whose keys are the fields of
-the C<borrowers> table in the Koha database.
-
-=cut
-
-=head3 GetFlagsAndBranchFromBorrower
-
-=over 4
-
-($flags, $homebranch) = GetFlagsAndBranchFromBorrower($loggedinuser);
-
-this function read on the database to get flags and homebranch for a user
-given on input arg.
-
-return : 
-it returns the $flags & the homebranch in scalar context.
-
-=back
-
-=cut
-
-
-
-=item borrissues
-
-  ($count, $issues) = &borrissues($borrowernumber);
-
-Looks up what the patron with the given borrowernumber has borrowed.
-
-C<&borrissues> returns a two-element array. C<$issues> is a
-reference-to-array, where each element is a reference-to-hash; the
-keys are the fields from the C<issues>, C<biblio>, and C<items> tables
-in the Koha database. C<$count> is the number of elements in
-C<$issues>.
-
-=cut
-#'
-sub borrissues {
-  my ($bornum)=@_;
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("Select * from issues,biblio,items where borrowernumber=?
-   and items.itemnumber=issues.itemnumber
-	and items.biblionumber=biblio.biblionumber
-	and issues.returndate is NULL order by date_due");
-    $sth->execute($bornum);
-  my @result;
-  while (my $data = $sth->fetchrow_hashref) {
-    push @result, $data;
-  }
-  $sth->finish;
-  return(scalar(@result), \@result);
-}
-
-=item allissues
-
-  ($count, $issues) = &allissues($borrowernumber, $sortkey, $limit);
-
-Looks up what the patron with the given borrowernumber has borrowed,
-and sorts the results.
-
-C<$sortkey> is the name of a field on which to sort the results. This
-should be the name of a field in the C<issues>, C<biblio>,
-C<biblioitems>, or C<items> table in the Koha database.
-
-C<$limit> is the maximum number of results to return.
-
-C<&allissues> returns a two-element array. C<$issues> is a
-reference-to-array, where each element is a reference-to-hash; the
-keys are the fields from the C<issues>, C<biblio>, C<biblioitems>, and
-C<items> tables of the Koha database. C<$count> is the number of
-elements in C<$issues>
-
-=cut
-#'
-sub allissues {
-  my ($bornum,$order,$limit)=@_;
-  #FIXME: sanity-check order and limit
-  my $dbh = C4::Context->dbh;
-  my $query="Select * from issues,biblio,items
-  where borrowernumber=? and
-  items.itemnumber=issues.itemnumber and
-  items.biblionumber=biblio.biblionumber order by $order";
-  if ($limit !=0){
-    $query.=" limit $limit";
-  }
-  #print $query;
-  my $sth=$dbh->prepare($query);
-  $sth->execute($bornum);
-  my @result;
-  my $i=0;
-  while (my $data=$sth->fetchrow_hashref){
-    $result[$i]=$data;;
-    $i++;
-  }
-  $sth->finish;
-  return($i,\@result);
-}
-
-
-sub borrdata3 {
-## NEU specific. used in Reserve section issues
-  my ($env,$bornum)=@_;
-  my $dbh = C4::Context->dbh;
-  my $query="Select count(*) from  reserveissue as r where r.borrowernumber='$bornum' 
-     and rettime is null";
-    # print $query;
-  my $sth=$dbh->prepare($query);
-  $sth->execute;
-  my $data=$sth->fetchrow_hashref;
-  $sth->finish;
-  $sth=$dbh->prepare("Select count(*),timediff(now(),  duetime  ) as elapsed, hour(timediff(now(),  duetime  )) as hours, MINUTE(timediff(now(),  duetime  )) as min from 
-    reserveissue as r where  r.borrowernumber='$bornum' and rettime is null and duetime< now() group by r.borrowernumber");
-  $sth->execute;
-
-  my $data2=$sth->fetchrow_hashref;
-my $resfine;
-my $rescharge=C4::Context->preference('resmaterialcharge');
-	if (!$rescharge){
-	$rescharge=1;
-	}
-	if ($data2->{'elapsed'}>0){
-	 $resfine=($data2->{'hours'}+$data2->{'min'}/60)*$rescharge;
-	$resfine=sprintf  ("%.1f",$resfine);
-	}
-  $sth->finish;
-  $sth=$dbh->prepare("Select sum(amountoutstanding) from accountlines where
-    borrowernumber='$bornum'");
-  $sth->execute;
-  my $data3=$sth->fetchrow_hashref;
-  $sth->finish;
-
-
-return($data2->{'count(*)'},$data->{'count(*)'},$data3->{'sum(amountoutstanding)'},$resfine);
-}
-=item getboracctrecord
-
-  ($count, $acctlines, $total) = &getboracctrecord($env, $borrowernumber);
-
-Looks up accounting data for the patron with the given borrowernumber.
-
-C<$env> is ignored.
-
-
-C<&getboracctrecord> returns a three-element array. C<$acctlines> is a
-reference-to-array, where each element is a reference-to-hash; the
-keys are the fields of the C<accountlines> table in the Koha database.
-C<$count> is the number of elements in C<$acctlines>. C<$total> is the
-total amount outstanding for all of the account lines.
-
-=cut
-#'
-sub getboracctrecord {
-   my ($env,$params) = @_;
-   my $dbh = C4::Context->dbh;
-   my @acctlines;
-   my $numlines=0;
-   my $sth=$dbh->prepare("Select * from accountlines where
-borrowernumber=? order by date desc,timestamp desc");
-#   print $query;
-   $sth->execute($params->{'borrowernumber'});
-   my $total=0;
-   while (my $data=$sth->fetchrow_hashref){
-      $acctlines[$numlines] = $data;
-      $numlines++;
-      $total += $data->{'amountoutstanding'};
-   }
-   $sth->finish;
-   return ($numlines,\@acctlines,$total);
-}
-
-sub getborrowercategory{
-	my ($catcode) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT description FROM categories WHERE categorycode = ?");
-	$sth->execute($catcode);
-	my $description = $sth->fetchrow();
-	$sth->finish();
-	return $description;
-} # sub getborrowercategory
-
-sub getborrowercategoryinfo{
-	my ($catcode) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM categories WHERE categorycode = ?");
-	$sth->execute($catcode);
-	my $category = $sth->fetchrow_hashref;
-	$sth->finish();
-	return $category;
-} # sub getborrowercategoryinfo
-
-
-sub GetFlagsAndBranchFromBorrower {
-    my $loggedinuser = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = "
-       SELECT flags, branchcode
-       FROM   borrowers
-       WHERE  borrowernumber = ? 
-    ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($loggedinuser);
-
-    return $sth->fetchrow;
-}
-
-
-sub getmember {
-    my ( $cardnumber, $bornum ) = @_;
-    $cardnumber = uc $cardnumber;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if ( $bornum eq '' ) {
-        $sth = $dbh->prepare("Select * from borrowers where cardnumber=?");
-        $sth->execute($cardnumber);
-    } else {
-        $sth = $dbh->prepare("Select * from borrowers where borrowernumber=?");
-        $sth->execute($bornum);
-    }
-    my $data = $sth->fetchrow_hashref;
-    $sth->finish;
-    if ($data) {
-        return ($data);
-    }
-    else {    # try with firstname
-        if ($cardnumber) {
-            my $sth =
-              $dbh->prepare("select * from borrowers where firstname=?");
-            $sth->execute($cardnumber);
-            my $data = $sth->fetchrow_hashref;
-            $sth->finish;
-            return ($data);
-        }
-    }
-    return undef;
-}
-
-=item borrdata
-
-  $borrower = &borrdata($cardnumber, $borrowernumber);
-
-Looks up information about a patron (borrower) by either card number
-or borrower number. If $borrowernumber is specified, C<&borrdata>
-searches by borrower number; otherwise, it searches by card number.
-
-C<&borrdata> returns a reference-to-hash whose keys are the fields of
-the C<borrowers> table in the Koha database.
-
-=cut
-
-#'
-sub borrdata {
-    my ( $cardnumber, $bornum ) = @_;
-    $cardnumber = uc $cardnumber;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if ( $bornum eq '' ) {
-        $sth =
-          $dbh->prepare(
-"Select borrowers.*,categories.category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode where cardnumber=?"
-          );
-        $sth->execute($cardnumber);
-    }
-    else {
-        $sth =
-          $dbh->prepare(
-"Select borrowers.*,categories.category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode where borrowernumber=?"
-          );
-        $sth->execute($bornum);
-    }
-    my $data = $sth->fetchrow_hashref;
-#     warn "DATA" . $data->{category_type};
-    $sth->finish;
-    if ($data) {
-        return ($data);
-    }
-    else {    # try with firstname
-        if ($cardnumber) {
-            my $sth =
-              $dbh->prepare(
-"Select borrowers.*,categories.category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode  where firstname=?"
-              );
-            $sth->execute($cardnumber);
-            my $data = $sth->fetchrow_hashref;
-            $sth->finish;
-            return ($data);
-        }
-    }
-    return undef;
-}
-
-=item borrdata2
-
-  ($borrowed, $due, $fine) = &borrdata2($env, $borrowernumber);
-
-Returns aggregate data about items borrowed by the patron with the
-given borrowernumber.
-
-C<$env> is ignored.
-
-C<&borrdata2> returns a three-element array. C<$borrowed> is the
-number of books the patron currently has borrowed. C<$due> is the
-number of overdue items the patron currently has borrowed. C<$fine> is
-the total fine currently due by the borrower.
-
-=cut
-
-#'
-sub borrdata2 {
-    my ( $env, $bornum ) = @_;
-    my $dbh   = C4::Context->dbh;
-    my $query = "Select count(*) from issues where borrowernumber='$bornum' and
-    returndate is NULL";
-
-    # print $query;
-    my $sth = $dbh->prepare($query);
-    $sth->execute;
-    my $data = $sth->fetchrow_hashref;
-    $sth->finish;
-    $sth = $dbh->prepare(
-        "Select count(*) from issues where
-    borrowernumber='$bornum' and date_due < now() and returndate is NULL"
-    );
-    $sth->execute;
-    my $data2 = $sth->fetchrow_hashref;
-    $sth->finish;
-    $sth = $dbh->prepare(
-        "Select sum(amountoutstanding) from accountlines where
-    borrowernumber='$bornum'"
-    );
-    $sth->execute;
-    my $data3 = $sth->fetchrow_hashref;
-    $sth->finish;
-
-    return ( $data2->{'count(*)'}, $data->{'count(*)'},
-        $data3->{'sum(amountoutstanding)'} );
-}
-
-sub modmember {
-	my (%data) = @_;
-	my $dbh = C4::Context->dbh;
-	$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
-
-
-	$data{'joining'}=format_date_in_iso($data{'joining'});
-	
-	if ($data{'expiry'}) {
-	$data{'expiry'}=format_date_in_iso($data{'expiry'});
-	}else{
-	
-		$data{'expiry'} = calcexpirydate($data{'categorycode'},$data{'joining'} );
-		
-	}
-	
-	my $query= "UPDATE borrowers SET 
-					cardnumber		= '$data{'cardnumber'}'		,
-					surname			= '$data{'surname'}'		,
-					firstname		= '$data{'firstname'}'		,
-					title			= '$data{'title'}'			,
-					initials		= '$data{'initials'}'		,
-					dateofbirth		= '$data{'dateofbirth'}'	,
-					sex				= '$data{'sex'}'			,
-					streetaddress	= '$data{'streetaddress'}'	,
-					streetcity		= '$data{'streetcity'}'		,	
-					zipcode			= '$data{'zipcode'}'		,
-					phoneday		= '$data{'phoneday'}'		,
-					physstreet		= '$data{'physstreet'}'		,	
-					city			= '$data{'city'}'			,
-					homezipcode		= '$data{'homezipcode'}'	,
-					phone			= '$data{'phone'}'			,
-					emailaddress	= '$data{'emailaddress'}'	,
-					preferredcont    = '$data{'preferredcont'}',
-					faxnumber		= '$data{'faxnumber'}'		,
-					textmessaging	= '$data{'textmessaging'}'	,			 
-					categorycode	= '$data{'categorycode'}'	,
-					branchcode		= '$data{'branchcode'}'		,
-					borrowernotes	= '$data{'borrowernotes'}'	,
-					ethnicity		= '$data{'ethnicity'}'		,
-					ethnotes		= '$data{'ethnotes'}'		,
-					expiry			= '$data{'expiry'}'			,
-					dateenrolled	= '$data{'joining'}'		,
-					sort1			= '$data{'sort1'}'			, 
-					sort2			= '$data{'sort2'}'			,	
-					debarred		= '$data{'debarred'}'		,
-					lost			= '$data{'lost'}'			,
-					gonenoaddress   = '$data{'gna'}'			
-			WHERE borrowernumber = $data{'borrowernumber'}";
-	my $sth = $dbh->prepare($query);
-	$sth->execute;
-	$sth->finish;
-	# ok if its an adult (type) it may have borrowers that depend on it as a guarantor
-	# so when we update information for an adult we should check for guarantees and update the relevant part
-	# of their records, ie addresses and phone numbers
-	if ($data{'categorycode'} eq 'A' || $data{'categorycode'} eq 'W'){
-		# is adult check guarantees;
-		updateguarantees(%data);
-	}
-}
-
-sub newmember {
-	my (%data) = @_;
-	my $dbh = C4::Context->dbh;
-	$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
-	
-	
-	if ($data{'joining'}){
-	$data{'joining'}=format_date_in_iso($data{'joining'});
-	}else{
-	$data{'joining'} = get_today();
-	}
-	# if expirydate is not set, calculate it from borrower category subscription duration
-	if ($data{'expiry'}) {
-	$data{'expiry'}=format_date_in_iso($data{'expiry'});
-	}else{
-		
-		$data{'expiry'} = calcexpirydate($data{'categorycode'},$data{'joining'});
-	}
-	
-	my $query= "INSERT INTO borrowers (
-							cardnumber,
-							surname,
-							firstname,
-							title,
-							initials,
-							dateofbirth,
-							sex,
-							streetaddress,
-							streetcity,
-							zipcode,
-							phoneday,
-							physstreet,
-							city,
-							homezipcode,
-							phone,
-							emailaddress,
-							faxnumber,
-							textmessaging,
-							preferredcont,
-							categorycode,
-							branchcode,
-							borrowernotes,
-							ethnicity,
-							ethnotes,
-							expiry,
-							dateenrolled,
-							sort1,
-							sort2
-								) 
-				VALUES (
-							'$data{'cardnumber'}',
-							'$data{'surname'}',
-							'$data{'firstname'}',
-							'$data{'title'}',
-							'$data{'initials'}',
-							'$data{'dateofbirth'}',
-							'$data{'sex'}',
-							
-							'$data{'streetaddress'}',
-							'$data{'streetcity'}',
-							'$data{'zipcode'}',
-							'$data{'phoneday'}',
-							
-							'$data{'physstreet'}',
-							'$data{'city'}',
-							'$data{'homezipcode'}',
-							'$data{'phone'}',
-
-							'$data{'emailaddress'}',
-							'$data{'faxnumber'}',
-							'$data{'textmessaging'}',
-							'$data{'preferredcont'}',
-							'$data{'categorycode'}',
-							'$data{'branchcode'}',
-							'$data{'borrowernotes'}',
-							'$data{'ethnicity'}',
-							'$data{'ethnotes'}',
-							'$data{'expiry'}',
-							'$data{'joining'}',
-							'$data{'sort1'}',
-							'$data{'sort2'}' 
-							)";
-	my $sth=$dbh->prepare($query);
-	$sth->execute;
-	$sth->finish;
-	$data{'bornum'} =$dbh->{'mysql_insertid'};
-	return $data{'bornum'};
-}
-
-sub calcexpirydate {
-    my ( $categorycode, $dateenrolled ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth =
-      $dbh->prepare(
-        "select enrolmentperiod from categories where categorycode=?");
-    $sth->execute($categorycode);
-    my ($enrolmentperiod) = $sth->fetchrow;
-$enrolmentperiod = 1 unless ($enrolmentperiod);#enrolmentperiod in years
-		my $duration=get_duration($enrolmentperiod." years");
-	return	DATE_Add_Duration($dateenrolled,$duration);
-    
-}
-
-=head2 checkuserpassword (OUEST-PROVENCE)
-
-check for the password and login are not used
-return the number of record 
-0=> NOT USED 1=> USED
-
-=cut
-
-sub checkuserpassword {
-    my ( $borrowernumber, $userid, $password ) = @_;
-    $password = md5_base64($password);
-    my $dbh = C4::Context->dbh;
-    my $sth =
-      $dbh->prepare(
-"Select count(*) from borrowers where borrowernumber !=? and userid =? and password=? "
-      );
-    $sth->execute( $borrowernumber, $userid, $password );
-    my $number_rows = $sth->fetchrow;
-    return $number_rows;
-
-}
-sub getmemberfromuserid {
-    my ($userid) = @_;
-    my $dbh      = C4::Context->dbh;
-    my $sth      = $dbh->prepare("select * from borrowers where userid=?");
-    $sth->execute($userid);
-    return $sth->fetchrow_hashref;
-}
-sub updateguarantees {
-    my (%data) = @_;
-    my $dbh = C4::Context->dbh;
-    my ( $count, $guarantees ) = findguarantees( $data{'borrowernumber'} );
-    for ( my $i = 0 ; $i < $count ; $i++ ) {
-
-        # FIXME
-        # It looks like the $i is only being returned to handle walking through
-        # the array, which is probably better done as a foreach loop.
-        #
-        my $guaquery =
-"update borrowers set streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',
-		streetcity='$data{'streetcity'}',phoneday='$data{'phoneday'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}'
-		,streetaddress='$data{'address'}'
-		where borrowernumber='$guarantees->[$i]->{'borrowernumber'}'";
-        my $sth3 = $dbh->prepare($guaquery);
-        $sth3->execute;
-        $sth3->finish;
-    }
-}
-################################################################################
-
-=item fixup_cardnumber
-
-Warning: The caller is responsible for locking the members table in write
-mode, to avoid database corruption.
-
-=cut
-
-use vars qw( @weightings );
-my @weightings = ( 8, 4, 6, 3, 5, 2, 1 );
-
-sub fixup_cardnumber  {
-    my ($cardnumber) = @_;
-    my $autonumber_members = C4::Context->boolean_preference('autoMemberNum');
-    $autonumber_members = 0 unless defined $autonumber_members;
-my $rem;
-    # Find out whether member numbers should be generated
-    # automatically. Should be either "1" or something else.
-    # Defaults to "0", which is interpreted as "no".
-
-    #     if ($cardnumber !~ /\S/ && $autonumber_members) {
-    if ($autonumber_members) {
-        my $dbh = C4::Context->dbh;
-        if ( C4::Context->preference('checkdigit') eq 'katipo' ) {
-
-            # if checkdigit is selected, calculate katipo-style cardnumber.
-            # otherwise, just use the max()
-            # purpose: generate checksum'd member numbers.
-            # We'll assume we just got the max value of digits 2-8 of member #'s
-            # from the database and our job is to increment that by one,
-            # determine the 1st and 9th digits and return the full string.
-            my $sth =
-              $dbh->prepare(
-                "select max(substring(borrowers.cardnumber,2,7)) from borrowers"
-              );
-            $sth->execute;
-
-            my $data = $sth->fetchrow_hashref;
-            $cardnumber = $data->{'max(substring(borrowers.cardnumber,2,7))'};
-            $sth->finish;
-	
-            	if ( !$cardnumber ) {    # If DB has no values,
-                $cardnumber = 1000000;    # start at 1000000
-            	} else {
-                $cardnumber += 1;
-            	}
-
-            my $sum = 0;
-	            for ( my $i = 0 ; $i < 8 ; $i += 1 ) {
-
-                # read weightings, left to right, 1 char at a time
-                my $temp1 = $weightings[$i];
-
-                # sequence left to right, 1 char at a time
-                my $temp2 = substr( $cardnumber, $i, 1 );
-
-                # mult each char 1-7 by its corresponding weighting
-                $sum += $temp1 * $temp2;
-	            }
-
-             $rem = ( $sum % 11 );
-            $rem = 'X' if $rem == 10;
-
-            $cardnumber = "V$cardnumber$rem";
-        }
-        else {
-
-     # MODIFIED BY JF: mysql4.1 allows casting as an integer, which is probably
-     # better. I'll leave the original in in case it needs to be changed for you
-            my $sth =
-              $dbh->prepare(
-                "select max(cast(cardnumber as signed)) from borrowers");
-
-      #my $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers");
-
-            $sth->execute;
-
-	$cardnumber="V$cardnumber$rem";
-    }
-    return $cardnumber;
-}
-}
-sub fixupneu_cardnumber{
-    my($cardnumber,$categorycode) = @_;
-    my $autonumber_members = C4::Context->boolean_preference('autoMemberNum');
-    $autonumber_members = 0 unless defined $autonumber_members;
-    # Find out whether member numbers should be generated
-    # automatically. Should be either "1" or something else.
-    # Defaults to "0", which is interpreted as "no".
-my $dbh = C4::Context->dbh;
-my $sth;
-    if (!$cardnumber  && $autonumber_members && $categorycode) {
-	if ($categorycode eq "A" || $categorycode eq "W" ){
-	 $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers where borrowers.cardnumber like '5%' ");
-	}elsif ($categorycode eq "L"){	
-	 $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers where borrowers.cardnumber like '10%' ");
-	}elsif ($categorycode eq "F" || $categorycode eq "E")	{
-	 $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers where borrowers.cardnumber like '30%' ");
-	}elsif ($categorycode eq "N"){	
-	 $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers where borrowers.cardnumber like '40%' ");
-	}elsif ($categorycode eq "C"){	
-	 $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers where borrowers.cardnumber like '80%' ");
-
-	}else{
-	 $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers where borrowers.cardnumber like '6%' ");
-	}
-	$sth->execute;
-
-	my $data=$sth->fetchrow_hashref;
-	$cardnumber=$data->{'max(borrowers.cardnumber)'};
-	$sth->finish;
-
-	# purpose: generate checksum'd member numbers.
-	# We'll assume we just got the max value of digits 2-8 of member #'s
-	# from the database and our job is to increment that by one,
-	# determine the 1st and 9th digits and return the full string.
-
-	if (! $cardnumber) { 			# If DB has no values,
-	 if ($categorycode eq "A" || $categorycode eq "W" ){   $cardnumber = 5000000;}	
-	 elsif ($categorycode eq "L"){   $cardnumber = 1000000;}
-	 elsif ($categorycode  eq "F"){   $cardnumber = 3000000;}
-	elsif ($categorycode  eq "C"){   $cardnumber = 8000000;}
-	elsif ($categorycode  eq "N"){   $cardnumber = 4000000;}
-	else{$cardnumber = 6000000;}	
-	# start at 1000000 or 3000000 or 5000000
-	} else {
-	    $cardnumber += 1;
-	}
-
-	
-    }
-    return $cardnumber;
-}
-
-=item GuarantornameSearch
-
-  ($count, $borrowers) = &GuarantornameSearch($env, $searchstring, $type);
-
-Looks up guarantor  by name.
-
-C<$env> is ignored.
-
-BUGFIX 499: C<$type> is now used to determine type of search.
-if $type is "simple", search is performed on the first letter of the
-surname only.
-
-C<$searchstring> is a space-separated list of search terms. Each term
-must match the beginning a borrower's surname, first name, or other
-name.
-
-C<&GuarantornameSearch> returns a two-element list. C<$borrowers> is a
-reference-to-array; each element is a reference-to-hash, whose keys
-are the fields of the C<borrowers> table in the Koha database.
-C<$count> is the number of elements in C<$borrowers>.
-
-return all info from guarantor =>only category_type A
-
-=cut
-
-#'
-#used by member enquiries from the intranet
-#called by guarantor_search.pl
-sub GuarantornameSearch {
-    my ( $env, $searchstring, $orderby, $type ) = @_;
-    my $dbh   = C4::Context->dbh;
-    my $query = "";
-    my $count;
-    my @data;
-    my @bind = ();
-
-    if ( $type eq "simple" )    # simple search for one letter only
-    {
-        $query =
-"Select * from borrowers,categories  where borrowers.categorycode=categories.categorycode and category_type='A'  and  surname like ? order by $orderby";
-        @bind = ("$searchstring%");
-    }
-    else    # advanced search looking in surname, firstname and othernames
-    {
-        @data  = split( ' ', $searchstring );
-        $count = @data;
-        $query = "Select * from borrowers,categories
-		where ((surname like ? or surname like ?
-		or firstname  like ? or firstname like ?
-		or othernames like ? or othernames like ?) and borrowers.categorycode=categories.categorycode and category_type='A' 
-		";
-        @bind = (
-            "$data[0]%", "% $data[0]%", "$data[0]%", "% $data[0]%",
-            "$data[0]%", "% $data[0]%"
-        );
-        for ( my $i = 1 ; $i < $count ; $i++ ) {
-            $query = $query . " and (" . " surname like ? or surname like ?
-                        or firstname  like ? or firstname like ?
-		        or othernames like ? or othernames like ?)";
-            push( @bind,
-                "$data[$i]%",   "% $data[$i]%", "$data[$i]%",
-                "% $data[$i]%", "$data[$i]%",   "% $data[$i]%" );
-
-            # FIXME - .= <<EOT;
-        }
-        $query = $query . ") or cardnumber like ?
-		order by $orderby";
-        push( @bind, $searchstring );
-
-        # FIXME - .= <<EOT;
-    }
-
-    my $sth = $dbh->prepare($query);
-    $sth->execute(@bind);
-    my @results;
-    my $cnt = $sth->rows;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push( @results, $data );
-    }
-
-    #  $sth->execute;
-    $sth->finish;
-    return ( $cnt, \@results );
-}
-
-
-=item findguarantees
-
-  ($num_children, $children_arrayref) = &findguarantees($parent_borrno);
-  $child0_cardno = $children_arrayref->[0]{"cardnumber"};
-  $child0_borrno = $children_arrayref->[0]{"borrowernumber"};
-
-C<&findguarantees> takes a borrower number (e.g., that of a patron
-with children) and looks up the borrowers who are guaranteed by that
-borrower (i.e., the patron's children).
-
-C<&findguarantees> returns two values: an integer giving the number of
-borrowers guaranteed by C<$parent_borrno>, and a reference to an array
-of references to hash, which gives the actual results.
-
-=cut
-#'
-sub findguarantees{
-  my ($bornum)=@_;
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("select cardnumber,borrowernumber, firstname, surname from borrowers where guarantor=?");
-  $sth->execute($bornum);
-
-  my @dat;
-  while (my $data = $sth->fetchrow_hashref)
-  {
-    push @dat, $data;
-  }
-  $sth->finish;
-  return (scalar(@dat), \@dat);
-}
-
-=item findguarantor
-
-  $guarantor = &findguarantor($borrower_no);
-  $guarantor_cardno = $guarantor->{"cardnumber"};
-  $guarantor_surname = $guarantor->{"surname"};
-  ...
-
-C<&findguarantor> takes a borrower number (presumably that of a child
-patron), finds the guarantor for C<$borrower_no> (the child's parent),
-and returns the record for the guarantor.
-
-C<&findguarantor> returns a reference-to-hash. Its keys are the fields
-from the C<borrowers> database table;
-
-=cut
-#'
-sub findguarantor{
-  my ($bornum)=@_;
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("select guarantor from borrowers where borrowernumber=?");
-  $sth->execute($bornum);
-  my $data=$sth->fetchrow_hashref;
-  $sth->finish;
-  $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
-  $sth->execute($data->{'guarantor'});
-  $data=$sth->fetchrow_hashref;
-  $sth->finish;
-  return($data);
-}
-
-sub borrowercard_active {
-	my ($bornum) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT expiry FROM borrowers WHERE (borrowernumber = ?) AND (NOW() <= expiry)");
-	$sth->execute($bornum);
-	if (my $data=$sth->fetchrow_hashref){	
-	return ('1');
-	}else{
-	return ('0');
-	}
-}
-
-# Search the member photo, in case that photo doesn´t exists, return a default photo.for NEU
-sub getMemberPhoto {
-	my $cardnumber = shift @_;
- my $htdocs = C4::Context->config('opacdir');
-my $dirname = $htdocs."/htdocs/uploaded-files/users-photo/";
-#	my $dirname = "$ENV{'DOCUMENT_ROOT'}/uploaded-files/users-photo";
-	opendir(DIR, $dirname) or die "Can't open directory $dirname: $!";
-	while (defined(my $file = readdir(DIR))) {
-	   if ($file =~ /^$cardnumber\..+/){
-		   return "/uploaded-files/users-photo/$file";
-	   }
-	}
-	closedir(DIR);
-	return "http://cc.neu.edu.tr/stdpictures/".$cardnumber.".jpg";
-}
-
-sub change_user_pass {
-	my ($uid,$member,$digest) = @_;
-	my $dbh = C4::Context->dbh;
-	#Make sure the userid chosen is unique and not theirs if non-empty. If it is not,
-	#Then we need to tell the user and have them create a new one.
-	my $sth=$dbh->prepare("select * from borrowers where userid=? and borrowernumber <> ?");
-	$sth->execute($uid,$member);
-	if ( ($uid ne '') && ($sth->fetchrow) ) {
-		
-		return 0;
-   	 } else {
-		#Everything is good so we can update the information.
-		$sth=$dbh->prepare("update borrowers set userid=?, password=? where borrowernumber=?");
-    		$sth->execute($uid, $digest, $member);
-		return 1;
-	}
-
-}
-
-=head2 checkuniquemember (OUEST-PROVENCE)
-
-  $result = &checkuniquemember($collectivity,$surname,$categorycode,$firstname,$dateofbirth);
-
-Checks that a member exists or not in the database.
-
-C<&result> is 1 (=exist) or 0 (=does not exist)
-C<&collectivity> is 1 (= we add a collectivity) or 0 (= we add a physical member)
-C<&surname> is the surname
-C<&categorycode> is from categorycode table
-C<&firstname> is the firstname (only if collectivity=0)
-C<&dateofbirth> is the date of birth (only if collectivity=0)
-
-=cut
-sub checkuniquemember {
-    my ( $collectivity, $surname, $firstname, $dateofbirth ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $request;
-    if ($collectivity) {
-
-# 				$request="select count(*) from borrowers where surname=? and categorycode=?";
-        $request =
-          "select borrowernumber,categorycode from borrowers where surname=? ";
-    }
-    else {
-
-# 				$request="select count(*) from borrowers where surname=? and categorycode=? and firstname=? and dateofbirth=?";
-        $request =
-"select borrowernumber,categorycode from borrowers where surname=?  and firstname=? and dateofbirth=?";
-    }
-    my $sth = $dbh->prepare($request);
-    if ($collectivity) {
-        $sth->execute( uc($surname) );
-    }
-    else {
-        $sth->execute( uc($surname), ucfirst($firstname), $dateofbirth );
-    }
-    my @data = $sth->fetchrow;
-    if ( $data[0] ) {
-        $sth->finish;
-        return $data[0], $data[1];
-
-        #
-    }
-    else {
-        $sth->finish;
-        return 0;
-    }
-}
-=head2 getzipnamecity (OUEST-PROVENCE)
-
-take all info from table city for the fields city and  zip
-check for the name and the zip code of the city selected
-
-=cut
-
-sub getzipnamecity {
-    my ($cityid) = @_;
-    my $dbh      = C4::Context->dbh;
-    my $sth      =
-      $dbh->prepare(
-        "select city_name,city_zipcode from cities where cityid=? ");
-    $sth->execute($cityid);
-    my @data = $sth->fetchrow;
-    return $data[0], $data[1];
-}
-
-=head2 updatechildguarantor (OUEST-PROVENCE)
-
-check for title,firstname,surname,adress,zip code and city  from guarantor to 
-guarantorchild
-
-=cut
-
-#'
-
-sub getguarantordata {
-    my ($borrowerid) = @_;
-    my $dbh          = C4::Context->dbh;
-    my $sth          =
-      $dbh->prepare(
-"Select title,firstname,surname,streetnumber,address,streettype,address2,zipcode,city,phone,phonepro,mobile,email,emailpro,fax  from borrowers where borrowernumber =? "
-      );
-    $sth->execute($borrowerid);
-    my $guarantor_data = $sth->fetchrow_hashref;
-    $sth->finish;
-    return $guarantor_data;
-}
-
-=head2 getdcity (OUEST-PROVENCE)
-recover cityid  with city_name condition
-=cut
-
-sub getidcity {
-    my ($city_name) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("select cityid from cities where city_name=? ");
-    $sth->execute($city_name);
-    my $data = $sth->fetchrow;
-    return $data;
-}
-
-=head2 getcategorytype (OUEST-PROVENCE)
-
-check for the category_type with categorycode
-and return the category_type 
-
-=cut
-
-sub getcategorytype {
-    my ($categorycode) = @_;
-    my $dbh            = C4::Context->dbh;
-    my $sth            =
-      $dbh->prepare(
-"Select category_type,description from categories where categorycode=?  "
-      );
-    $sth->execute($categorycode);
-    my ( $category_type, $description ) = $sth->fetchrow;
-    return $category_type, $description;
-}
-
-
-
-
-
-
-
-# # A better approach might be to set borrowernumber autoincrement and 
-# 
- sub NewBorrowerNumber {
-   my $dbh = C4::Context->dbh;
-   my $sth=$dbh->prepare("Select max(borrowernumber) from borrowers");
-   $sth->execute;
-   my $data=$sth->fetchrow_hashref;
-   $sth->finish;
-   $data->{'max(borrowernumber)'}++;
-   return($data->{'max(borrowernumber)'});
- }
-
-=head2 ethnicitycategories
-
-  ($codes_arrayref, $labels_hashref) = &ethnicitycategories();
-
-Looks up the different ethnic types in the database. Returns two
-elements: a reference-to-array, which lists the ethnicity codes, and a
-reference-to-hash, which maps the ethnicity codes to ethnicity
-descriptions.
-
-=cut
-
-#'
-
-sub ethnicitycategories {
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("Select code,name from ethnicity order by name");
-    $sth->execute;
-    my %labels;
-    my @codes;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push @codes, $data->{'code'};
-        $labels{ $data->{'code'} } = $data->{'name'};
-    }
-    $sth->finish;
-    return ( \@codes, \%labels );
-}
-
-=head2 fixEthnicity
-
-  $ethn_name = &fixEthnicity($ethn_code);
-
-Takes an ethnicity code (e.g., "european" or "pi") and returns the
-corresponding descriptive name from the C<ethnicity> table in the
-Koha database ("European" or "Pacific Islander").
-
-=cut
-
-#'
-
-sub fixEthnicity{
-
-    my $ethnicity = shift;
-    my $dbh       = C4::Context->dbh;
-    my $sth       = $dbh->prepare("Select name from ethnicity where code = ?");
-    $sth->execute($ethnicity);
-    my $data = $sth->fetchrow_hashref;
-    $sth->finish;
-    return $data->{'name'};
-}    # sub fixEthnicity
-
-
-
-=head2 get_age
-
-  $dateofbirth,$date = &get_age($date);
-
-this function return the borrowers age with the value of dateofbirth
-
-=cut
-#'
-sub get_age {
-    my ($date, $date_ref) = @_;
-
-    if (not defined $date_ref) {
-        $date_ref = get_today();
-    }
-
-    my ($year1, $month1, $day1) = split /-/, $date;
-    my ($year2, $month2, $day2) = split /-/, $date_ref;
-
-    my $age = $year2 - $year1;
-    if ($month1.$day1 > $month2.$day2) {
-        $age--;
-    }
-
-    return $age;
-}# sub get_age
-
-
-
-=head2 get_institutions
-  $insitutions = get_institutions();
-
-Just returns a list of all the borrowers of type I, borrownumber and name
-=cut
-
-#'
-sub get_institutions {
-    my $dbh = C4::Context->dbh();
-    my $sth =
-      $dbh->prepare(
-"SELECT borrowernumber,surname FROM borrowers WHERE categorycode=? ORDER BY surname"
-      );
-    $sth->execute('I');
-    my %orgs;
-    while ( my $data = $sth->fetchrow_hashref() ) {
-        $orgs{ $data->{'borrowernumber'} } = $data;
-    }
-    $sth->finish();
-    return ( \%orgs );
-
-}    # sub get_institutions
-
-=head2 add_member_orgs
-
-  add_member_orgs($borrowernumber,$borrowernumbers);
-
-Takes a borrowernumber and a list of other borrowernumbers and inserts them into the borrowers_to_borrowers table
-
-=cut
-
-#'
-sub add_member_orgs {
-    my ( $borrowernumber, $otherborrowers ) = @_;
-    my $dbh   = C4::Context->dbh();
-    my $query =
-      "INSERT INTO borrowers_to_borrowers (borrower1,borrower2) VALUES (?,?)";
-    my $sth = $dbh->prepare($query);
-    foreach my $bornum (@$otherborrowers) {
-        $sth->execute( $borrowernumber, $bornum );
-    }
-    $sth->finish();
-
-}    # sub add_member_orgs
-
-=head2 GetBorrowersFromSurname
-
-=over 4
-
-\@resutlts = GetBorrowersFromSurname($surname)
-this function get the list of borrower names like $surname.
-return :
-the table of results in @results
-
-=back
-
-=cut
-sub GetBorrowersFromSurname  {
-    my ($searchstring)=@_;
-    my $dbh = C4::Context->dbh;
-    $searchstring=~ s/\'/\\\'/g;
-    my @data=split(' ',$searchstring);
-    my $count=@data;
-    my $query = qq|
-        SELECT   surname,firstname
-        FROM     borrowers
-        WHERE    (surname like ?)
-        ORDER BY surname
-    |;
-    my $sth=$dbh->prepare($query);
-    $sth->execute("$data[0]%");
-    my @results;
-    my $count = 0;
-    while (my $data=$sth->fetchrow_hashref){
-         push(@results,$data);
-         $count++;
-    }
-     $sth->finish;
-     return ($count,\@results);
-}
-
-=head2 expand_sex_into_predicate
-
-  $data{&expand_sex_into_predicate($data{sex})} = 1;
-
-Converts a single 'M' or 'F' into 'sex_M_p' or 'sex_F_p'
-respectively.
-
-In some languages, 'M' and 'F' are not appropriate. However,
-with HTML::Template, there is no way to localize 'M' or 'F'
-unless these are converted into variables that TMPL_IF can
-understand. This function provides this conversion.
-
-=cut
-
-sub expand_sex_into_predicate  {
-   my($sex) = @_;
-   return "sex_${sex}_p";
-} # expand_sex_into_predicate
-
-
-#
-# NOTE!: If you change this function, be sure to update the POD for
-# &getpatroninformation.
-#
-# $flags = &patronflags($env, $patron, $dbh);
-#
-# $flags->{CHARGES}
-#		{message}	Message showing patron's credit or debt
-#		{noissues}	Set if patron owes >$5.00
-#         {GNA}			Set if patron gone w/o address
-#		{message}	"Borrower has no valid address"
-#		{noissues}	Set.
-#         {LOST}		Set if patron's card reported lost
-#		{message}	Message to this effect
-#		{noissues}	Set.
-#         {DBARRED}		Set is patron is debarred
-#		{message}	Message to this effect
-#		{noissues}	Set.
-#         {NOTES}		Set if patron has notes
-#		{message}	Notes about patron
-#         {ODUES}		Set if patron has overdue books
-#		{message}	"Yes"
-#		{itemlist}	ref-to-array: list of overdue books
-#		{itemlisttext}	Text list of overdue items
-#         {WAITING}		Set if there are items available that the
-#				patron reserved
-#		{message}	Message to this effect
-#		{itemlist}	ref-to-array: list of available items
-sub patronflags {
-# Original subroutine for Circ2.pm
-	my %flags;
-	my ($env, $patroninformation, $dbh) = @_;
-	my $amount = C4::Accounts2::checkaccount($env, $patroninformation->{'borrowernumber'}, $dbh);
-	if ($amount > 0) {
-		my %flaginfo;
-		my $noissuescharge = C4::Context->preference("noissuescharge");
-		$flaginfo{'message'}= sprintf "Patron owes \$%.02f", $amount;
-		if ($amount > $noissuescharge) {
-		$flaginfo{'noissues'} = 1;
-		}
-		$flags{'CHARGES'} = \%flaginfo;
-	} elsif ($amount < 0){
-	my %flaginfo;
-	$flaginfo{'message'} = sprintf "Patron has credit of \$%.02f", -$amount;
-		$flags{'CHARGES'} = \%flaginfo;
-	}
-	if ($patroninformation->{'gonenoaddress'} == 1) {
-		my %flaginfo;
-		$flaginfo{'message'} = 'Borrower has no valid address.';
-		$flaginfo{'noissues'} = 1;
-		$flags{'GNA'} = \%flaginfo;
-	}
-	if ($patroninformation->{'lost'} == 1) {
-		my %flaginfo;
-		$flaginfo{'message'} = 'Borrower\'s card reported lost.';
-		$flaginfo{'noissues'} = 1;
-		$flags{'LOST'} = \%flaginfo;
-	}
-	if ($patroninformation->{'debarred'} == 1) {
-		my %flaginfo;
-		$flaginfo{'message'} = 'Borrower is Debarred.';
-		$flaginfo{'noissues'} = 1;
-		$flags{'DBARRED'} = \%flaginfo;
-	}
-	if ($patroninformation->{'borrowernotes'}) {
-		my %flaginfo;
-		$flaginfo{'message'} = "$patroninformation->{'borrowernotes'}";
-		$flags{'NOTES'} = \%flaginfo;
-	}
-	my ($odues, $itemsoverdue)
-			= checkoverdues($env, $patroninformation->{'borrowernumber'}, $dbh);
-	if ($odues > 0) {
-		my %flaginfo;
-		$flaginfo{'message'} = "Yes";
-		$flaginfo{'itemlist'} = $itemsoverdue;
-		foreach (sort {$a->{'date_due'} cmp $b->{'date_due'}} @$itemsoverdue) {
-		$flaginfo{'itemlisttext'}.="$_->{'date_due'} $_->{'barcode'} $_->{'title'} \n";
-		}
-		$flags{'ODUES'} = \%flaginfo;
-	}
-	my ($nowaiting, $itemswaiting)=C4::Reserves2::CheckWaiting($patroninformation->{'borrowernumber'});
-	if ($nowaiting > 0) {
-		my %flaginfo;
-		$flaginfo{'message'} = "Reserved items available";
-		$flaginfo{'itemlist'} = $itemswaiting;
-		$flags{'WAITING'} = \%flaginfo;
-	}
-	return(\%flags);
-}
-
-##Not exported same in Circ2
-sub checkoverdues {
-# From Circ2.pm, added here to prevent recursive inclusion of Circ2
-  #checks whether a borrower has overdue items
-	my ($env, $bornum, $dbh)=@_;
-	my $today=get_today();
-	my @overdueitems;
-	my $count = 0;
-	my $sth = $dbh->prepare("SELECT issues.* , i.biblionumber as biblionumber,b.* FROM issues, items i,biblio b
-			WHERE  i.itemnumber=issues.itemnumber
-				AND i.biblionumber=b.biblionumber
-				AND issues.borrowernumber  = ?
-				AND issues.returndate is NULL
-				AND issues.date_due < ?");
-	$sth->execute($bornum,$today);
-	while (my $data = $sth->fetchrow_hashref) {
-	
-	push (@overdueitems, $data);
-	$count++;
-	}
-	$sth->finish;
-	return ($count, \@overdueitems);
-}
-1;
-__END__
\ No newline at end of file

Index: modules/C4/NewsChannels.pm
===================================================================
RCS file: modules/C4/NewsChannels.pm
diff -N modules/C4/NewsChannels.pm
--- modules/C4/NewsChannels.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,388 +0,0 @@
-package C4::NewsChannels;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-use C4::Date;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::NewsChannels - Functions to manage the news channels and its categories
-
-=head1 DESCRIPTION
-
-This module provides the functions needed to admin the news channels and its categories
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-  &news_channels &get_new_channel &del_channels &add_channel &update_channel
-  &news_channels_categories &get_new_channel_category &del_channels_categories
-  &add_channel_category &update_channel_category &news_channels_by_category
-&add_opac_new &upd_opac_new &del_opac_new &get_opac_new &get_opac_news
-  &add_opac_electronic &upd_opac_electronic &del_opac_electronic &get_opac_electronic &get_opac_electronics
-);
-
-
-=item news_channels
-
-  ($count, @channels) = &news_channels($channel_name, $id_category, $unclassified);
-
-Looks up news channels by name or category.
-
-C<$channel_name> is the channel name to search.
-
-C<$id_category> is the channel category code to search.
-
-C<$$unclassified> if it is set and $channel_name and $id_category search for the news channels without a category
-
-if none of the params are set C<&news_channels> returns all the news channels.
-
-C<&news_channels> returns two values: an integer giving the number of
-news channels found and a reference to an array
-of references to hash, which has the news_channels and news_channels_categories fields.
-
-=cut
-
-sub news_channels {
-	my ($channel_name, $id_category, $unclassified) = @_;
-	my $dbh = C4::Context->dbh;
-	my @channels;
-	my $query = "SELECT * FROM news_channels LEFT JOIN news_channels_categories ON news_channels.id_category = news_channels_categories.id_category";
-	if ( ($channel_name ne '') && ($id_category ne '') ) {
-		$query.= " WHERE channel_name like '" . $channel_name . "%' AND news_channels.id_category = " . $id_category;
-	} elsif ($channel_name ne '')  {
-		$query.= " WHERE channel_name like '" . $channel_name . "%'";
-	} elsif ($id_category ne '') {
-		$query.= " WHERE news_channels.id_category = " . $id_category;
-	} elsif ($unclassified) {
-		$query.= " WHERE news_channels.id_category IS NULL ";
-	}
-	my $sth = $dbh->prepare($query);
-	$sth->execute();
-	while (my $row = $sth->fetchrow_hashref) {
-		push @channels, $row;
-	}
-	$sth->finish;
-	return (scalar(@channels), @channels);
-}
-
-=item news_channels_by_category
-
-  ($count, @results) = &news_channels_by_category();
-
-Looks up news channels grouped by category.
-
-C<&news_channels_by_category> returns two values: an integer giving the number of
-categories found and a reference to an array
-of references to hash, which the following keys: 
-
-=over 4
-
-=item C<channels_count>
-
-The number of news channels in that category
-
-=item C<channels>
-
-A reference to an array of references to hash which keys are the new_channels fields. 
-
-Additionally the last index of results has a reference to all the news channels which don't have a category 
-
-=cut
-
-sub news_channels_by_category {
-	
-	my ($categories_count, @results) = &news_channels_categories();
-	foreach my $row (@results) {
-
-		my ($channels_count, @channels) = &news_channels('', $row->{'id_category'});
-		$row->{'channels_count'} = $channels_count;
-		$row->{'channels'} = \@channels;
-	}
-
-	my ($channels_count, @channels) = &news_channels('', '', 1);
-	my %row;
-	$row{'id_category'} = -1;
-	$row{'unclassified'} = 1;
-	$row{'channels_count'} = $channels_count;
-	$row{'channels'} = \@channels;
-	push @results, \%row;
-
-	return (scalar(@results), @results);
-}
-
-sub get_new_channel {
-	my ($id) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM news_channels WHERE id = ?");
-	$sth->execute($id);
-	my $channel = $sth->fetchrow_hashref;
-	$sth->finish;
-	return $channel;
-}
-
-sub del_channels {
-	my ($ids) = @_;
-	if ($ids ne '') {
-		my $dbh = C4::Context->dbh;
-		my $sth = $dbh->prepare("DELETE FROM news_channels WHERE id IN ($ids) ");
-		$sth->execute();
-		$sth->finish;
-		return $ids;
-	}
-	return 0;
-}
-
-sub add_channel {
-	my ($name, $url, $id_category, $notes) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("INSERT INTO news_channels (channel_name, url, id_category, notes) VALUES (?,?,?,?)");
-	$sth->execute($name, $url, $id_category, $notes);
-	$sth->finish;
-	return 1;
-}
-
-sub update_channel {
-	my ($id, $name, $url, $id_category, $notes) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("UPDATE news_channels SET channel_name = ?,  url = ?, id_category = ?, notes = ? WHERE id = ?");
-	$sth->execute($name, $url, $id_category, $notes, $id);
-	$sth->finish;
-	return 1;
-}
-
-sub news_channels_categories {
-	my $dbh = C4::Context->dbh;
-	my @categories;
-	my $query = "SELECT * FROM news_channels_categories";
-	my $sth = $dbh->prepare($query);
-	$sth->execute();
-	while (my $row = $sth->fetchrow_hashref) {
-		push @categories, $row;
-	}
-	$sth->finish;
-	return (scalar(@categories), @categories);
-
-}
-
-sub get_new_channel_category {
-	my ($id) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM news_channels_categories WHERE id_category = ?");
-	$sth->execute($id);
-	my $category = $sth->fetchrow_hashref;
-	$sth->finish;
-	return $category;
-}
-
-sub del_channels_categories {
-	my ($ids) = @_;
-	if ($ids ne '') {
-		my $dbh = C4::Context->dbh;
-		my $sth = $dbh->prepare("UPDATE news_channels SET id_category = NULL WHERE id_category IN ($ids) "); 
-		$sth->execute();
-		$sth = $dbh->prepare("DELETE FROM news_channels_categories WHERE id_category IN ($ids) ");
-		$sth->execute();
-		$sth->finish;
-		return $ids;
-	}
-	return 0;
-}
-
-sub add_channel_category {
-	my ($name) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("INSERT INTO news_channels_categories (category_name) VALUES (?)");
-	$sth->execute($name);
-	$sth->finish;
-	return 1;
-}
-
-sub update_channel_category {
-	my ($id, $name) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("UPDATE news_channels_categories SET category_name = ? WHERE id_category = ?");
-	$sth->execute($name, $id);
-	$sth->finish;
-	return 1;
-}
-
-
-sub add_opac_new {
-	my ($title, $new, $lang) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("INSERT INTO opac_news (title, new, lang) VALUES (?,?,?)");
-	$sth->execute($title, $new, $lang);
-	$sth->finish;
-	return 1;
-}
-
-sub upd_opac_new {
-	my ($idnew, $title, $new, $lang) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("UPDATE opac_news SET title = ?, new = ?, lang = ? WHERE idnew = ?");
-	$sth->execute($title, $new, $lang, $idnew);
-	$sth->finish;
-	return 1;
-}
-
-sub del_opac_new {
-	my ($ids) = @_;
-	if ($ids) {
-		my $dbh = C4::Context->dbh;
-		my $sth = $dbh->prepare("DELETE FROM opac_news WHERE idnew IN ($ids)");
-		$sth->execute();
-		$sth->finish;
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-sub get_opac_new {
-	my ($idnew) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM opac_news WHERE idnew = ?");
-	$sth->execute($idnew);
-	my $data = $sth->fetchrow_hashref;
-	$data->{$data->{'lang'}} = 1;
-	$sth->finish;
-	return $data;
-}
-
-sub get_opac_news {
-	my ($limit, $lang) = @_;
-	my $dbh = C4::Context->dbh;
-	my $query = "SELECT *, DATE_FORMAT(timestamp,'%Y-%m-%d') AS newdate FROM opac_news";
-	if ($lang) {
-		$query.= " WHERE lang = '" .$lang ."' ";
-	}
-	$query.= " ORDER BY timestamp DESC ";
-	#if ($limit) {
-	#	$query.= "LIMIT 0, " . $limit;
-	#}
-	my $sth = $dbh->prepare($query);
-	$sth->execute();
-	my @opac_news;
-	my $count = 0;
-	while (my $row = $sth->fetchrow_hashref) {
-		if ((($limit) && ($count < $limit)) || (!$limit)) {
-			$row->{'newdate'} = format_date($row->{'newdate'});
-			push @opac_news, $row;	
-		}
-		$count++;
-	}
-	return ($count, \@opac_news);
-}
-
-### get electronic databases
-
-sub add_opac_electronic {
-	my ($title, $edata, $lang,$image,$href,$section) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("INSERT INTO opac_electronic (title, edata, lang,image,href,section) VALUES (?,?,?,?,?,?)");
-	$sth->execute($title, $edata, $lang,$image,$href,$section);
-	$sth->finish;
-	return 1;
-}
-
-sub upd_opac_electronic {
-	my ($idelectronic, $title, $edata, $lang, $image, $href,$section) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("UPDATE opac_electronic SET title = ?, edata = ?, lang = ? , image=?, href=? ,section=? WHERE idelectronic = ?");
-	$sth->execute($title, $edata, $lang, $image,$href ,$section, $idelectronic);
-	$sth->finish;
-	return 1;
-}
-
-sub del_opac_electronic {
-	my ($ids) = @_;
-	if ($ids) {
-		my $dbh = C4::Context->dbh;
-		my $sth = $dbh->prepare("DELETE FROM opac_electronic WHERE idelectronic IN ($ids)");
-		$sth->execute();
-		$sth->finish;
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-sub get_opac_electronic {
-	my ($idelectronic) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("SELECT * FROM opac_electronic WHERE idelectronic = ?");
-	$sth->execute($idelectronic);
-	my $data = $sth->fetchrow_hashref;
-	$data->{$data->{'lang'}} = 1;
-	$data->{$data->{'section'}} = 1;
-	$sth->finish;
-	return $data;
-}
-
-sub get_opac_electronics {
-	my ($section, $lang) = @_;
-	my $dbh = C4::Context->dbh;
-	my $query = "SELECT *, DATE_FORMAT(timestamp, '%Y-%m-%d') AS newdate FROM opac_electronic";
-	if ($lang) {
-		$query.= " WHERE lang = '" .$lang ."' ";
-	}
-	if ($section) {
-		$query.= " and section= '" . $section."' ";
-	}
-	$query.= " ORDER BY title ";
-	
-	my $sth = $dbh->prepare($query);
-	$sth->execute();
-	my @opac_electronic;
-	my $count = 0;
-	while (my $row = $sth->fetchrow_hashref) {
-		$row->{'newdate'}=format_date($row->{'newdate'});
-			push @opac_electronic, $row;	
-
-		
-		$count++;
-	}
-
-	return ($count,\@opac_electronic);
-}
-1;
-__END__
-=back
-
-=head1 AUTHOR
-
-TG
-
-=cut
-
-

Index: modules/C4/Output.pm
===================================================================
RCS file: modules/C4/Output.pm
diff -N modules/C4/Output.pm
--- modules/C4/Output.pm	11 Mar 2007 20:31:44 -0000	1.1.2.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,318 +0,0 @@
-package C4::Output;
-# $Id: Output.pm,v 1.1.2.2 2007/03/11 20:31:44 tgarip1957 Exp $
-
-#package to deal with marking up output
-#You will need to edit parts of this pm
-#set the value of path to be where your html lives
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-
-if ($ENV{MOD_PERL}) {
-require HTML::Template;
-}else{
-require HTML::Template::Pro;
-}
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Output - Functions for managing templates
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-		&themelanguage &gettemplate setlanguagecookie pagination_bar
-		);
-
-#FIXME: this is a quick fix to stop rc1 installing broken
-#Still trying to figure out the correct fix.
-my $path = C4::Context->config('intrahtdocs')."/default/en/includes/";
-
-#---------------------------------------------------------------------------------------------------------
-# FIXME - POD
-sub gettemplate {
-	my ($tmplbase, $opac, $query) = @_;
-
-if (!$query){
-  warn "no query in gettemplate";
-  }
-	my $htdocs;
-	if ($opac ne "intranet") {
-		$htdocs = C4::Context->config('opachtdocs');
-	} else {
-		$htdocs = C4::Context->config('intrahtdocs');
-	}
-    my $path = C4::Context->preference('intranet_includes') || 'includes';
-#    warn "PATH : $path";
-
-	my ($theme, $lang) = themelanguage($htdocs, $tmplbase, $opac, $query);
-	my $opacstylesheet = C4::Context->preference('opacstylesheet');
-	
-my $template = HTML::Template->new(filename      => "$htdocs/$theme/$lang/$tmplbase", case_sensitive=>1, utf8=>1,
-				   die_on_bad_params => 0,
-				   global_vars       => 1, cache=>1,
-				   path              => ["$htdocs/$theme/$lang/$path"],
-					);
-
-	$template->param(themelang => ($opac ne 'intranet'? '/opac-tmpl': '/intranet-tmpl') . "/$theme/$lang",
-							interface => ($opac ne 'intranet'? '/opac-tmpl': '/intranet-tmpl'),
-							theme => $theme,
-							opacstylesheet => $opacstylesheet,
-							opaccolorstylesheet => C4::Context->preference('opaccolorstylesheet'),
-							opacsmallimage => C4::Context->preference('opacsmallimage'),
-							lang => $lang);
-
-        
-	return $template;
-}
-
-#---------------------------------------------------------------------------------------------------------
-# FIXME - POD
-sub themelanguage {
-  my ($htdocs, $tmpl, $section, $query) = @_;
-#   if (!$query) {
-#     warn "no query";
-#   }
-  my $dbh = C4::Context->dbh;
-  my @languages;
-  my @themes;
-my ($theme, $lang);
-  if ($section eq "intranet"){
-    $lang=$query->cookie('KohaOpacLanguage');
-
-  if ($lang){
-  
-    push @languages,$lang;
-    @themes = split " ", C4::Context->preference("template");
-  } 
-  else {
-    @languages = split " ", C4::Context->preference("opaclanguages");
-    @themes = split " ", C4::Context->preference("template");
-    }
- }else{
-   $lang=$query->cookie('KohaOpacLanguage');
-
-  if ($lang){
-  
-    push @languages,$lang;
-    @themes = split " ", C4::Context->preference("opacthemes");
-  } 
-  else {
-    @languages = split " ", C4::Context->preference("opaclanguages");
-    @themes = split " ", C4::Context->preference("opacthemes");
-    }
-}
-
-  
-# searches through the themes and languages. First template it find it returns.
-# Priority is for getting the theme right.
-  THEME:
-  foreach my $th (@themes) {
-    foreach my $la (@languages) {
-	for (my $pass = 1; $pass <= 2; $pass += 1) {
-	  $la =~ s/([-_])/ $1 eq '-'? '_': '-' /eg if $pass == 2;
-	  if (-e "$htdocs/$th/$la/$tmpl") {
-	      $theme = $th;
-	      $lang = $la;
-	      last THEME;
-	  }
-	last unless $la =~ /[-_]/;
-	}
-    }
-  }
-  if ($theme and $lang) {
-    return ($theme, $lang);
-  } else {
-    return ('default', 'en');
-  }
-}
-
-
-sub setlanguagecookie {
-   my ($query,$language,$uri)=@_;
-   my $cookie=$query->cookie(-name => 'KohaOpacLanguage',
-                                           -value => $language,
-					   -expires => '');
-   print $query->redirect(-uri=>$uri,
-   -cookie=>$cookie);
-}				   
-
-=item pagination_bar
-
-   pagination_bar($base_url, $nb_pages, $current_page, $startfrom_name)
-
-Build an HTML pagination bar based on the number of page to display, the
-current page and the url to give to each page link.
-
-C<$base_url> is the URL for each page link. The
-C<$startfrom_name>=page_number is added at the end of the each URL.
-
-C<$nb_pages> is the total number of pages available.
-
-C<$current_page> is the current page number. This page number won't become a
-link.
-
-This function returns HTML, without any language dependency.
-
-=cut
-
-sub pagination_bar {
-    my ($base_url, $nb_pages, $current_page, $startfrom_name) = @_;
-
-    # how many pages to show before and after the current page?
-    my $pages_around = 2;
-
-    my $url =
-        $base_url
-        .($base_url =~ m/&/ ? '&amp;' : '?')
-        .$startfrom_name.'='
-        ;
-
-    my $pagination_bar = '';
-
-    # current page detection
-    if (not defined $current_page) {
-        $current_page = 1;
-    }
-
-    # navigation bar useful only if more than one page to display !
-    if ($nb_pages > 1) {
-        # link to first page?
-        if ($current_page > 1) {
-            $pagination_bar.=
-                "\n".'&nbsp;'
-                .'<a href="'.$url.'1" rel="start">'
-                .'&lt;&lt;'
-                .'</a>'
-                ;
-        }
-        else {
-            $pagination_bar.=
-                "\n".'&nbsp;<span class="inactive">&lt;&lt;</span>';
-        }
-
-        # link on previous page ?
-        if ($current_page > 1) {
-            my $previous = $current_page - 1;
-
-            $pagination_bar.=
-                "\n".'&nbsp;'
-                .'<a href="'
-                .$url.$previous
-                .'" rel="prev">'
-                .'&lt;'
-                .'</a>'
-                ;
-        }
-        else {
-            $pagination_bar.=
-                "\n".'&nbsp;<span class="inactive">&lt;</span>';
-        }
-
-        my $min_to_display = $current_page - $pages_around;
-        my $max_to_display = $current_page + $pages_around;
-        my $last_displayed_page = undef;
-
-        for my $page_number (1..$nb_pages) {
-            if ($page_number == 1
-                or $page_number == $nb_pages
-                or ($page_number >= $min_to_display and $page_number <= $max_to_display)
-            ) {
-                if (defined $last_displayed_page
-                    and $last_displayed_page != $page_number - 1
-                ) {
-                    $pagination_bar.=
-                        "\n".'&nbsp;<span class="inactive">...</span>'
-                        ;
-                }
-
-                if ($page_number == $current_page) {
-                    $pagination_bar.=
-                        "\n".'&nbsp;'
-                        .'<span class="currentPage">'.$page_number.'</span>'
-                        ;
-                }
-                else {
-                    $pagination_bar.=
-                        "\n".'&nbsp;'
-                        .'<a href="'.$url.$page_number.'">'.$page_number.'</a>'
-                        ;
-                }
-                $last_displayed_page = $page_number;
-            }
-        }
-
-        # link on next page?
-        if ($current_page < $nb_pages) {
-            my $next = $current_page + 1;
-
-            $pagination_bar.=
-                "\n".'&nbsp;<a href="'.$url.$next.'" rel="next">'
-                .'&gt;'
-                .'</a>'
-                ;
-        }
-        else {
-            $pagination_bar.=
-                "\n".'&nbsp;<span class="inactive">&gt;</span>'
-                ;
-        }
-
-        # link to last page?
-        if ($current_page != $nb_pages) {
-            $pagination_bar.=
-                "\n".'&nbsp;<a href="'.$url.$nb_pages.'" rel="last">'
-                .'&gt;&gt;'
-                .'</a>'
-                ;
-        }
-        else {
-            $pagination_bar.=
-                "\n".'&nbsp;<span class="inactive">&gt;&gt;</span>';
-        }
-    }
-
-    return $pagination_bar;
-}
-
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Print.pm
===================================================================
RCS file: modules/C4/Print.pm
diff -N modules/C4/Print.pm
--- modules/C4/Print.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,225 +0,0 @@
-package C4::Print; #assumes C4/Print.pm
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-
-
-use C4::Context;
-use C4::Circulation::Circ2;
-use C4::Members;
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Print - Koha module dealing with printing
-
-=head1 SYNOPSIS
-
-  use C4::Print;
-
-=head1 DESCRIPTION
-
-The functions in this module handle sending text to a printer.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&remoteprint &printreserve &printslip);
-
-=item remoteprint
-
-  &remoteprint($env, $items, $borrower);
-
-Prints the list of items in C<$items> to a printer.
-
-C<$env> is a reference-to-hash. C<$env-E<gt>{queue}> specifies the
-queue to print to; if it is empty or has the special value C<nulllp>,
-C<&remoteprint> will print to the file F</tmp/kohaiss>.
-
-C<$borrower> is a reference-to-hash giving information about a patron.
-This may be gotten from C<&getpatroninformation>. The patron's name
-will be printed in the output.
-
-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<&currentissues>.
-
-=cut
-#'
-# FIXME - It'd be nifty if this could generate pretty PostScript.
-sub remoteprint {
-  my ($env,$items,$borrower)=@_;
-
-  (return) unless (C4::Context->boolean_preference('printcirculationslips'));
-  my $queue = $env->{'queue'};
-  # FIXME - If 'queue' is undefined or empty, then presumably it should
-  # mean "use the default queue", whatever the default is. Presumably
-  # the default depends on the physical location of the machine.
-  # FIXME - Perhaps "print to file" should be a supported option. Just
-  # set the queue to "file" (or " file", if real queues aren't allowed
-  # to have spaces in them). Or perhaps if $queue eq "" and
-  # $env->{file} ne "", then that should mean "print to $env->{file}".
-  if ($queue eq "" || $queue eq 'nulllp') {
-    open (PRINTER,">/tmp/kohaiss");
-  } else {
-    # FIXME - This assumes that 'lpr' exists, and works as expected.
-    # This is a reasonable assumption, but only because every other
-    # printing package has a wrapper script called 'lpr'. It'd still
-    # be better to be able to customize this.
-    open(PRINTER, "| lpr -P $queue > /dev/null") or die "Couldn't write to queue:$queue!\n";
-  }
-#  print $queue;
-  #open (FILE,">/tmp/$file");
-  my $i=0;
-  my $brdata = $env->{'brdata'};	# FIXME - Not used
-  # FIXME - This is HLT-specific. Put this stuff in a customizable
-  # site-specific file somewhere.
-  print PRINTER "Horowhenua Library Trust\r\n";
-#  print PRINTER "$brdata->{'branchname'}\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 " "x15;
-    print PRINTER "$itemdata->{'date_due'}\r\n";
-    $i++;
-  }
-  print PRINTER "\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
-  if ($env->{'printtype'} eq "docket"){
-    #print chr(27).chr(105);
-  }
-  close PRINTER;
-  #system("lpr /tmp/$file");
-}
-
-sub printreserve {
-  my($env, $branchname, $bordata, $itemdata)=@_;
-  my $file=time;
-  my $printer = $env->{'printer'};
-  (return) unless (C4::Context->boolean_preference('printreserveslips'));
-  if ($printer eq "" || $printer eq 'nulllp') {
-    open (PRINTER,">>/tmp/kohares");
-  } else {
-    open (PRINTER, "| lpr -P $printer >/dev/null") or die "Couldn't write to queue:$!\n";
-  }
-  my @da = localtime(time());
-  my $todaysdate = "$da[2]:$da[1]  $da[3]/$da[4]/$da[5]";
-
-#(1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]);
-  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;
-}
-
-=item printslip
-
-  &printslip($env, $borrowernumber)
-
-  print a slip for the given $borrowernumber
-  
-=cut
-#'
-sub printslip {
-    my ($env,$borrowernumber)=@_;
-    my ($borrower, $flags) = getpatroninformation($env,$borrowernumber,0);
-    $env->{'todaysissues'}=1;
-    my ($borrowerissues) = currentissues($env, $borrower);
-    $env->{'nottodaysissues'}=1;
-    $env->{'todaysissues'}=0;
-    my ($borroweriss2)=currentissues($env, $borrower);
-    $env->{'nottodaysissues'}=0;
-    my $i=0;
-    my @issues;
-    foreach (sort {$a <=> $b} keys %$borrowerissues) {
-	$issues[$i]=$borrowerissues->{$_};
-	my $dd=$issues[$i]->{'date_due'};
-	#convert to nz style dates
-	#this should be set with some kinda config variable
-	my @tempdate=split(/-/,$dd);
-	$issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]";
-	$i++;
-    }
-    foreach (sort {$a <=> $b} keys %$borroweriss2) {
-	$issues[$i]=$borroweriss2->{$_};
-	my $dd=$issues[$i]->{'date_due'};
-	#convert to nz style dates
-	#this should be set with some kinda config variable
-	my @tempdate=split(/-/,$dd);
-	$issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]";
-	$i++;
-    }
-    remoteprint($env,\@issues,$borrower);
-}
-
-END { }       # module clean-up code here (global destructor)
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=head1 SEE ALSO
-
-C4::Circulation::Circ2(3)
-
-=cut

Index: modules/C4/Record.pm
===================================================================
RCS file: modules/C4/Record.pm
diff -N modules/C4/Record.pm
--- modules/C4/Record.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,575 +0,0 @@
-package C4::Record;
-#
-# Copyright 2006 (C) LibLime
-# Joshua Ferraro <jmf at liblime.com>
-#
-# 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
-#
-# $Id: Record.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-#
-use strict; use warnings; #FIXME: turn off warnings before release
-
-# please specify in which methods a given module is used
-use MARC::Record; # marc2marcxml, marcxml2marc, html2marc, changeEncoding
-use MARC::File::XML; # marc2marcxml, marcxml2marc, html2marcxml, changeEncoding
-#use MARC::Crosswalk::DublinCore; # marc2dcxml
-#use MODS::Record; # marc2modsxml
-use Unicode::Normalize; # _entity_encode
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g;
-                shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
-
- at ISA = qw(Exporter);
-
-# only export API methods
-
- at EXPORT = qw(
-  &marc2marc
-  &marc2marcxml
-  &marcxml2marc
-  &marc2dcxml
-  &marc2modsxml
-
-  &html2marcxml
-  &html2marc
-  &changeEncoding
-);
-
-=head1 NAME
-
-C4::Record - MARC, MARCXML, DC, MODS, XML, etc. Record Management Functions and API
-
-=head1 SYNOPSIS
-
-New in Koha 3.x. This module handles all record-related management functions.
-
-=head1 API (EXPORTED FUNCTIONS)
-
-=head2 marc2marc - Convert from one flavour of ISO-2709 to another
-
-=over 4
-
-my ($error,$newmarc) = marc2marc($marc,$to_flavour,$from_flavour,$encoding);
-
-Returns an ISO-2709 scalar
-
-=back
-
-=cut
-
-sub marc2marc {
-	my ($marc,$to_flavour,$from_flavour,$encoding) = @_;
-	my $error = "Feature not yet implemented\n";
-	return ($error,$marc);
-}
-
-=head2 marc2marcxml - Convert from ISO-2709 to MARCXML
-
-=over 4
-
-my ($error,$marcxml) = marc2marcxml($marc,$encoding,$flavour);
-
-Returns a MARCXML scalar
-
-=over 2
-
-C<$marc> - an ISO-2709 scalar or MARC::Record object
-
-C<$encoding> - UTF-8 or MARC-8 [UTF-8]
-
-C<$flavour> - MARC21 or UNIMARC
-
-C<$dont_entity_encode> - a flag that instructs marc2marcxml not to entity encode the xml before returning (optional)
-
-=back
-
-=back
-
-=cut
-
-sub marc2marcxml {
-	my ($marc,$encoding,$flavour,$dont_entity_encode) = @_;
-	my $error; # the error string
-	my $marcxml; # the final MARCXML scalar
-
-	# test if it's already a MARC::Record object, if not, make it one
-	my $marc_record_obj;
-	if ($marc =~ /^MARC::Record/) { # it's already a MARC::Record object
-		$marc_record_obj = $marc;
-	} else { # it's not a MARC::Record object, make it one
-		eval { $marc_record_obj = MARC::Record->new_from_usmarc($marc) }; # handle exceptions
-
-		# conversion to MARC::Record object failed, populate $error
-		if ($@) { $error .="\nCreation of MARC::Record object failed: ".$MARC::File::ERROR };
-	}
-	# only proceed if no errors so far
-	unless ($error) {
-
-		# check the record for warnings
-		my @warnings = $marc_record_obj->warnings();
-		if (@warnings) {
-			warn "\nWarnings encountered while processing ISO-2709 record with title \"".$marc_record_obj->title()."\":\n";
-			foreach my $warn (@warnings) { warn "\t".$warn };
-		}
-		unless($encoding) {$encoding = "UTF-8"}; # set default encoding
-		unless($flavour) {$flavour = C4::Context->preference("marcflavour")}; # set default MARC flavour
-
-		# attempt to convert the record to MARCXML
-		eval { $marcxml = $marc_record_obj->as_xml_record($flavour) }; #handle exceptions
-
-		# record creation failed, populate $error
-		if ($@) {
-			$error .= "Creation of MARCXML failed:".$MARC::File::ERROR;
-			$error .= "Additional information:\n";
-			my @warnings = $@->warnings();
-			foreach my $warn (@warnings) { $error.=$warn."\n" };
-
-		# record creation was successful
-    	} else {
-
-			# check the record for warning flags again (warnings() will be cleared already if there was an error, see above block
-			@warnings = $marc_record_obj->warnings();
-			if (@warnings) {
-				warn "\nWarnings encountered while processing ISO-2709 record with title \"".$marc_record_obj->title()."\":\n";
-				foreach my $warn (@warnings) { warn "\t".$warn };
-			}
-		}
-
-		# only proceed if no errors so far
-		unless ($error) {
-
-			# entity encode the XML unless instructed not to
-    		unless ($dont_entity_encode) {
-        		my ($marcxml_entity_encoded) = _entity_encode($marcxml);
-        		$marcxml = $marcxml_entity_encoded;
-    		}
-		}
-	}
-	# return result to calling program
-	return ($error,$marcxml);
-}
-
-=head2 marcxml2marc - Convert from MARCXML to ISO-2709
-
-=over 4
-
-my ($error,$marc) = marcxml2marc($marcxml,$encoding,$flavour);
-
-Returns an ISO-2709 scalar
-
-=over 2
-
-C<$marcxml> - a MARCXML record
-
-C<$encoding> - UTF-8 or MARC-8 [UTF-8]
-
-C<$flavour> - MARC21 or UNIMARC
-
-=back
-
-=back
-
-=cut
-
-sub marcxml2marc {
-    my ($marcxml,$encoding,$flavour) = @_;
-	my $error; # the error string
-	my $marc; # the final ISO-2709 scalar
-	unless($encoding) {$encoding = "UTF-8"}; # set the default encoding
-	unless($flavour) {$flavour = C4::Context->preference("marcflavour")}; # set the default MARC flavour
-
-	# attempt to do the conversion
-	eval { $marc = MARC::Record->new_from_xml($marcxml,$encoding,$flavour) }; # handle exceptions
-
-	# record creation failed, populate $error
-	if ($@) {$error .="\nCreation of MARCXML Record failed: ".$@;
-		$error.=$MARC::File::ERROR if ($MARC::File::ERROR);
-		};
-	# return result to calling program
-	return ($error,$marc);
-}
-
-=head2 marc2dcxml - Convert from ISO-2709 to Dublin Core
-
-=over 4
-
-my ($error,$dcxml) = marc2dcxml($marc,$qualified);
-
-Returns a DublinCore::Record object, will eventually return a Dublin Core scalar
-
-FIXME: should return actual XML, not just an object
-
-=over 2
-
-C<$marc> - an ISO-2709 scalar or MARC::Record object
-
-C<$qualified> - specify whether qualified Dublin Core should be used in the input or output [0]
-
-=back
-
-=back
-
-=cut
-
-sub marc2dcxml {
-	my ($marc,$qualified) = @_;
-	my $error;
-    # test if it's already a MARC::Record object, if not, make it one
-    my $marc_record_obj;
-    if ($marc =~ /^MARC::Record/) { # it's already a MARC::Record object
-        $marc_record_obj = $marc;
-    } else { # it's not a MARC::Record object, make it one
-		eval { $marc_record_obj = MARC::Record->new_from_usmarc($marc) }; # handle exceptions
-
-		# conversion to MARC::Record object failed, populate $error
-		if ($@) {
-			$error .="\nCreation of MARC::Record object failed: ".$MARC::File::ERROR;
-		}
-	}
-	my $crosswalk = MARC::Crosswalk::DublinCore->new;
-	if ($qualified) {
-		$crosswalk = MARC::Crosswalk::DublinCore->new( qualified => 1 );
-	}
-	my $dcxml = $crosswalk->as_dublincore($marc_record_obj);
-	return ($error,$dcxml);
-}
-=head2 marc2modsxml - Convert from ISO-2709 to MODS
-
-=over 4
-
-my ($error,$modsxml) = marc2modsxml($marc);
-
-Returns a MODS scalar
-
-=back
-
-=cut
-
-sub marc2modsxml {
-	use XML::XSLT;
-	#use XML::LibXSLT;
-	my ($marc) = @_;
-	my $error;
-	my $marcxml;
-
-	# open some files for testing
-	open MARCBIG21MARC21SLIM,"/home/koha/head/koha/C4/MARC21slim2MODS3-1.xsl" or die $!;
-	my $marcbig2marc21_slim; # = scalar (MARC21MARC8);
-	foreach my $line (<MARCBIG21MARC21SLIM>) {
-    	$marcbig2marc21_slim .= $line;
-	}
-
-	# set some defailts
-	my $to_encoding = "UTF-8";
-	my $flavour = "MARC21";
-	
-	# first convert our ISO-2709 to MARCXML
-	($error,$marcxml) = marc2marcxml($marc,$to_encoding,$flavour);	
-	my $xslt_obj = XML::XSLT->new ($marcbig2marc21_slim, warnings => 1);
-	$xslt_obj->transform ($marcxml);
-	my $xslt_string = $xslt_obj->toString;
-	$xslt_obj->dispose();
-	warn $xslt_string;
-	return ($error,$xslt_string);
-}
-=head2 html2marcxml
-
-=over 4
-
-my ($error,$marcxml) = html2marcxml($tags,$subfields,$values,$indicator,$ind_tag);
-
-Returns a MARCXML scalar
-
-this is used in addbiblio.pl and additem.pl to build the MARCXML record from 
-the form submission.
-
-FIXME: this could use some better code documentation
-
-=back
-
-=cut
-
-sub html2marcxml {
-    my ($tags,$subfields,$values,$indicator,$ind_tag) = @_;
-	my $error;
-	# add the header info
-    my $marcxml= MARC::File::XML::header(C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
-
-	# some flags used to figure out where in the record we are
-    my $prevvalue;
-    my $prevtag=-1;
-    my $first=1;
-    my $j = -1;
-
-	# handle characters that would cause the parser to choke FIXME: is there a more elegant solution?
-    for (my $i=0;$i<=@$tags;$i++){
-		@$values[$i] =~ s/&/&amp;/g;
-		@$values[$i] =~ s/</&lt;/g;
-		@$values[$i] =~ s/>/&gt;/g;
-		@$values[$i] =~ s/"/&quot;/g;
-		@$values[$i] =~ s/'/&apos;/g;
-        
-		if ((@$tags[$i] ne $prevtag)){
-			$j++ unless (@$tags[$i] eq "");
-			#warn "IND:".substr(@$indicator[$j],0,1).substr(@$indicator[$j],1,1)." ".@$tags[$i];
-			if (!$first){
-				$marcxml.="</datafield>\n";
-				if ((@$tags[$i] > 10) && (@$values[$i] ne "")){
-                	my $ind1 = substr(@$indicator[$j],0,1);
-					my $ind2 = substr(@$indicator[$j],1,1);
-					$marcxml.="<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
-					$marcxml.="<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
-					$first=0;
-				} else {
-					$first=1;
-				}
-			} else {
-				if (@$values[$i] ne "") {
-					# handle the leader
-					if (@$tags[$i] eq "000") {
-						$marcxml.="<leader>@$values[$i]</leader>\n";
-						$first=1;
-					# rest of the fixed fields
-					} elsif (@$tags[$i] < 010) { #FIXME: <10 was the way it was, there might even be a better way
-						$marcxml.="<controlfield tag=\"@$tags[$i]\">@$values[$i]</controlfield>\n";
-						$first=1;
-					} else {
-						my $ind1 = substr(@$indicator[$j],0,1);
-						my $ind2 = substr(@$indicator[$j],1,1);
-						$marcxml.="<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
-						$marcxml.="<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
-						$first=0;
-					}
-				}
-			}
-		} else { # @$tags[$i] eq $prevtag
-			if (@$values[$i] eq "") {
-			} else {
-				if ($first){
-					my $ind1 = substr(@$indicator[$j],0,1);
-					my $ind2 = substr(@$indicator[$j],1,1);
-					$marcxml.="<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
-					$first=0;
-				}
-				$marcxml.="<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
-			}
-		}
-		$prevtag = @$tags[$i];
-	}
-	$marcxml.= MARC::File::XML::footer();
-	#warn $marcxml;
-	return ($error,$marcxml);
-}
-
-=head2 html2marc
-
-=over 4
-
-Probably best to avoid using this ... it has some rather striking problems:
-
-=over 2
-
-* saves blank subfields
-
-* subfield order is hardcoded to always start with 'a' for repeatable tags (because it is hardcoded in the addfield routine).
-
-* only possible to specify one set of indicators for each set of tags (ie, one for all the 650s). (because they were stored in a hash with the tag as the key).
-
-* the underlying routines didn't support subfield reordering or subfield repeatability.
-
-=back 
-
-I've left it in here because it could be useful if someone took the time to fix it. -- kados
-
-=back
-
-=cut
-
-sub html2marc {
-    my ($dbh,$rtags,$rsubfields,$rvalues,%indicators) = @_;
-    my $prevtag = -1;
-    my $record = MARC::Record->new();
-#   my %subfieldlist=();
-    my $prevvalue; # if tag <10
-    my $field; # if tag >=10
-    for (my $i=0; $i< @$rtags; $i++) {
-        # rebuild MARC::Record
-#           warn "0=>".@$rtags[$i].@$rsubfields[$i]." = ".@$rvalues[$i].": ";
-        if (@$rtags[$i] ne $prevtag) {
-            if ($prevtag < 10) {
-                if ($prevvalue) {
-                    if (($prevtag ne '000') && ($prevvalue ne "")) {
-                        $record->add_fields((sprintf "%03s",$prevtag),$prevvalue);
-                    } elsif ($prevvalue ne ""){
-                        $record->leader($prevvalue);
-                    }
-                }
-            } else {
-                if (($field) && ($field ne "")) {
-                    $record->add_fields($field);
-                }
-            }
-            $indicators{@$rtags[$i]}.='  ';
-                # skip blank tags, I hope this works
-                if (@$rtags[$i] eq ''){
-                $prevtag = @$rtags[$i];
-                undef $field;
-                next;
-            }
-            if (@$rtags[$i] <10) {
-                $prevvalue= @$rvalues[$i];
-                undef $field;
-            } else {
-                undef $prevvalue;
-                if (@$rvalues[$i] eq "") {
-                undef $field;
-                } else {
-                $field = MARC::Field->new( (sprintf "%03s",@$rtags[$i]), substr($indicators{@$rtags[$i]},0,1),substr($indicators{@$rtags[$i]},1,1), @$rsubfields[$i] => @$rvalues[$i]);
-                }
-#           warn "1=>".@$rtags[$i].@$rsubfields[$i]." = ".@$rvalues[$i].": ".$field->as_formatted;
-            }
-            $prevtag = @$rtags[$i];
-        } else {
-            if (@$rtags[$i] <10) {
-                $prevvalue=@$rvalues[$i];
-            } else {
-                if (length(@$rvalues[$i])>0) {
-                    $field->add_subfields(@$rsubfields[$i] => @$rvalues[$i]);
-#           warn "2=>".@$rtags[$i].@$rsubfields[$i]." = ".@$rvalues[$i].": ".$field->as_formatted;
-                }
-            }
-            $prevtag= @$rtags[$i];
-        }
-    }
-    #}
-    # the last has not been included inside the loop... do it now !
-    #use Data::Dumper;
-    #warn Dumper($field->{_subfields});
-    $record->add_fields($field) if (($field) && $field ne "");
-    #warn "HTML2MARC=".$record->as_formatted;
-    return $record;
-}
-
-=head2 changeEncoding - Change the encoding of a record
-
-=over 4
-
-my ($error, $newrecord) = changeEncoding($record,$format,$flavour,$to_encoding,$from_encoding);
-
-Changes the encoding of a record
-
-=over 2
-
-C<$record> - the record itself can be in ISO-2709, a MARC::Record object, or MARCXML for now (required)
-
-C<$format> - MARC or MARCXML (required)
-
-C<$flavour> - MARC21 or UNIMARC, if MARC21, it will change the leader (optional) [defaults to Koha system preference]
-
-C<$to_encoding> - the encoding you want the record to end up in (optional) [UTF-8]
-
-C<$from_encoding> - the encoding the record is currently in (optional, it will probably be able to tell unless there's a problem with the record)
-
-=back 
-
-FIXME: the from_encoding doesn't work yet
-
-FIXME: better handling for UNIMARC, it should allow management of 100 field
-
-FIXME: shouldn't have to convert to and from xml/marc just to change encoding someone needs to re-write MARC::Record's 'encoding' method to actually alter the encoding rather than just changing the leader
-
-=back
-
-=cut
-
-sub changeEncoding {
-	my ($record,$format,$flavour,$to_encoding,$from_encoding) = @_;
-	my $newrecord;
-	my $error;
-	unless($flavour) {$flavour = C4::Context->preference("marcflavour")};
-	unless($to_encoding) {$to_encoding = "UTF-8"};
-	
-	# ISO-2709 Record (MARC21 or UNIMARC)
-	if (lc($format) =~ /^marc$/o) {
-		# if we're converting encoding of an ISO2709 file, we need to roundtrip through XML
-		# 	because MARC::Record doesn't directly provide us with an encoding method
-		# 	It's definitely less than idea and should be fixed eventually - kados
-		my $marcxml; # temporary storage of MARCXML scalar
-		($error,$marcxml) = marc2marcxml($record,$to_encoding,$flavour);
-		unless ($error) {
-			($error,$newrecord) = marcxml2marc($marcxml,$to_encoding,$flavour);
-		}
-	
-	# MARCXML Record
-	} elsif (lc($format) =~ /^marcxml$/o) { # MARCXML Record
-		my $marc;
-		($error,$marc) = marcxml2marc($record,$to_encoding,$flavour);
-		unless ($error) {
-			($error,$newrecord) = marc2marcxml($record,$to_encoding,$flavour);
-		}
-	} else {
-		$error.="Unsupported record format:".$format;
-	}
-	return ($error,$newrecord);
-}
-
-=head1 INTERNAL FUNCTIONS
-
-=head2 _entity_encode - Entity-encode an array of strings
-
-=over 4
-
-my ($entity_encoded_string) = _entity_encode($string);
-
-or
-
-my (@entity_encoded_strings) = _entity_encode(@strings);
-
-Entity-encode an array of strings
-
-=back
-
-=cut
-
-sub _entity_encode {
-	my @strings = @_;
-	my @strings_entity_encoded;
-	foreach my $string (@strings) {
-		my $nfc_string = NFC($string);
-		$nfc_string =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
-		push @strings_entity_encoded, $nfc_string;
-	}
-	return @strings_entity_encoded;
-}
-
-END { }       # module clean-up code here (global destructor)
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Joshua Ferraro <jmf at liblime.com>
-
-=head1 MODIFICATIONS
-
-# $Id: Record.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-=cut

Index: modules/C4/Reserves2.pm
===================================================================
RCS file: modules/C4/Reserves2.pm
diff -N modules/C4/Reserves2.pm
--- modules/C4/Reserves2.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,759 +0,0 @@
-# -*- tab-width: 8 -*-
-# NOTE: This file uses standard 8-character tabs
-
-package C4::Reserves2;
-
-# $Id: Reserves2.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is hard coded with koha-reserves table to be used only by the OPAC -TG.
-#
-# 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 strict;
-require Exporter;
-
-use C4::Context;
-use C4::Biblio;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Reserves2 - FIXME
-
-=head1 SYNOPSIS
-
-  use C4::Reserves2;
-
-=head1 DESCRIPTION
-
-FIXME
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
-# FIXME Take out CalcReserveFee after it can be removed from opac-reserves.pl
- at EXPORT = qw(&FindReserves
-             &FindAllReserves
-		     &CheckReserves
- 		     &CheckWaiting
-		     &CancelReserve
-		     &CalcReserveFee
-		     &FillReserve
-		     &ReserveWaiting
-		     &CreateReserve
-		     &UpdateReserves
-		     &UpdateReserve
-		     &getreservetitle
-		     &Findgroupreserve
-			 &findActiveReserve
-		
-			);
-
-# make all your functions, whether exported or not;
-
-=item FindReserves
-
-  ($count, $results) = &FindReserves($biblionumber, $borrowernumber);
-
-Looks books up in the reserves. C<$biblionumber> is the biblionumber
-of the book to look up. C<$borrowernumber> is the borrower number of a
-patron whose books to look up.
-
-Either C<$biblionumber> or C<$borrowernumber> may be the empty string,
-but not both. If both are specified, C<&FindReserves> looks up the
-given book for the given patron. If only C<$biblionumber> is
-specified, C<&FindReserves> looks up that book for all patrons. If
-only C<$borrowernumber> is specified, C<&FindReserves> looks up all of
-that patron's reserves. If neither is specified, C<&FindReserves>
-barfs.
-
-C<&FindReserves> returns a two-element array:
-
-C<$count> is the number of elements in C<$results>.
-
-C<$results> is a reference-to-array; each element is a
-reference-to-hash, whose keys are (I think) all of the fields of the
-reserves, borrowers, and biblio tables of the Koha database.
-
-=cut
-#'
-sub FindReserves {
-	my ($bib, $bor) = @_;
-	my @params;
-
-	my $dbh = C4::Context->dbh;
-	# Find the desired items in the reserves
-	my $query="SELECT *, reserves.branchcode,  reserves.timestamp as rtimestamp,  DATE_FORMAT(reserves.timestamp, '%T')	AS time
-			   FROM reserves,borrowers,items ";
-	if ($bib ne ''){
-		#$bib = $dbh->quote($bib);
-		if ($bor ne ''){
-			# Both $bib and $bor specified
-			# Find a particular book for a particular patron
-			#$bor = $dbh->quote($bor);
-			$query .=  "WHERE (reserves.biblionumber = ?) and
-						      (borrowers.borrowernumber = ?) and
-						      (reserves.borrowernumber = borrowers.borrowernumber) and
-						    (reserves.itemnumber=items.itemnumber) and
-						      (cancellationdate IS NULL) and
-							  (found <> 1) ";
-						      
-						push @params, $bib, $bor;
-		} else {
-			# $bib specified, but not $bor
-			# Find a particular book for all patrons
-			$query .= "WHERE (reserves.borrowernumber = borrowers.borrowernumber) and
-					         (reserves.biblionumber = ?) and
-						    (reserves.itemnumber=items.itemnumber) and
-					         (cancellationdate IS NULL) and
-							 (found <> 1) ";
-
-							 push @params, $bib;
-		}
-	} else {
-		$query .= "WHERE (reserves.biblionumber = items.biblionumber) and
-		                 (borrowers.borrowernumber = ?) and
-					     (reserves.borrowernumber  = borrowers.borrowernumber) and
-						    (reserves.itemnumber=items.itemnumber) and
-					     (cancellationdate IS NULL) and
-					     (found <> 1)";
-
-						 push @params, $bor;
-	}
-	$query.=" order by reserves.timestamp";
-	my $sth = $dbh->prepare($query);
-	$sth->execute(@params);
-
-	my $i = 0;
-	my @results;
-	while (my $data = $sth->fetchrow_hashref){
-		my ($bibdata) =XMLgetbibliohash($dbh,$data->{'biblionumber'});
-		my ($itemhash)=XMLgetitemhash($dbh,$data->{'itemnumber'});
-		$data->{'holdingbranch'}=XML_readline_onerecord($itemhash,"holdingbranch","holdings");
-		$data->{'author'} =XML_readline_onerecord($bibdata,"author","biblios");
-		$data->{'publishercode'} = XML_readline_onerecord($bibdata,"publishercode","biblios");
-		$data->{'publicationyear'} = XML_readline_onerecord($bibdata,"publicationyear","biblios");
-		$data->{'title'} = XML_readline_onerecord($bibdata,"title","biblios");
-		push @results, $data;
-		$i++;
-	}
-	$sth->finish;
-
-	return($i,\@results);
-}
-
-=item FindAllReserves
-
-  ($count, $results) = &FindAllReserves($biblionumber, $borrowernumber);
-
-Looks books up in the reserves. C<$biblionumber> is the biblionumber
-of the book to look up. C<$borrowernumber> is the borrower number of a
-patron whose books to look up.
-
-Either C<$biblionumber> or C<$borrowernumber> may be the empty string,
-but not both. If both are specified, C<&FindReserves> looks up the
-given book for the given patron. If only C<$biblionumber> is
-specified, C<&FindReserves> looks up that book for all patrons. If
-only C<$borrowernumber> is specified, C<&FindReserves> looks up all of
-that patron's reserves. If neither is specified, C<&FindReserves>
-barfs.
-
-C<&FindAllReserves> returns a two-element array:
-
-C<$count> is the number of elements in C<$results>.
-
-C<$results> is a reference-to-array; each element is a
-reference-to-hash, whose keys are (I think) all of the fields of the
-reserves, borrowers, and biblio tables of the Koha database.
-
-=cut
-#'
-sub FindAllReserves {
-	my ($bib, $bor) = @_;
-	my @params;
-	
-my $dbh;
-
-	 $dbh = C4::Context->dbh;
-
-	# Find the desired items in the reserves
-	my $query="SELECT *,
-	                  reserves.branchcode,
-					  biblio.title AS btitle, 
-					  reserves.timestamp as rtimestamp,
-					  DATE_FORMAT(reserves.timestamp, '%T')	AS time
-			   FROM reserves,
-				    borrowers,
-                    biblio ";
-	if ($bib ne ''){
-		#$bib = $dbh->quote($bib);
-		if ($bor ne ''){
-			# Both $bib and $bor specified
-			# Find a particular book for a particular patron
-			#$bor = $dbh->quote($bor);
-			$query .=  "WHERE (reserves.biblionumber = ?) and
-						      (borrowers.borrowernumber = ?) and
-						      (reserves.borrowernumber = borrowers.borrowernumber) and
-						      (biblio.biblionumber = ?) and
-						      (cancellationdate IS NULL) and
-							  (found <> 1) and
-						      (reservefrom > NOW())";
-						push @params, $bib, $bor, $bib;
-		} else {
-			# $bib specified, but not $bor
-			# Find a particular book for all patrons
-			$query .= "WHERE (reserves.borrowernumber = borrowers.borrowernumber) and
-					         (biblio.biblionumber = ?) and
-					         (reserves.biblionumber = ?) and
-					         (cancellationdate IS NULL) and
-							 (found <> 1) and
-					         (reservefrom > NOW())";
-							 push @params, $bib, $bib;
-		}
-	} else {
-		$query .= "WHERE (reserves.biblionumber = biblio.biblionumber) and
-		                 (borrowers.borrowernumber = ?) and
-					     (reserves.borrowernumber  = borrowers.borrowernumber) and
-						 (reserves.biblionumber = biblio.biblionumber) and
-					     (cancellationdate IS NULL) and
-					     (found <> 1) and
-					     (reservefrom > NOW())";
-						 push @params, $bor;
-	}
-	$query.=" order by reserves.timestamp";
-	my $sth = $dbh->prepare($query);
-	$sth->execute(@params);
-
-	my $i = 0;
-	my @results;
-	while (my $data = $sth->fetchrow_hashref){
-		my $bibdata = C4::Search::bibdata($data->{'biblionumber'});
-		$data->{'author'} = $bibdata->{'author'};
-		$data->{'publishercode'} = $bibdata->{'publishercode'};
-		$data->{'publicationyear'} = $bibdata->{'publicationyear'};
-		$data->{'title'} = $bibdata->{'title'};
-		push @results, $data;
-		$i++;
-	}
-	$sth->finish;
-
-	return($i,\@results);
-}
-
-=item CheckReserves
-
-  ($status, $reserve) = &CheckReserves($itemnumber, $barcode);
-
-Find a book in the reserves.
-
-C<$itemnumber> is the book's item number. C<$barcode> is its barcode.
-Either one, but not both, may be false. If both are specified,
-C<&CheckReserves> uses C<$itemnumber>.
-
-$itemnubmer can be false, in which case uses the barcode. (Never uses
-both. $itemnumber gets priority).
-
-As I understand it, C<&CheckReserves> looks for the given item in the
-reserves. If it is found, that's a match, and C<$status> is set to
-C<Waiting>.
-
-Otherwise, it finds the most important item in the reserves with the
-same biblio number as this book (I'm not clear on this) and returns it
-with C<$status> set to C<Reserved>.
-
-C<&CheckReserves> returns a two-element list:
-
-C<$status> is either C<Waiting>, C<Reserved> (see above), or 0.
-
-C<$reserve> is the reserve item that matched. It is a
-reference-to-hash whose keys are mostly the fields of the reserves
-table in the Koha database.
-
-=cut
-#'
-sub CheckReserves {
-    my ($item, $barcode) = @_;
-#    warn "In CheckReserves: itemnumber = $item";
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if ($item) {
-	
-    } else {
-	my $qbc=$dbh->quote($barcode);
-	# Look up the item by barcode
-	$sth=$dbh->prepare("SELECT items.itemnumber
-                             FROM items
-                            WHERE  barcode=$qbc");
-	    $sth->execute;
-	($item) = $sth->fetchrow;
-    $sth->finish;
-    }
-
-    
-# if item is not for loan it cannot be reserved either.....
-#    return (0, 0) if ($notforloan);
-# get the reserves...
-    # Find this item in the reserves
-    my ($count, @reserves) = Findgroupreserve($item);
-    # $priority and $highest are used to find the most important item
-    # in the list returned by &Findgroupreserve. (The lower $priority,
-    # the more important the item.)
-    # $highest is the most important item we've seen so far.
-    my $priority = 10000000;
-    my $highest;
-    if ($count) {
-	foreach my $res (@reserves) {
-	   if ($res->{found} eq "W"){
-	   return ("Waiting", $res);
-		}else{
-		# See if this item is more important than what we've got
-		# so far.
-		if ($res->{'priority'} != 0 && $res->{'priority'} < $priority) {
-		    $priority = $res->{'priority'};
-		    $highest = $res;
-		}
-	   }
-	}
-    }
-
-    # If we get this far, then no exact match was found. Print the
-    # most important item on the list. I think this tells us who's
-    # next in line to get this book.
-    if ($highest) {	# FIXME - $highest might be undefined
-	$highest->{'itemnumber'} = $item;
-	return ("Reserved", $highest);
-    } else {
-	return (0, 0);
-    }
-}
-
-=item CancelReserve
-
-  &CancelReserve($reserveid);
-
-Cancels a reserve.
-
-Use reserveid to cancel the reservation.
-
-C<$reserveid> is the reserve ID to cancel.
-
-=cut
-#'
-sub CancelReserve {
-    my ($biblio, $item, $borr) = @_;
-
-my $dbh;
-
-	 $dbh = C4::Context->dbh;
-
-    #warn "In CancelReserve";
-    if (($item and $borr) and (not $biblio)) {
-		# removing a waiting reserve record....
-		# update the database...
-		my $sth = $dbh->prepare("update reserves set cancellationdate = now(),
-											found            = Null,
-											priority         = 0
-									where itemnumber       = ?
-										and borrowernumber   = ?");
-		$sth->execute($item,$borr);
-		$sth->finish;
-    }
-    if (($biblio and $borr) and (not $item)) {
-		# removing a reserve record....
-		# get the prioritiy on this record....
-		my $priority;
-		my $sth=$dbh->prepare("SELECT priority FROM reserves
-										WHERE biblionumber   = ?
-										AND borrowernumber = ?
-										AND cancellationdate is NULL
-										AND (found <> 1 )");
-		$sth->execute($biblio,$borr);
-		($priority) = $sth->fetchrow_array;
-		$sth->finish;
-
-		# update the database, removing the record...
-		 $sth = $dbh->prepare("update reserves set cancellationdate = now(),
-											found            = 0,
-											priority         = 0
-									where biblionumber     = ?
-										and borrowernumber   = ?
-										and cancellationdate is NULL
-										and (found <> 1 )");
-		$sth->execute($biblio,$borr);
-		$sth->finish;
-		# now fix the priority on the others....
-		fixpriority($priority, $biblio);
-    }
-}
-=item FillReserve
-
-  &FillReserve($reserveid, $itemnumber);
-
-Fill a reserve. If I understand this correctly, this means that the
-reserved book has been found and given to the patron who reserved it.
-
-C<$reserve> specifies the reserve id to fill. 
-
-C<$itemnumber> specifies the borrowed itemnumber for the reserve. 
-
-=cut
-#'
-sub FillReserve {
-    my ($res) = @_;
-my $dbh;
-	 $dbh = C4::Context->dbh;
-    # fill in a reserve record....
-    # FIXME - Remove some of the redundancy here
-    my $biblio = $res->{'biblionumber'}; my $qbiblio =$biblio;
-    my $borr = $res->{'borrowernumber'}; 
-    my $resdate = $res->{'reservedate'}; 
-
-    # get the priority on this record....
-    my $priority;
-    {
-    my $query = "SELECT priority FROM reserves
-                                WHERE biblionumber   = ?
-                                  AND borrowernumber = ?
-                                  AND reservedate    = ?";
-    my $sth=$dbh->prepare($query);
-    $sth->execute($qbiblio,$borr,$resdate);
-    ($priority) = $sth->fetchrow_array;
-    $sth->finish;
-    }
-
-    # update the database...
-    {
-    my $query = "UPDATE reserves SET found            = 1,
-                                     priority         = 0
-                               WHERE biblionumber     = ?
-                                 AND reservedate      = ?
-                                 AND borrowernumber   = ?";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($qbiblio,$resdate,$borr);
-    $sth->finish;
-    }
-
-    # now fix the priority on the others (if the priority wasn't
-    # already sorted!)....
-    unless ($priority == 0) {
-	fixpriority($priority, $biblio);
-    }
-}
-
-# Only used internally
-# Decrements (makes more important) the reserves for all of the
-# entries waiting on the given book, if their priority is > $priority.
-sub fixpriority {
-    my ($priority, $biblio) =  @_;
-my $dbh;
- $dbh = C4::Context->dbh;
-
-    my ($count, $reserves) = FindReserves($biblio);
-    foreach my $rec (@$reserves) {
-	if ($rec->{'priority'} > $priority) {
-	    my $sth = $dbh->prepare("UPDATE reserves SET priority = ?
-                               WHERE biblionumber     = ?
-                                 AND borrowernumber   = ?
-                                 AND reservedate      = ?");
-	    $sth->execute($rec->{'priority'},$rec->{'biblionumber'},$rec->{'borrowernumber'},$rec->{'reservedate'});
-	    $sth->finish;
-	}
-    }
-}
-
-# XXX - POD
-sub ReserveWaiting {
-    my ($item, $borr) = @_;
-	
-my $dbh;
-
-	 $dbh = C4::Context->dbh;
-
-# get priority and biblionumber....
-    my $sth = $dbh->prepare("SELECT reserves.priority     as priority,
-                        reserves.biblionumber as biblionumber,
-                        reserves.branchcode   as branchcode,
-                        reserves.timestamp     as timestamp
-                      FROM reserves
-                     WHERE  reserves.itemnumber        = ?
-                       AND reserves.borrowernumber = ?
-                       AND reserves.cancellationdate is NULL
-                       AND (reserves.found <> '1' or reserves.found is NULL)");
-    $sth->execute($item,$borr);
-    my $data = $sth->fetchrow_hashref;
-    $sth->finish;
-    my $biblio = $data->{'biblionumber'};
-    my $timestamp = $data->{'timestamp'};
-# update reserves record....
-    $sth = $dbh->prepare("UPDATE reserves SET priority = 0, found = 'W'
-                            WHERE borrowernumber = ?
-                              AND itemnumber = ?
-                              AND timestamp = ?");
-    $sth->execute($borr,$item,$timestamp);
-    $sth->finish;
-# now fix up the remaining priorities....
-    fixpriority($data->{'priority'}, $biblio);
-    my $branchcode = $data->{'branchcode'};
-    return $branchcode;
-}
-
-# XXX - POD
-sub CheckWaiting {
-    my ($borr)=@_;
-	
-my $dbh;
-	 $dbh = C4::Context->dbh;
-    my @itemswaiting;
-    my $sth = $dbh->prepare("SELECT * FROM reserves
-                         WHERE borrowernumber = ?
-                           AND reserves.found = 'W'
-                           AND cancellationdate is NULL");
-    $sth->execute($borr);
-    while (my $data=$sth->fetchrow_hashref) {
-	  push(@itemswaiting,$data);
-    }
-    $sth->finish;
-    return (scalar(@itemswaiting),\@itemswaiting);
-}
-
-=item Findgroupreserve
-
-  ($count, @results) = &Findgroupreserve($biblioitemnumber, $biblionumber);
-
-I don't know what this does, because I don't understand how reserve
-constraints work. I think the idea is that you reserve a particular
-biblio, and the constraint allows you to restrict it to a given
-biblioitem (e.g., if you want to borrow the audio book edition of "The
-Prophet", rather than the first available publication).
-
-C<&Findgroupreserve> returns a two-element array:
-
-C<$count> is the number of elements in C<@results>.
-
-C<@results> is an array of references-to-hash whose keys are mostly
-fields from the reserves table of the Koha database, plus
-C<biblioitemnumber>.
-
-=cut
-#'
-sub Findgroupreserve {
-  my ($itemnumber)=@_;
-
-my	 $dbh = C4::Context->dbh;
-
-  my $sth = $dbh->prepare("SELECT *
-                           FROM reserves
-                           WHERE (itemnumber = ?) AND
-							     (cancellationdate IS NULL) AND
-			                     (found <> 1) 
-						   ORDER BY timestamp");
-  $sth->execute($itemnumber);
-  my @results;
-  while (my $data = $sth->fetchrow_hashref) {
-		push(@results,$data);
-  }
-  $sth->finish;
-  return(scalar(@results), at results);
-}
-
-# FIXME - A somewhat different version of this function appears in
-# C4::Reserves. Pick one and stick with it.
-# XXX - POD
-sub CreateReserve {
-	my ($env, $borrnum,$registeredby ,$biblionumber,$reservefrom, $reserveto, $branch, 
-	  $constraint, $priority, $notes, $title,$bibitems,$itemnumber) = @_;
-
-my 	 $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("INSERT INTO reserves
-								(borrowernumber, registeredby, reservedate, biblionumber, reservefrom, 
-								reserveto, branchcode, constrainttype, priority, found, reservenotes,itemnumber)
-  							VALUES (?, ?, NOW(),?,?,?,?,?,?,0,?,?)");
-    $sth->execute($borrnum, $registeredby, $biblionumber, $reservefrom, $reserveto, $branch, $constraint, $priority, $notes,$itemnumber);
-my $fee=CalcReserveFee($env,$borrnum,$biblionumber,$constraint,$bibitems);
- if ($fee > 0) {
-
-    my $nextacctno = &getnextacctno($env,$borrnum,$dbh);
-    my $usth = $dbh->prepare("insert into accountlines
-    (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
-						          values
-    (?,?,now(),?,?,'Res',?)");
-    $usth->execute($borrnum,$nextacctno,$fee,'Reserve Charge -'. $title,$fee);
-    $usth->finish;
-  }
-	return 1;
-}
-
-# FIXME - A functionally identical version of this function appears in
-# C4::Reserves. Pick one and stick with it.
-# XXX - Internal use only
-# FIXME - opac-reserves.pl need to use it, temporarily put into @EXPORT
-
-sub CalcReserveFee {
-  my ($env,$borrnum,$biblionumber,$constraint,$bibitems) = @_;
-  #check for issues;
-my	 $dbh = C4::Context->dbh;
-
-
-  my $const = lc substr($constraint,0,1);
-  my $sth = $dbh->prepare("SELECT * FROM borrowers,categories
-                WHERE (borrowernumber = ?)
-                  AND (borrowers.categorycode = categories.categorycode)");
-  $sth->execute($borrnum);
-  my $data = $sth->fetchrow_hashref;
-  $sth->finish();
-  my $fee = $data->{'reservefee'};
-  
-  if ($fee > 0) {
-    # check for items on issue
-   
-   
-    my $issues = 0;
-    my $x = 0;
-    my $allissued = 1;
-  
-      my $sth2 = $dbh->prepare("SELECT * FROM items
-                     WHERE biblionumber = ?");
-      $sth2->execute($biblionumber);
-      while (my $itdata=$sth2->fetchrow_hashref) {
-        my $sth3 = $dbh->prepare("SELECT * FROM issues
-                       WHERE itemnumber = ?
-                         AND returndate IS NULL");
-        $sth3->execute($itdata->{'itemnumber'});
-        if (my $isdata=$sth3->fetchrow_hashref) {
-	} else {
-	  $allissued = 0;
-	}
-      }
-
-    
-    if ($allissued == 0) {
-      my $rsth = $dbh->prepare("SELECT * FROM reserves WHERE biblionumber = ?");
-      $rsth->execute($biblionumber);
-      if (my $rdata = $rsth->fetchrow_hashref) {
-      } else {
-        $fee = 0;
-      }
-    }
-  }
-#  print "fee $fee";
- 
-  return $fee;
-}
-
-# XXX - Internal use
-sub getnextacctno {
-  my ($env,$bornumber,$dbh)=@_;
-  my $nextaccntno = 1;
-  my $sth = $dbh->prepare("select * from accountlines
-  where (borrowernumber = ?)
-  order by accountno desc");
-  $sth->execute($bornumber);
-  if (my $accdata=$sth->fetchrow_hashref){
-    $nextaccntno = $accdata->{'accountno'} + 1;
-  }
-  $sth->finish;
-  return($nextaccntno);
-}
-
-# XXX - POD
-sub UpdateReserves {
-    #subroutine to update a reserve
-    my ($rank,$biblio,$borrower,$branch,$cataloger)=@_;
-    return if $rank eq "W";
-    return if $rank eq "n";
-my $dbh;
-	 $dbh = C4::Context->dbh;
-
-    if ($rank eq "del") {
-	my $sth=$dbh->prepare("UPDATE reserves SET cancellationdate=now(),registeredby=?
-                                   WHERE biblionumber   = ?
-                                     AND borrowernumber = ?
-	                             AND cancellationdate is NULL
-                                     AND (found <> 1 )");
-	$sth->execute($cataloger,$biblio, $borrower);
-	$sth->finish;
-    } else {
-	my $sth=$dbh->prepare("UPDATE reserves SET priority = ? ,branchcode = ?,  found = 0
-                                   WHERE biblionumber   = ?
-                                     AND borrowernumber = ?
-	                             AND cancellationdate is NULL
-                                     AND (found <> 1)");
-	$sth->execute($rank, $branch, $biblio, $borrower);
-	$sth->finish;
-    }
-}
-
-# XXX - POD
-sub UpdateReserve {
-    #subroutine to update a reserve
-    my ($reserveid, $timestamp) = @_;
-
-my $dbh;
-	 $dbh = C4::Context->dbh;
-
-
-	my $sth=$dbh->prepare("UPDATE reserves 
-	                       SET timestamp = $timestamp,
-							   reservedate = DATE_FORMAT($timestamp, '%Y-%m-%d')
-                           WHERE (reserveid = $reserveid)");
-	$sth->execute();
-	$sth->finish;
-}
-
-# XXX - PODXX Is this function Used?
-sub getreservetitle {
- my ($biblio,$bor,$date,$timestamp)=@_;
-my	 $dbh = C4::Context->dbh;
-
-
- my $sth=$dbh->prepare("Select * from reserveconstraints where
- reserveconstraints.biblionumber=? and reserveconstraints.borrowernumber
- = ? and reserveconstraints.reservedate=? and
- reserveconstraints.timestamp=?");
- $sth->execute($biblio,$bor,$date,$timestamp);
- my $data=$sth->fetchrow_hashref;
- $sth->finish;
- return($data);
-}
-
-sub findActiveReserve {
-	my ($borrowernumber, $biblionumber, $from, $days) = @_;
-my	 $dbh = C4::Context->dbh;
-
-	my $sth = $dbh->prepare("SELECT * 
-							FROM reserves 
-							WHERE 
-								borrowernumber = ? 
-								AND biblionumber = ? 
-								AND (cancellationdate IS NULL) 
-								AND (found <> 1) 
-								AND ((? BETWEEN reservefrom AND reserveto) 
-								OR (ADDDATE(?, INTERVAL ? DAY) BETWEEN reservefrom AND reserveto))
-							");
-	$sth->execute($borrowernumber, $biblionumber, $from, $from, $days);
-	return ($sth->rows);
-}
-
-1;
-__END__
\ No newline at end of file

Index: modules/C4/Review.pm
===================================================================
RCS file: modules/C4/Review.pm
diff -N modules/C4/Review.pm
--- modules/C4/Review.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,196 +0,0 @@
-package C4::Review;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use C4::Context;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Review - Perl Module containing routines for dealing with reviews of items
-
-=head1 SYNOPSIS
-
-  use C4::Review;
-
-
-  my $review=getreview($biblionumber,$borrowernumber);
-  savereview($biblionumber,$borrowernumber,$review);
-  updatereview($biblionumber,$borrowernumber,$review);
-  my $count=numberofreviews($biblionumber);
-  my $reviews=getreviews($biblionumber);
-  my $reviews=getallreviews($status);
-
-=head1 DESCRIPTION
-
-Review.pm provides many routines for manipulating reviews.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA    = qw(Exporter);
- at EXPORT = qw(getreview savereview updatereview numberofreviews
-  getreviews getallreviews approvereview deletereview);
-
-use vars qw();
-
-my $DEBUG = 0;
-
-=head2 getreview
-
-  $review = getreview($biblionumber,$borrowernumber);
-
-Takes a borrowernumber and a biblionumber and returns the review of that biblio
-
-
-=cut
-
-sub getreview {
-    my ( $biblionumber, $borrowernumber ) = @_;
-    my $dbh   = C4::Context->dbh;
-    my $query =
-      "SELECT * FROM reviews WHERE biblionumber=? and borrowernumber=?";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $biblionumber, $borrowernumber );
-    my $review = $sth->fetchrow_hashref();
-    $sth->finish();
-    return $review;
-}
-
-sub savereview {
-    my ( $biblionumber, $borrowernumber, $review ) = @_;
-    my $dbh   = C4::Context->dbh;
-    my $query = "INSERT INTO reviews (borrowernumber,biblionumber,
-	review,approved,datereviewed) VALUES 
-  (?,?,?,?,now())";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $borrowernumber, $biblionumber, $review, 0 );
-    $sth->finish();
-}
-
-sub updatereview {
-    my ( $biblionumber, $borrowernumber, $review ) = @_;
-    my $dbh   = C4::Context->dbh;
-    my $query = "UPDATE reviews SET review=?,datereviewed=now(),approved=?
-  WHERE borrowernumber=? and biblionumber=?";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $review, 0, $borrowernumber, $biblionumber );
-    $sth->finish();
-
-}
-
-sub numberofreviews {
-    my ($biblionumber) = @_;
-    my $dbh            = C4::Context->dbh;
-    my $query          =
-      "SELECT count(*) FROM reviews WHERE biblionumber=? and approved=?";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $biblionumber, 1 );
-    my $count = $sth->fetchrow_hashref;
-
-    $sth->finish();
-    return ( $count->{'count(*)'} );
-}
-
-sub getreviews {
-    my ( $biblionumber, $approved ) = @_;
-    my $dbh   = C4::Context->dbh;
-    my $query =
-"SELECT * FROM reviews WHERE biblionumber=? and approved=? order by datereviewed desc";
-    my $sth = $dbh->prepare($query) || warn $dbh->err_str;
-    $sth->execute( $biblionumber, $approved );
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref() ) {
-        push @results, $data;
-    }
-    $sth->finish();
-    return ( \@results );
-}
-
-sub getallreviews {
-    my ($status) = @_;
-    my $dbh      = C4::Context->dbh;
-    my $query    =
-      "SELECT * FROM reviews WHERE approved=? order by datereviewed desc";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($status);
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref() ) {
-        push @results, $data;
-    }
-    $sth->finish();
-    return ( \@results );
-}
-
-=head2 approvereview
-
-  approvereview($reviewid);
-
-Takes a reviewid and marks that review approved
-
-
-=cut
-
-sub approvereview {
-    my ($reviewid) = @_;
-    my $dbh        = C4::Context->dbh();
-    my $query      = "UPDATE reviews
-               SET approved=?
-               WHERE reviewid=?";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( 1, $reviewid );
-    $sth->finish();
-}
-
-=head2 deletereview
-
-  deletereview($reviewid);
-
-Takes a reviewid and deletes it
-
-
-=cut
-
-sub deletereview {
-    my ($reviewid) = @_;
-    my $dbh        = C4::Context->dbh();
-    my $query      = "DELETE FROM reviews
-               WHERE reviewid=?";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($reviewid);
-    $sth->finish();
-}
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Team
-
-=cut

Index: modules/C4/SMS.pm
===================================================================
RCS file: modules/C4/SMS.pm
diff -N modules/C4/SMS.pm
--- modules/C4/SMS.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,149 +0,0 @@
-package C4::SMS;
-#Written by tgarip at neu.edu.tr for SMS message sending and other SMS related services
-
-use strict;
-require Exporter;
-use LWP::UserAgent;
-use C4::Context;
-use vars qw($VERSION @ISA @EXPORT);
-$VERSION = 0.01;
-my $user=C4::Context->config('smsuser');
-my $pwd=C4::Context->config('smspass');
-my $uri ="https://spgw.kktcell.com/smshttpproxy/SmsHttpProxyServlet";
-
-
-
- at ISA = qw(Exporter);
-
- at EXPORT = qw(
-&get_sms_auth 
-&send_sms 
-&read_sms
-&error_codes
-&parse_phone
-&parse_message
-&write_sms
-&mod_sms
-&kill_sms
-);
-
-sub get_sms_auth {
-    my $ua      = LWP::UserAgent->new;
-my $commands;
- my $res=$ua->post($uri,[cmd=>'REGISTER',pUser=>$user,pPwd=>$pwd]);
-	if ($res->is_success){	
-	$commands=parse_content($res->content);
-	}
-return($commands,$ua);
-}
-
-sub send_sms{
-my $ua=shift;
-my $phone=shift;
-my $message=shift;
-my $session=shift;
- my $res=$ua->post($uri,[cmd=>'SENDSMS',pUser=>$user,pPwd=>$pwd,pSessionId=>$session,pService_Code=>4130,pMsisdn=>$phone,
-		pContent=>$message]);
-return parse_content($res->content);
-}
-sub read_sms{
-my $ua=shift;
-my $session=shift;
- my $res=$ua->post($uri,[cmd=>'GETSMS',pUser=>$user,pPwd=>$pwd,pSessionId=>$session,pService_Code=>4130]);
-return parse_content($res->content);
-}
-sub parse_content{
-my $content=shift;
-my %commands;
-my @attributes=split /&/,$content;
-	foreach my $params(@attributes){
-	my (@param)=split /=/,$params;
-	$commands{$param[0]}=$param[1];
-	}
-return(\%commands);
-}
-
-sub error_codes{
-my $error=shift;
-if ($error==-1){
-return	 "Closed session - Retry ";
-}elsif($error==-2){
-return	 "Invalid session - Retry ";
-}elsif($error==-3){
-return	 "Invalid password"	;
-}elsif($error==-103){
-return		 "Invalid user";
-}elsif($error==-422){
-return		 "Invalid Parameter";
-}elsif($error==-426){
-return	"User doesn’t have permission to send message";
-}elsif($error==-700){
-return	"No permission";
-}elsif($error==-801){
-return	" Msdisn count differs-warn administartor";
-}elsif($error==-803){
-return	"Content count differs from XSER count";
-}elsif($error==-1101){
-return	" Insufficient Credit	Do not retry" ;
-}elsif($error==-1104){
-return	"Invalid Phone number";
-}elsif($error==-10001){
-return	" Internal system error- Tell Turkcell/Telsim";
-}elsif($error==-9005){
-return	" No messages to read";
-}elsif ($error){
-return	"Unknow error no $error occured - tell Turkcell/Telsim";
-}
-}
-
-sub parse_phone{
-## checks acceptable phone numbers
-## Fix to accept Telsim when available (542 numbers)
-my $phone=shift;
-$phone=~s/^0//g;
-$phone=~s/ //g;
-my $length=length($phone);
-if ($length==10 || $length==12){
-my $code=substr($phone,0,3) if $length==10;
- $code=substr($phone,0,5) if $length==12;
-	if ($code=~/533/){
-	return $phone;
-	}else{
-	return 0;
-	}
-}else{
-return 0;
-}
-}
-
-sub parse_message{
-my $message=shift;
-$message=~s/  / /g;
-my @parsed=split / /,$message;
-return (@parsed);
-}
-
-sub write_sms{
-my ($userid,$message,$phone)=@_;
-my $dbh=C4::Context->dbh;
-my $sth=$dbh->prepare("INSERT into sms_messages(userid,message,user_phone,date_received) values(?,?,?,now())");
-$sth->execute($userid,$message,$phone);
-$sth->finish;
-return $dbh->{'mysql_insertid'};
-}
-
-sub mod_sms{
-my ($smsid,$message)=@_;
-my $dbh=C4::Context->dbh;
-my $sth=$dbh->prepare("UPDATE sms_messages set reply=? ,date_replied=now() where smsid=?");
-$sth->execute($message,$smsid);
-$sth->finish;
-}
-sub kill_sms{
-#end a session
-my $ua=shift;
-my $session=shift;
- my $res=$ua->post($uri,[cmd=>'KILLSESSION',pSessionId=>$session]);
-}
-1;
-__END__
\ No newline at end of file

Index: modules/C4/Search.pm
===================================================================
RCS file: modules/C4/Search.pm
diff -N modules/C4/Search.pm
--- modules/C4/Search.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,1073 +0,0 @@
-package C4::Search;
-
-# Copyright 2000-2002 Katipo Communications
-# 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 strict;
-require Exporter;
-use C4::Context;
-use C4::Reserves2;
-use C4::Biblio;
-use ZOOM;
-use Encode;
-use C4::Date;
-use Time::HiRes qw(gettimeofday tv_interval);
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g;
-          shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
-
-=head1 NAME
-
-C4::Search - Functions for searching the Koha catalog and other databases
-
-=head1 SYNOPSIS
-
-  use C4::Search;
-
-  my ($count, @results) = catalogsearch4($env, $type, $search, $num, $offset);
-
-=head1 DESCRIPTION
-
-This module provides the searching facilities for the Koha catalog and
-ZEBRA databases.
-
-
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
- &barcodes   &ItemInfo &itemcount
- &getcoverPhoto &add_query_line
- &FindDuplicate   &ZEBRAsearch_kohafields &convertPQF &sqlsearch &cataloguing_search
-&getMARCnotes &getMARCsubjects &getMARCurls &getMARCadditional_authors &parsefields &spellSuggest);
-# make all your functions, whether exported or not;
-
-=head1
-ZEBRAsearchkohafields is the underlying API for searching zebra for KOHA internal use
-its kept similar to earlier version Koha Marc searches. instead of passing marc tags to the routine
-you pass named kohafields
-So you give an array of @kohafieldnames, at values, what relation they have @relations (equal, truncation etc) @and_or and
-you receive an array of XML records.
-The routine also has a flag $fordisplay and if it is set to 1 it will return the @results as an array of Perl hashes so that your previous
-search results templates do actually work.
-This routine will also take CCL,CQL or PQF queries and pass them straight to the server
-See sub FindDuplicates for an example;
-=cut
-
-
-
-
-sub ZEBRAsearch_kohafields{
-my ($kohafield,$value, $relation,$sort, $and_or, $fordisplay,$reorder,$startfrom,$number_of_results,$searchfrom,$searchtype)=@_;
-return (0,undef) unless (@$value[0]);
-
-my $server="biblioserver";
-my @results;
-my $attr;
-my $query;
-my $starttime;
-my $i;
-     unless($searchtype){
-	for ( $i=0; $i<=$#{$value}; $i++){
-	next if (@$value[$i] eq "");
-	my $keyattr=MARCfind_attr_from_kohafield(@$kohafield[$i]) if (@$kohafield[$i]);
-	if (!$keyattr){$keyattr=" \@attr 1=any";}
-	@$value[$i]=~ s/(\.|\?|\;|\=|\/|\\|\||\:|\*|\!|\,|\(|\)|\[|\]|\{|\}|\/|\")/ /g;
-	my $weighted=weightRank(@$kohafield[$i],@$value[$i],$i) unless($sort || $reorder);
-	$query.=$weighted.@$relation[$i]." ".$keyattr." \"".@$value[$i]."\" " if @$value[$i];
-	}
-	for (my $z= 0;$z<=$#{$and_or};$z++){
-	$query=@$and_or[$z]." ".$query if (@$value[$z+1] ne "");
-	}
-     }
-#warn $query;
-
-my @oConnection;
-($oConnection[0])=C4::Context->Zconn($server);
-my @sortpart;
-if ($reorder ){
- (@sortpart)=split /,/,$reorder;
-}elsif ($sort){
- (@sortpart)=split /,/,$sort;
-}
-if (@sortpart){
-##sortpart is expected to contain the form "title i<" notation or "title,1" both mean the same thing
-	if (@sortpart<2){
-	push @sortpart," "; ##In case multisort variable is coming as a single query
-	}
-	if ($sortpart[1]==2){
-	$sortpart[1]=">i"; ##Descending
-	}elsif ($sortpart[1]==1){
-	$sortpart[1]="<i"; ##Ascending
-	}
-}
-
-if ($searchtype){
-$query=convertPQF($searchtype,$oConnection[0],$value);
-}else{
-$query=new ZOOM::Query::PQF($query);
-}
-goto EXITING unless $query;## erronous query coming in
-$query->sortby($sortpart[0]." ".$sortpart[1]) if @sortpart;
-my $oResult;
-
-my $tried=0;
-
-my $numresults;
-
-retry:
-$starttime=[gettimeofday];
-$oResult= $oConnection[0]->search($query);
-my $i;
-my $event;
-   while (($i = ZOOM::event(\@oConnection)) != 0) {
-	$event = $oConnection[$i-1]->last_event();
-	last if $event == ZOOM::Event::ZEND;
-   }# while
-my $timetaken=sprintf("%.3f",tv_interval($starttime));	
-	 my($error, $errmsg, $addinfo, $diagset) = $oConnection[0]->error_x();
-	if ($error==10007 && $tried<3) {## timeout --another 30 looonng seconds for this update
-		$tried=$tried+1;
-		goto "retry";
-	}elsif ($error==2 && $tried<2) {## timeout --temporary zebra error !whatever that means
-		$tried=$tried+1;
-		goto "retry";
-	}elsif ($error){
-		warn "Error-$server    /errcode:, $error, /MSG:,$errmsg,$addinfo \n";	
-		$oResult->destroy();
-		$oConnection[0]->destroy();
-		return (undef,undef);
-	}
-my $dbh=C4::Context->dbh;
- $numresults=$oResult->size() ;
-
-   if ($numresults>0){
-	my $ri=0;
-	my $z=0;
-
-	$ri=$startfrom if $startfrom;
-		for ( $ri; $ri<$numresults ; $ri++){
-
-		my $xmlrecord=$oResult->record($ri)->raw();
-		$xmlrecord=Encode::decode("utf8",$xmlrecord);
-			 $xmlrecord=XML_xml2hash($xmlrecord);
-			$z++;
-
-			push @results,$xmlrecord;
-			last if ($number_of_results &&  $z>=$number_of_results);
-			
-	
-		}## for #numresults	
-			if ($fordisplay){
-			my ($facets, at parsed)=parsefields($dbh,$searchfrom, at results);
-			$oResult->destroy();
-			$oConnection[0]->destroy();
-			$parsed[0]->{timetaken}=$timetaken;
-			return ($numresults,$facets, at parsed)  ;
-			}
-    }# if numresults
-
-$oResult->destroy();
-$oConnection[0]->destroy();
-EXITING:
-return ($numresults, at results)  ;
-}
-
-sub weightRank {
-my ($kohafield,$value,$i)=@_;
-### If a multi query is received weighting is reduced from 1st query being highest rank to last query being lowest;
-my $weighted;
-my $weight=1000 -($i*100);
-$weight=100 if $weight==0;
-	return "" if $value eq "";
-	my $keyattr=MARCfind_attr_from_kohafield($kohafield) if ($kohafield);
-	return "" if($keyattr=~/4=109/ || $keyattr=~/4=4/ || $keyattr=~/4=5/); ###ranked sort not valid for numeric fields
-	my $fullfield; ### not all indexes are Complete-field. Use only for title||author
-	if ($kohafield eq "title" || $kohafield eq "" || $kohafield eq "any"){
-	$keyattr=" \@attr 1=title-cover";
- 	$fullfield="\@attr 6=3 ";
-	}elsif ($kohafield eq "author"){
-	$fullfield="\@attr 6=3 ";
-	}
-	$weighted.="\@attr 2=102 ".$keyattr." \@attr 3=1 $fullfield  \@attr 9=$weight \"".$value."\" " ;
-      $weighted=" \@or ".$weighted;
-  return $weighted;
-}
-sub convertPQF{
-# Convert CCL, CQF or PQF to ZEBRA RPN queries,trap errors
-my ($search_type,$zconn,$query)=@_;
-my $pqf_query;
-if ($search_type eq "pqf"){
-eval{
-$pqf_query=new ZOOM::Query::PQF(@$query[0]);
-};
-}elsif ($search_type eq "ccl"){
-
-my $cclfile=C4::Context->config("ccl2rpn");
-$zconn->option(cclfile=>$cclfile);## CCL conversion file path
-eval{
-$pqf_query=new ZOOM::Query::CCL2RPN(@$query[0],$zconn);
-};
-}elsif ($search_type eq "cql"){
-eval{
-$pqf_query=new ZOOM::Query::CQL(@$query[0]);
-};
-}
-if ($@){
-$pqf_query=0;
-}
-
-return $pqf_query;
-}
-
-
-=item add_bold_fields
-After a search the searched keyword is <b>boldened</b> in the displayed search results if it exists in the title or author
-It is now depreceated 
-=cut
-sub add_html_bold_fields {
-	my ($type, $data, $search) = @_;
-	foreach my $key ('title', 'author') {
-		my $new_key; 
-		
-			$new_key = 'bold_' . $key;
-			$data->{$new_key} = $data->{$key};	
-		my $key1;
-	
-			$key1 = $key;
-		
-
-		my @keys;
-		my $i = 1;
-		if ($type eq 'keyword') {
-		my $newkey=$search->{'keyword'};
-		$newkey=~s /\++//g;
-		@keys = split " ", $newkey;
-		} 
-		my $count = @keys;
-		for ($i = 0; $i < $count ; $i++) {
-			
-				if (($data->{$new_key} =~ /($keys[$i])/i) && (lc($keys[$i]) ne 'b') ) {
-					my $word = $1;
-					$data->{$new_key} =~ s/$word/<b>$word<\/b>/;
-				}
-			
-		}
-	}
-
-
-}
- sub sqlsearch{
-## This searches the SQL database only for biblionumber,itemnumber,barcode
-### Not very useful on production but as a debug tool useful during system maturing for ZEBRA operations
-
-my ($dbh,$search)=@_;
-my $sth;
-if ($search->{'barcode'} ne '') {
-	$sth=$dbh->prepare("SELECT biblionumber from items  where  barcode=?");
-	$sth->execute($search->{'barcode'});
-}elsif ($search->{'itemnumber'} ne '') {
-	$sth=$dbh->prepare("SELECT biblionumber from items  where itemnumber=?");
-	$sth->execute($search->{'itemnumber'});
-}elsif ($search->{'biblionumber'} ne '') {
-	$sth=$dbh->prepare("SELECT biblionumber from biblio where biblionumber=?");
-	$sth->execute($search->{'biblionumber'});
-}else{
-return (undef,undef);
-}
-
- my $result=$sth->fetchrow_hashref;
-return (1,$result) if $result;
-}
-
-sub cataloguing_search{
-## This is an SQL based search designed to be used when adding a new biblio incase library sets
-## preference zebraorsql to sql when adding a new biblio
-my ($search,$num,$offset) = @_;
-	my ($count, at results);
-my $dbh=C4::Context->dbh;
-#Prepare search
-my $query;
-my $condition="select SQL_CALC_FOUND_ROWS marcxml from biblio where ";
-if ($search->{'isbn'} ne''){
-$search->{'isbn'}=$search->{'isbn'}."%";
-$query=$search->{'isbn'};
-$condition.= "  isbn like ?  ";
-}else{
-return (0,undef) unless $search->{title};
-$query=$search->{'title'};
-$condition.= "  MATCH (title) AGAINST(? in BOOLEAN MODE )  ";
-}
-my $sth=$dbh->prepare($condition);
-$sth->execute($query);
- my $nbresult=$dbh->prepare("SELECT FOUND_ROWS()");
- $nbresult->execute;
- my $count=$nbresult->fetchrow;
-my $limit = $num + $offset;
-my $startfrom = $offset;
-my $i=0;
-my @results;
-while (my $marc=$sth->fetchrow){
-	if (($i >= $startfrom) && ($i < $limit)) {
-	my $record=XML_xml2hash_onerecord($marc);
-	my $data=XMLmarc2koha_onerecord($dbh,$record,"biblios");
-	push @results,$data;
-	}
-$i++;
-last if $i==$limit;
-}
-return ($count, at results);
-}
-
-
-
-sub FindDuplicate {
-	my ($xml)=@_;
-my $dbh=C4::Context->dbh;
-	my ($result) = XMLmarc2koha_onerecord($dbh,$xml,"biblios");
-	my @kohafield;
-	my @value;
-	my @relation;
-	my  @and_or;
-	
-	# search duplicate on ISBN, easy and fast..
-
-	if ($result->{isbn}) {
-	push @kohafield,"isbn";
-###Temporary fix for ISBN
-my $isbn=$result->{isbn};
-$isbn=~ s/(\.|\?|\;|\=|\/|\\|\||\:|\!|\'|,|\-|\"|\*|\(|\)|\[|\]|\{|\}|\/)//g;
-		push @value,$isbn;
-			}else{
-$result->{title}=~s /\\//g;
-$result->{title}=~s /\"//g;
-$result->{title}=~ s/(\.|\?|\;|\=|\/|\\|\||\:|\*|\!|\,|\-|\(|\)|\[|\]|\{|\}|\/)/ /g;
-	
-	push @kohafield,"title";
-	push @value,$result->{title};
-	push @relation,"\@attr 6=3 \@attr 4=1 \@attr 5=1"; ## right truncated,phrase,whole field
-
-	}
-	my ($total, at result)=ZEBRAsearch_kohafields(\@kohafield,\@value,\@relation,"",\@and_or,0,"",0,1);
-if ($total){
-my $title=XML_readline($result[0],"title","biblios") ;
-my $biblionumber=XML_readline($result[0],"biblionumber","biblios") ;
-		return $biblionumber,$title ;
-}
-
-}
-
-
-sub add_query_line {
-
-	my ($type,$search,$results)=@_;
-	my $dbh = C4::Context->dbh;
-	my $searchdesc = '';
-	my $from;
-	my $borrowernumber = $search->{'borrowernumber'};
-	my $remote_IP =	$search->{'remote_IP'};
-	my $remote_URL=	$search->{'remote_URL'};
-	my $searchdesc = $search->{'searchdesc'};
-	
-my $sth = $dbh->prepare("INSERT INTO phrase_log(phr_phrase,phr_resultcount,phr_ip,user,actual) VALUES(?,?,?,?,?)");
-	
-
-$sth->execute($searchdesc,$results,$remote_IP,$borrowernumber,$remote_URL);
-$sth->finish;
-
-}
-
-
-=item ItemInfo
-
-  @results = &ItemInfo($env, $biblionumber, $type);
-
-Returns information about books with the given biblionumber.
-
-C<$type> may be either C<intra> or anything else. If it is not set to
-C<intra>, then the search will exclude lost, very overdue, and
-withdrawn items.
-
-C<$env> is ignored.
-
-C<&ItemInfo> returns a list of references-to-hash. Each element
-contains a number of keys. Most of them are table items from the
-C<biblio>, C<biblioitems>, C<items>, and C<itemtypes> tables in the
-Koha database. Other keys include:
-
-=over 4
-
-=item C<$data-E<gt>{branchname}>
-
-The name (not the code) of the branch to which the book belongs.
-
-=item C<$data-E<gt>{datelastseen}>
-
-This is simply C<items.datelastseen>, except that while the date is
-stored in YYYY-MM-DD format in the database, here it is converted to
-DD/MM/YYYY format. A NULL date is returned as C<//>.
-
-=item C<$data-E<gt>{datedue}>
-
-=item C<$data-E<gt>{class}>
-
-This is the concatenation of C<biblioitems.classification>, the book's
-Dewey code, and C<biblioitems.subclass>.
-
-=item C<$data-E<gt>{ocount}>
-
-I think this is the number of copies of the book available.
-
-=item C<$data-E<gt>{order}>
-
-If this is set, it is set to C<One Order>.
-
-=back
-
-=cut
-#'
-sub ItemInfo {
-	my ($dbh,$data) = @_;
-	my $i=0;
-	my @results;
-my ($date_due, $count_reserves);
-		my $datedue = '';
-		my $isth=$dbh->prepare("Select issues.*,borrowers.cardnumber from issues,borrowers where itemnumber = ? and returndate is null and issues.borrowernumber=borrowers.borrowernumber");
-		$isth->execute($data->{'itemnumber'});
-		if (my $idata=$isth->fetchrow_hashref){
-		$data->{borrowernumber} = $idata->{borrowernumber};
-		$data->{cardnumber} = $idata->{cardnumber};
-		$datedue = format_date($idata->{'date_due'});
-		}
-		if ($datedue eq '' || $datedue eq "0000-00-00"){
-		$datedue="";
-			my ($restype,$reserves)=C4::Reserves2::CheckReserves($data->{'itemnumber'});
-			if ($restype) {
-				$count_reserves = $restype;
-			}
-		}
-		$isth->finish;
-	#get branch information.....
-		my $bsth=$dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
-		$bsth->execute($data->{'holdingbranch'});
-		if (my $bdata=$bsth->fetchrow_hashref){
-			$data->{'branchname'} = $bdata->{'branchname'};
-		}
-		
-		$data->{'datelastseen'}=format_date($data->{'datelastseen'});
-		$data->{'datedue'}=$datedue;
-		$data->{'count_reserves'} = $count_reserves;
-	# get notforloan complete status if applicable
-		my ($tagfield,$tagsub)=MARCfind_marc_from_kohafield("notforloan","holdings");
-		my $sthnflstatus = $dbh->prepare("select authorised_value from holdings_subfield_structure where tagfield='$tagfield' and tagsubfield='$tagsub'");
-		$sthnflstatus->execute;
-		my ($authorised_valuecode) = $sthnflstatus->fetchrow;
-		if ($authorised_valuecode) {
-			$sthnflstatus = $dbh->prepare("select lib from authorised_values where category=? and authorised_value=?");
-			$sthnflstatus->execute($authorised_valuecode,$data->{itemnotforloan});
-			my ($lib) = $sthnflstatus->fetchrow;
-			$data->{notforloan} = $lib;
-		}
-
-# my shelf procedures
-		my ($tagfield,$tagsubfield)=MARCfind_marc_from_kohafield("shelf","holdings");
-		
-		my $shelfstatus = $dbh->prepare("select authorised_value from holdings_subfield_structure where tagfield='$tagfield' and tagsubfield='$tagsubfield'");
-$shelfstatus->execute;
-		$authorised_valuecode = $shelfstatus->fetchrow;
-		if ($authorised_valuecode) {
-			$shelfstatus = $dbh->prepare("select lib from authorised_values where category=? and authorised_value=?");
-			$shelfstatus->execute($authorised_valuecode,$data->{shelf});
-			
-			my ($lib) = $shelfstatus->fetchrow;
-			$data->{shelf} = $lib;
-		}
-		
-	
-
-	return($data);
-}
-
-
-
-
-
-=item barcodes
-
-  @barcodes = &barcodes($biblioitemnumber);
-
-Given a biblioitemnumber, looks up the corresponding items.
-
-Returns an array of references-to-hash; the keys are C<barcode> and
-C<itemlost>.
-
-The returned items include very overdue items, but not lost ones.
-
-=cut
-#'
-sub barcodes{
-    #called from request.pl 
-    my ($biblionumber)=@_;
-#warn $biblionumber;
-    my $dbh = C4::Context->dbh;
-	my @kohafields;
-	my @values;
-	my @relations;
-	my $sort;
-	my @and_or;
-	my @fields;
-	push @kohafields, "biblionumber";
-	push @values,$biblionumber;
-	push @relations, " "," \@attr 2=1"; ## selecting wthdrawn less then 1
-	push @and_or, "\@and";
-		$sort="";
-	my ($count, at results)=ZEBRAsearch_kohafields(\@kohafields,\@values,\@relations,$sort,\@and_or,"","");
-push  @fields,"barcode","itemlost","itemnumber","date_due","wthdrawn","notforloan";
-	my ($biblio, at items)=XMLmarc2koha($dbh,$results[0],"holdings", @fields); 
-return(@items);
-}
-
-
-
-
-
-sub getMARCnotes {
-##Requires a MARCXML as $record
-        my ($dbh, $record, $marcflavour) = @_;
-
-	my ($mintag, $maxtag);
-	if (uc($marcflavour) eq uc"MARC21" || uc($marcflavour) eq "USMARC") {
-	        $mintag = "500";
-		$maxtag = "599";
-	} else {           # assume unimarc if not marc21
-		$mintag = "300";
-		$maxtag = "399";
-	}
-	my @marcnotes=();
-	my $marcnote;
-	foreach my $field ($mintag..$maxtag) {
-	my %line;
-	my @values=XML_readline_asarray($record,"","",$field,"");
-	foreach my $value (@values){
-  $marcnote = {MARCNOTE => $value,};
-			push @marcnotes, $marcnote;
-	}
-	}
-
-	my $marcnotesarray=\@marcnotes;
-        return $marcnotesarray;
-	
-}  # end getMARCnotes
-
-
-sub getMARCsubjects {
-
-    my ($dbh, $record, $marcflavour) = @_;
-	my ($mintag, $maxtag);
-	if (uc($marcflavour) eq uc"MARC21" || uc($marcflavour) eq "USMARC") {
-	        $mintag = "600";
-		$maxtag = "699";
-	} else {           # assume unimarc if not marc21
-		$mintag = "600";
-		$maxtag = "619";
-	}
-	my @marcsubjcts;
-	my $subjct = "";
-	my $subfield = "";
-	my $marcsubjct;
-
-	foreach my $field ($mintag..$maxtag) {
-		my @value =XML_readline_asarray($record,"","",$field,"a");
-			foreach my $subject (@value){
-		        $marcsubjct = {MARCSUBJCT => $subject,};
-			push @marcsubjcts, $marcsubjct;
-			}
-		
-	}
-	my $marcsubjctsarray=\@marcsubjcts;
-        return $marcsubjctsarray;
-}  #end getMARCsubjects
-
-
-sub getMARCurls {
-    my ($dbh, $record, $marcflavour) = @_;
-	my ($mintag, $maxtag);
-	if (uc($marcflavour) eq uc"MARC21" || uc($marcflavour) eq "USMARC") {
-	        $mintag = "856";
-		$maxtag = "856";
-	} else {           # assume unimarc if not marc21
-		$mintag = "600";
-		$maxtag = "619";
-	}
-
-	my @marcurls;
-	my $url = "";
-	my $subfil = "";
-	my $marcurl;
-	my $value;
-	foreach my $field ($mintag..$maxtag) {
-		my @value =XML_readline_asarray($record,"","",$field,"u");
-			foreach my $url (@value){
-				if ( $value ne $url) {
-		    	   	 $marcurl = {MARCURL => $url,};
-				push @marcurls, $marcurl;
-				 $value=$url;
-				}
-			}
-	}
-
-
-	my $marcurlsarray=\@marcurls;
-        return $marcurlsarray;
-}  #end getMARCurls
-
-sub getMARCadditional_authors {
-    my ($dbh, $record, $marcflavour) = @_;
-	my ($mintag, $maxtag);
-	if (uc($marcflavour) eq uc"MARC21" || uc($marcflavour) eq "USMARC") {
-	        $mintag = "700";
-		$maxtag = "700";
-	} else {           # assume unimarc if not marc21
-###FIX ME Correct tag to UNIMARC additional authors
-		$mintag = "200";
-		$maxtag = "200";
-	}
-
-	my @marcauthors;
-	
-	my $subfil = "";
-	my $marcauth;
-	my $value;
-	foreach my $field ($mintag..$maxtag) {
-		my @value =XML_readline_asarray($record,"","",$field,"a");
-			foreach my $author (@value){
-				if ( $value ne $author) {
-		    	   	 $marcauth = {MARCAUTHOR => $author,};
-				push @marcauthors, $marcauth;
-				 $value=$author;
-				}
-			}
-	}
-
-
-	my $marcauthsarray=\@marcauthors;
-        return $marcauthsarray;
-}  #end getMARCurls
-
-sub parsefields{
-#pass this a  MARC record and it will parse it for display purposes
-my ($dbh,$intranet, at marcrecords)=@_;
-my @results;
-my @items;
-my $retrieve_from=C4::Context->preference('retrieve_from');
-#Build brancnames hash  for displaying in OPAC - more user friendly
-#find branchname
-#get branch information.....
-my %branches;
-		my $bsth=$dbh->prepare("SELECT branchcode,branchname FROM branches");
-		$bsth->execute();
-		while (my $bdata=$bsth->fetchrow_hashref){
-			$branches{$bdata->{'branchcode'}}= $bdata->{'branchname'};
-		}
-
-#Building shelving hash if library has shelves defined like junior section, non-fiction, audio-visual room etc
-my %shelves;
-#find shelvingname
-my ($tagfield,$tagsubfield)=MARCfind_marc_from_kohafield("shelf","holdings");
-my $shelfstatus = $dbh->prepare("select authorised_value from holdings_subfield_structure where tagfield='$tagfield' and tagsubfield='$tagsubfield'");
-		$shelfstatus->execute;		
-		my ($authorised_valuecode) = $shelfstatus->fetchrow;
-		if ($authorised_valuecode) {
-			$shelfstatus = $dbh->prepare("select lib,authorised_value from authorised_values where category=? ");
-			$shelfstatus->execute($authorised_valuecode);			
-			while (my $lib = $shelfstatus->fetchrow_hashref){
-			$shelves{$lib->{'authorised_value'}} = $lib->{'lib'};
-			}
-		}
-my $even=1;
-### FACETED RESULTS
-    my $facets_counter = ();
-    my $facets_info = ();
-   my @facets_loop; # stores the ref to array of hashes for template
-
-foreach my $xml(@marcrecords){
-
-	if (C4::Context->preference('useFacets')){
-	($facets_counter,$facets_info)=FillFacets($xml,$facets_counter,$facets_info);
-	}
-my @kohafields; ## just name those necessary for the result page
-push @kohafields, "biblionumber","title","author","publishercode","classification","subclass","itemtype","copyrightdate", "holdingbranch","date_due","location","shelf","itemcallnumber","notforloan","itemlost","wthdrawn","totalissue","coverphoto";
-my ($oldbiblio, at itemrecords) = XMLmarc2koha($dbh,$xml,"", at kohafields);
-my $bibliorecord;
-$oldbiblio->{totalissue}=sprintf("%4d",$oldbiblio->{totalissue});
-my %counts;
-
-$counts{'total'}=0;
-my $noitems    = 1;
-my $norequests = 1;
-		##Loop for each item field
-				
-			foreach my $item (@itemrecords) {
- 				$norequests = 0 unless $item->{'itemnotforloan'};
-				$noitems = 0;
-				my $status;
-				#renaming some fields according to templates
-				$item->{'branchname'}=$branches{$item->{'holdingbranch'}};
-				$item->{'shelves'}=$shelves{$item->{'shelf'}};
-				$status="Lost" if ($item->{'itemlost'}>0);
-				$status="Withdrawn" if ($item->{'wthdrawn'}>0);
-				if ($intranet eq "intranet"){ ## we give full itemcallnumber detail in intranet
-				$status="Due:".format_date($item->{'date_due'}) if ($item->{'date_due'} gt "0000-00-00");
- 				$status = $item->{'holdingbranch'}."-".$item->{'shelf'}."[".$item->{'itemcallnumber'}."]" unless defined $status;
- 				}else{
-				$status="On Loan" if ($item->{'date_due'} gt "0000-00-00");
-				  $status = $item->{'branchname'}."[".$item->{'shelves'}."]" unless defined $status;
-				}
-				
-				$counts{$status}++;
-				$counts{'total'}++;
-			}	
-		$oldbiblio->{'noitems'} = $noitems;
-		$oldbiblio->{'norequests'} = $norequests;
-		$oldbiblio->{'even'} = $even;
-		$even= not $even;
-			if ($even){
-			$oldbiblio->{'toggle'}="#ffffcc";
-			} else {
-			$oldbiblio->{'toggle'}="white";
-			} ; ## some forms seems to use toggle
-			
-		$oldbiblio->{'itemcount'} = $counts{'total'};
-		my $totalitemcounts = 0;
-		foreach my $key (keys %counts){
-			if ($key ne 'total'){	
-				$totalitemcounts+= $counts{$key};
-				$oldbiblio->{'locationhash'}->{$key}=$counts{$key};
-				
-			}
-		}
-		my ($locationtext, $locationtextonly, $notavailabletext) = ('','','');
-		foreach (sort keys %{$oldbiblio->{'locationhash'}}) {
-
-			if ($_ eq 'notavailable') {
-				$notavailabletext="Not available";
-				my $c=$oldbiblio->{'locationhash'}->{$_};
-				$oldbiblio->{'not-available-p'}=$c;
-			} else {
-				$locationtext.="$_";
-				my $c=$oldbiblio->{'locationhash'}->{$_};
-				if ($_ eq 'Lost') {
-					$oldbiblio->{'lost-p'} = $c;
-				} elsif ($_ eq 'Withdrawn') {
-					$oldbiblio->{'withdrawn-p'} = $c;
-				} elsif ($_  =~/\^Due:/) {
-
-					$oldbiblio->{'on-loan-p'} = $c;
-				} else {
-					$locationtextonly.= $_;
-					$locationtextonly.= " ($c)<br> " if $totalitemcounts > 1;
-				}
-				if ($totalitemcounts>1) {
-					$locationtext.=" ($c)<br> ";
-				}
-			}
-		}
-		if ($notavailabletext) {
-			$locationtext.= $notavailabletext;
-		} else {
-			$locationtext=~s/, $//;
-		}
-		$oldbiblio->{'location'} = $locationtext;
-		$oldbiblio->{'location-only'} = $locationtextonly;
-		$oldbiblio->{'use-location-flags-p'} = 1;
-	push @results,$oldbiblio;
-   
-}## For each record received
- at facets_loop=BuildFacets($facets_counter,$facets_info,%branches);
-
-	return(@facets_loop, at results);
-}
-
-sub FillFacets{
-my ($facet_record,$facets_counter,$facets_info)=@_;
-  my $facets = C4::Koha::getFacets(); 
-	for (my $k=0; $k<@$facets;$k++) {
-		my $tags=@$facets->[$k]->{tags};
-		my $subfields=@$facets->[$k]->{subfield};
-                        	my @fields;
-                        	      for (my $i=0; $i<@$tags;$i++) {
-			my $type="biblios";
-			$type="holdings" if @$facets->[$k]->{'link_value'} =~/branch/; ## if using other facets from items add them here
-			if ($type eq "holdings"){
-			###Read each item record
-			my $holdings=$facet_record->{holdings}->[0]->{record};
-			       foreach my $holding(@$holdings){
-				 for (my $z=0; $z<@$subfields;$z++) {
-				my $data=XML_readline_onerecord($holding,"","holdings",@$tags[$i],@$subfields[$z]);
-				$facets_counter->{ @$facets->[$k]->{'link_value'} }->{ $data }++ if $data;    
-				}
-			      }
-			}else{
-			       for (my $z=0; $z<@$subfields;$z++) {
-			      my $data=XML_readline($facet_record,"","biblios",@$tags[$i],@$subfields[$z]);
-			       $facets_counter->{ @$facets->[$k]->{'link_value'} }->{ $data }++ if $data;   
-			      }                         	
-                        		}  
-		     }    
-                        	$facets_info->{ @$facets->[$k]->{'link_value'} }->{ 'label_value' } = @$facets->[$k]->{'label_value'};
-                        	$facets_info->{ @$facets->[$k]->{'link_value'} }->{ 'expanded' } = @$facets->[$k]->{'expanded'};
-            	}
-return ($facets_counter,$facets_info);
-}
-
-sub BuildFacets {
-my ($facets_counter, $facets_info,%branches) = @_;
-
-    my @facets_loop; # stores the ref to array of hashes for template
-# BUILD FACETS
-    foreach my $link_value ( sort { $facets_counter->{$b} <=> $facets_counter->{$a} } keys %$facets_counter) {
-        my $expandable;
-        my $number_of_facets;
-        my @this_facets_array;
-        foreach my $one_facet ( sort { $facets_counter->{ $link_value }->{$b} <=> $facets_counter->{ $link_value }->{$a} }  keys %{$facets_counter->{$link_value}} ) {
-            $number_of_facets++;
-            if (($number_of_facets < 11) ||  ($facets_info->{ $link_value }->{ 'expanded'})) {
-
-                # sanitize the link value ), ( will cause errors with CCL
-                my $facet_link_value = $one_facet;
-                $facet_link_value =~ s/(\(|\))/ /g;
-
-                # fix the length that will display in the label
-                my $facet_label_value = $one_facet;
-                $facet_label_value = substr($one_facet,0,20)."..." unless length($facet_label_value)<=20;
-                # well, if it's a branch, label by the name, not the code
-                if ($link_value =~/branch/) {
-                    $facet_label_value = $branches{$one_facet};
-                }
-
-                # but we're down with the whole label being in the link's title
-                my $facet_title_value = $one_facet;
-
-                push @this_facets_array ,
-                ( { facet_count => $facets_counter->{ $link_value }->{ $one_facet },
-                    facet_label_value => $facet_label_value,
-                    facet_title_value => $facet_title_value,
-                    facet_link_value => $facet_link_value,
-                    type_link_value => $link_value,
-                    },
-                );
-             }## if $number_of_facets
-        }##for $one_facet
-        unless ($facets_info->{ $link_value }->{ 'expanded'}) {
-            $expandable=1 if ($number_of_facets > 10);
-        }
-        push @facets_loop,(
-         { type_link_value => $link_value,
-            type_id => $link_value."_id",
-            type_label  => $facets_info->{ $link_value }->{ 'label_value' },
-            facets => \@this_facets_array,
-            expandable => $expandable,
-            expand => $link_value,
-            },
-        );	
-       
- }
-return \@facets_loop;
-}
-
-
-sub getcoverPhoto {
-## return the address of a cover image if defined otherwise the amazon cover images
-	my $record =shift  ;
-
-	my $image=XML_readline_onerecord($record,"coverphoto","biblios");
-	if ($image){
-	return $image;
-	}
-# if there is no image put the amazon cover image adress
-
-my $isbn=XML_readline_onerecord($record,"isbn","biblios");
-return "http://images.amazon.com/images/P/".$isbn.".01.MZZZZZZZ.jpg" if $isbn;	
-}
-
-=item itemcount
-
-  ($count, $lcount, $nacount, $fcount, $scount, $lostcount,
-  $mending, $transit,$ocount) =
-    &itemcount($env, $biblionumber, $type);
-
-Counts the number of items with the given biblionumber, broken down by
-category.
-
-C<$env> is ignored.
-
-If C<$type> is not set to C<intra>, lost, very overdue, and withdrawn
-items will not be counted.
-
-C<&itemcount> returns a nine-element list:
-
-C<$count> is the total number of items with the given biblionumber.
-
-C<$lcount> is the number of items at the Levin branch.
-
-C<$nacount> is the number of items that are neither borrowed, lost,
-nor withdrawn (and are therefore presumably on a shelf somewhere).
-
-C<$fcount> is the number of items at the Foxton branch.
-
-C<$scount> is the number of items at the Shannon branch.
-
-C<$lostcount> is the number of lost and very overdue items.
-
-C<$mending> is the number of items at the Mending branch (being
-mended?).
-
-C<$transit> is the number of items at the Transit branch (in transit
-between branches?).
-
-C<$ocount> is the number of items that haven't arrived yet
-(aqorders.quantity - aqorders.quantityreceived).
-
-=cut
-#'
-
-
-
-sub itemcount {
-  my ($env,$bibnum,$type)=@_;
-  my $dbh = C4::Context->dbh;
-my @kohafield;
-my @value;
-my @relation;
-my @and_or;
-my $sort;
-  my $query="Select * from items where
-  biblionumber=? ";
-push @kohafield,"biblionumber";
-push @value,$bibnum;
- 
-my ($total, at result)=ZEBRAsearch_kohafields(\@kohafield,\@value, \@relation,"", \@and_or, 0);## there is only one record no need for $num or $offset
-my @fields;## extract only the fields required
-push @fields,"itemnumber","itemlost","wthdrawn","holdingbranch","date_due";
-my ($biblio, at items)=XMLmarc2koha ($dbh,$result[0],"holdings",\@fields);
-  my $count=0;
-  my $lcount=0;
-  my $nacount=0;
-  my $fcount=0;
-  my $scount=0;
-  my $lostcount=0;
-  my $mending=0;
-  my $transit=0;
-  my $ocount=0;
- foreach my $data(@items){
-    if ($type ne "intra"){
-  next if ($data->{itemlost} || $data->{wthdrawn});
-    }  ## Probably trying to hide lost item from opac ?
-    $count++;
-   
-## Now it seems we want to find those which are onloan 
-    
-
-    if ( $data->{date_due} gt "0000-00-00"){
-       $nacount++;
-	next;
-    } 
-### The rest of this code is hardcoded for Foxtrot Shanon etc. We urgently need a global understanding of these terms--TG
-      if ($data->{'holdingbranch'} eq 'C' || $data->{'holdingbranch'} eq 'LT'){
-        $lcount++;
-      }
-      if ($data->{'holdingbranch'} eq 'F' || $data->{'holdingbranch'} eq 'FP'){
-        $fcount++;
-      }
-      if ($data->{'holdingbranch'} eq 'S' || $data->{'holdingbranch'} eq 'SP'){
-        $scount++;
-      }
-      if ($data->{'itemlost'} eq '1'){
-        $lostcount++;
-      }
-      if ($data->{'itemlost'} eq '2'){
-        $lostcount++;
-      }
-      if ($data->{'holdingbranch'} eq 'FM'){
-        $mending++;
-      }
-      if ($data->{'holdingbranch'} eq 'TR'){
-        $transit++;
-      }
-  
-  }
-#  if ($count == 0){
-    my $sth2=$dbh->prepare("Select * from aqorders where biblionumber=?");
-    $sth2->execute($bibnum);
-    if (my $data=$sth2->fetchrow_hashref){
-      $ocount=$data->{'quantity'} - $data->{'quantityreceived'};
-    }
-#    $count+=$ocount;
-
-  return ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit,$ocount);
-}
-
-sub spellSuggest {
-my ($kohafield,$value)=@_;
- if (@$kohafield[0] eq "title" || @$kohafield[0] eq "author" || @$kohafield eq  "subject"){
-## pass them through
-}else{
-  @$kohafield[0]="any";
-}
-my $kohaattr=MARCfind_attr_from_kohafield(@$kohafield[0]);
-@$value[0]=~ s/(\.|\?|\;|\=|\/|\\|\||\:|\*|\!|\,|\(|\)|\[|\]|\{|\}|\/)/ /g;
-my $query= $kohaattr." \@attr 6=3 \"".@$value[0]."\"";
-my @zconn;
- $zconn[0]=C4::Context->Zconn("biblioserver");
-$zconn[0]->option(number=>5);
-my $result=$zconn[0]->scan_pqf($query);
-my $i;
-my $event;
-   while (($i = ZOOM::event(\@zconn)) != 0) {
-	$event = $zconn[$i-1]->last_event();
-	last if $event == ZOOM::Event::ZEND;
-   }# whilemy $i;
-
-my $n=$result->size();
-
-my @suggestion;
-for (my $i=0; $i<$n; $i++){
-my ($term,$occ)=$result->term($i);
-push @suggestion, {kohafield=>@$kohafield[0], value=>$term,occ=>$occ} unless $term=~/\@/;
-}
-$zconn[0]->destroy();
-return @suggestion;
-}
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-# New functions to comply with ZEBRA search and new KOHA 3 XML API added 2006 Tumer Garip tgarip at neu.edu.tr
-
-=cut

Index: modules/C4/Serials-new.pm
===================================================================
RCS file: modules/C4/Serials-new.pm
diff -N modules/C4/Serials-new.pm
--- modules/C4/Serials-new.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,1792 +0,0 @@
-package C4::Serials; #assumes C4/Serials.pm
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Serials-new.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-use strict;
-use C4::Date;
-use Date::Calc qw(:all);
-use C4::Suggestions;
-use C4::Biblio;
-use C4::Search;
-use C4::Letters;
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g;
-        shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
-
-
-=head1 NAME
-
-C4::Serials - Give functions for serializing.
-
-=head1 SYNOPSIS
-
-  use C4::Serials;
-
-=head1 DESCRIPTION
-
-Give all XYZ functions
-
-=head1 FUNCTIONS
-
-=cut
- at ISA = qw(Exporter);
- at EXPORT = qw(
-    &NewSubscription &ModSubscription &DelSubscription &GetSubscriptions &GetSubscription
-    &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber 
-    &GetFullSubscriptionsFromBiblionumber &GetNextSeq
-    &ModSubscriptionHistory &NewIssue 
-    &GetSerials &GetLatestSerials &ModSerialStatus
-    &HasSubscriptionExpired &GetSubscriptionExpirationDate &ReNewSubscription
-    &GetSuppliersWithLateIssues &GetLateIssues &GetMissingIssues
-    &GetDistributedTo &SetDistributedto 
-    &getroutinglist &delroutingmember &addroutingmember &reorder_members
-    &check_routing &getsupplierbyserialid &updateClaim &removeMissingIssue &abouttoexpire
-    &Get_Next_Date
-);
-
-=head2 GetSuppliersWithLateIssues
-
-=over 4
-
-%supplierlist = &GetSuppliersWithLateIssues
-
-this function get all suppliers with late issues.
-
-return :
-the supplierlist into a hash. this hash containts id & name of the supplier
-
-=back
-
-=cut
-sub GetSuppliersWithLateIssues {
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT DISTINCT id, name
-        FROM            subscription, serial
-        LEFT JOIN       aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-        WHERE           subscription.subscriptionid = serial.subscriptionid
-        AND             (planneddate < now() OR serial.STATUS = 3 OR serial.STATUS = 4)
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute;
-    my %supplierlist;
-    while (my ($id,$name) = $sth->fetchrow) {
-        $supplierlist{$id} = $name;
-    }
-    if(C4::Context->preference("RoutingSerials")){
-	$supplierlist{''} = "All Suppliers";
-    }
-    return %supplierlist;
-}
-
-=head2 GetLateIssues
-
-=over 4
-
- at issuelist = &GetLateIssues($supplierid)
-
-this function select late issues on database
-
-return :
-the issuelist into an table. Each line of this table containts a ref to a hash which it containts
-name,title,planneddate,serialseq,serial.subscriptionid from tables : subscription, serial & biblio
-
-=back
-
-=cut
-sub GetLateIssues {
-    my ($supplierid) = shift;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if ($supplierid) {
-        my $query = qq |
-            SELECT     name,title,planneddate,serialseq,serial.subscriptionid
-            FROM       subscription, serial, biblio
-            LEFT JOIN  aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-            WHERE      subscription.subscriptionid = serial.subscriptionid
-            AND        ((planneddate < now() AND serial.STATUS =1) OR serial.STATUS = 3)
-            AND        subscription.aqbooksellerid=$supplierid
-            AND        biblio.biblionumber = subscription.biblionumber
-            ORDER BY   title
-        |;
-        $sth = $dbh->prepare($query);
-    } else {
-        my $query = qq|
-            SELECT     name,title,planneddate,serialseq,serial.subscriptionid
-            FROM       subscription, serial, biblio
-            LEFT JOIN  aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-            WHERE      subscription.subscriptionid = serial.subscriptionid
-            AND        ((planneddate < now() AND serial.STATUS =1) OR serial.STATUS = 3)
-            AND        biblio.biblionumber = subscription.biblionumber
-            ORDER BY   title
-        |;
-        $sth = $dbh->prepare($query);
-    }
-    $sth->execute;
-    my @issuelist;
-    my $last_title;
-    my $odd=0;
-    my $count=0;
-    while (my $line = $sth->fetchrow_hashref) {
-        $odd++ unless $line->{title} eq $last_title;
-        $line->{title} = "" if $line->{title} eq $last_title;
-        $last_title = $line->{title} if ($line->{title});
-        $line->{planneddate} = format_date($line->{planneddate});
-        $line->{'odd'} = 1 if $odd %2 ;
-	$count++;
-        push @issuelist,$line;
-    }
-    return $count, at issuelist;
-}
-
-=head2 GetSubscriptionHistoryFromSubscriptionId
-
-=over 4
-
-$sth = GetSubscriptionHistoryFromSubscriptionId()
-this function just prepare the SQL request.
-After this function, don't forget to execute it by using $sth->execute($subscriptionid)
-return :
-$sth = $dbh->prepare($query).
-
-=back
-
-=cut
-sub GetSubscriptionHistoryFromSubscriptionId() {
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT *
-        FROM   subscriptionhistory
-        WHERE  subscriptionid = ?
-    |;
-    return $dbh->prepare($query);
-}
-
-=head2 GetSerialStatusFromSerialId
-
-=over 4
-
-$sth = GetSerialStatusFromSerialId();
-this function just prepare the SQL request.
-After this function, don't forget to execute it by using $sth->execute($serialid)
-return :
-$sth = $dbh->prepare($query).
-
-=back
-
-=cut
-sub GetSerialStatusFromSerialId(){
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT status
-        FROM   serial
-        WHERE  serialid = ?
-    |;
-    return $dbh->prepare($query);
-}
-
-
-=head2 GetSubscription
-
-=over 4
-
-$subs = GetSubscription($subscriptionid)
-this function get the subscription which has $subscriptionid as id.
-return :
-a hashref. This hash containts
-subscription, subscriptionhistory, aqbudget.bookfundid, biblio.title
-
-=back
-
-=cut
-sub GetSubscription {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query =qq(
-        SELECT  subscription.*,
-                subscriptionhistory.*,
-                aqbudget.bookfundid,
-                aqbooksellers.name AS aqbooksellername,
-                biblio.title AS bibliotitle
-       FROM subscription
-       LEFT JOIN subscriptionhistory ON subscription.subscriptionid=subscriptionhistory.subscriptionid
-       LEFT JOIN aqbudget ON subscription.aqbudgetid=aqbudget.aqbudgetid
-       LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
-       LEFT JOIN biblio ON biblio.biblionumber=subscription.biblionumber
-       WHERE subscription.subscriptionid = ?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my $subs = $sth->fetchrow_hashref;
-    return $subs;
-}
-
-=head2 GetSubscriptionsFromBiblionumber
-
-=over 4
-
-\@res = GetSubscriptionsFromBiblionumber($biblionumber)
-this function get the subscription list. it reads on subscription table.
-return :
-table of subscription which has the biblionumber given on input arg.
-each line of this table is a hashref. All hashes containt
-planned, histstartdate,opacnote,missinglist,receivedlist,periodicity,status & enddate
-
-=back
-
-=cut
-sub GetSubscriptionsFromBiblionumber {
-    my ($biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq(
-        SELECT subscription.*,
-               subscriptionhistory.*,
-               aqbudget.bookfundid,
-               aqbooksellers.name AS aqbooksellername,
-               biblio.title AS bibliotitle
-       FROM subscription
-       LEFT JOIN subscriptionhistory ON subscription.subscriptionid=subscriptionhistory.subscriptionid
-       LEFT JOIN aqbudget ON subscription.aqbudgetid=aqbudget.aqbudgetid
-       LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
-       LEFT JOIN biblio ON biblio.biblionumber=subscription.biblionumber
-       WHERE subscription.biblionumber = ?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    my @res;
-    while (my $subs = $sth->fetchrow_hashref) {
-        $subs->{planneddate} = format_date($subs->{planneddate});
-          $subs->{publisheddate} = format_date($subs->{publisheddate});
-        $subs->{histstartdate} = format_date($subs->{histstartdate});
-        $subs->{opacnote} =~ s/\n/\<br\/\>/g;
-        $subs->{missinglist} =~ s/\n/\<br\/\>/g;
-        $subs->{receivedlist} =~ s/\n/\<br\/\>/g;
-        $subs->{"periodicity".$subs->{periodicity}} = 1;
-        $subs->{"status".$subs->{'status'}} = 1;
-        if ($subs->{enddate} eq '0000-00-00') {
-            $subs->{enddate}='';
-        } else {
-            $subs->{enddate} = format_date($subs->{enddate});
-        }
-        push @res,$subs;
-    }
-    return \@res;
-}
-=head2 GetFullSubscriptionsFromBiblionumber
-
-=over 4
-
-   \@res = GetFullSubscriptionsFromBiblionumber($biblionumber)
-   this function read on serial table.
-
-=back
-
-=cut
-sub GetFullSubscriptionsFromBiblionumber {
-    my ($biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query=qq|
-                SELECT  serial.serialseq,
-                        serial.planneddate,
-                        serial.publisheddate,
-                        serial.status,
-                        serial.notes,
-                        year(serial.publisheddate) AS year,
-                        aqbudget.bookfundid,aqbooksellers.name AS aqbooksellername,
-                        biblio.title AS bibliotitle
-                FROM serial
-                LEFT JOIN subscription ON
-                    (serial.subscriptionid=subscription.subscriptionid AND subscription.biblionumber=serial.biblionumber)
-                LEFT JOIN aqbudget ON subscription.aqbudgetid=aqbudget.aqbudgetid 
-                LEFT JOIN aqbooksellers on subscription.aqbooksellerid=aqbooksellers.id
-                LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber
-                WHERE subscription.biblionumber = ?
-                ORDER BY year,serial.publisheddate,serial.subscriptionid,serial.planneddate
-    |;
-
-    my $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    my @res;
-    my $year;
-    my $startdate;
-    my $aqbooksellername;
-    my $bibliotitle;
-    my @loopissues;
-    my $first;
-    my $previousnote="";
-    while (my $subs = $sth->fetchrow_hashref) {
-        ### BUG To FIX: When there is no published date, will create many null ids!!!
-
-        if ($year and ($year==$subs->{year})){
-            if ($first eq 1){$first=0;}
-            my $temp=$res[scalar(@res)-1]->{'serials'};
-            push @$temp,
-                {'publisheddate' =>format_date($subs->{'publisheddate'}),
-                'planneddate' => format_date($subs->{'planneddate'}), 
-                'serialseq' => $subs->{'serialseq'},
-                "status".$subs->{'status'} => 1,
-                'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes},
-                };
-        } else {
-            $first=1 if (not $year);
-            $year= $subs->{'year'};
-            $startdate= format_date($subs->{'startdate'});
-            $aqbooksellername= $subs->{'aqbooksellername'};
-            $bibliotitle= $subs->{'bibliotitle'};
-            my @temp;
-            push @temp,
-                {'publisheddate' =>format_date($subs->{'publisheddate'}),
-                            'planneddate' => format_date($subs->{'planneddate'}), 
-                'serialseq' => $subs->{'serialseq'},
-                "status".$subs->{'status'} => 1,
-                'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes},
-                };
-
-            push @res,{
-                'year'=>$year,
-                'startdate'=>$startdate,
-                'aqbooksellername'=>$aqbooksellername,
-                'bibliotitle'=>$bibliotitle,
-                'serials'=>\@temp,
-                'first'=>$first 
-            };
-        }
-        $previousnote=$subs->{notes};
-    }
-    return \@res;
-}
-
-
-=head2 GetSubscriptions
-
-=over 4
-
- at results = GetSubscriptions($title,$ISSN,$biblionumber);
-this function get all subscriptions which has title like $title,ISSN like $ISSN and biblionumber like $biblionumber.
-return:
-a table of hashref. Each hash containt the subscription.
-
-=back
-
-=cut
-sub GetSubscriptions {
-    my ($title,$ISSN,$biblionumber,$supplierid) = @_;
-    return unless $title or $ISSN or $biblionumber or $supplierid;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if ($biblionumber) {
-        my $query = qq(
-            SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber
-            FROM   subscription,biblio
-            WHERE  biblio.biblionumber = subscription.biblionumber
-                AND biblio.biblionumber=?
-            ORDER BY title
-        );
-    $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    } elsif ($ISSN and $title){
-            my $query = qq|
-                SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber,aqbooksellerid
-                FROM   subscription,biblio
-                WHERE biblio.biblionumber= subscription.biblionumber
-                    AND (biblio.title LIKE ? or biblio.issn = ?)
-                ORDER BY title
-            |;
-            $sth = $dbh->prepare($query);
-            $sth->execute("%$title%",$ISSN);
-        } elsif ($ISSN){
-                my $query = qq(
-                    SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber,aqbooksellerid
-                    FROM   subscription,biblio
-                       WHERE biblio.biblionumber=subscription.biblionumber
-                        AND biblio.issn = ?
-                    ORDER BY title
-                );
-                $sth = $dbh->prepare($query);
-                $sth->execute($ISSN);
-       }elsif ($supplierid){
-                my $query = qq(
-                    SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber,aqbooksellerid
-                    FROM   subscription,biblio
-                   WHERE biblio.biblionumber=subscription.biblionumber
-                        AND subscription.aqbooksellerid = ?
-                    ORDER BY title
-                );
-                $sth = $dbh->prepare($query);
-                $sth->execute($supplierid);
-            } else {
-                my $query = qq(
-                    SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber,aqbooksellerid
-                    FROM   subscription,biblio
-                    WHERE biblio.biblionumber=subscription.biblionumber
-                        AND biblio.title LIKE ?
-                    ORDER BY title
-                );
-                $sth = $dbh->prepare($query);
-                $sth->execute("%$title%");
-        }
-        
-   
-    my @results;
-    my $previoustitle="";
-    my $odd=1;
-    while (my $line = $sth->fetchrow_hashref) {
-        if ($previoustitle eq $line->{title}) {
-            $line->{title}="";
-            $line->{issn}="";
-            $line->{toggle} = 1 if $odd==1;
-        } else {
-            $previoustitle=$line->{title};
-            $odd=-$odd;
-            $line->{toggle} = 1 if $odd==1;
-        }
-        push @results, $line;
-    }
-    return @results;
-}
-
-=head2 GetSerials
-
-=over 4
-
-($totalissues, at serials) = GetSerials($subscriptionid);
-this function get every serial not arrived for a given subscription
-as well as the number of issues registered in the database (all types)
-this number is used to see if a subscription can be deleted (=it must have only 1 issue)
-
-=back
-
-=cut
-sub GetSerials {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-   
-    my $counter=0;
-    my @serials;
-   
-    # status = 2 is "arrived"
-    my $query = qq|
-        SELECT *
-        FROM   serial
-        WHERE  subscriptionid = ? AND status NOT IN (2,4,5)
-    |;
-    my $sth=$dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    while(my $line = $sth->fetchrow_hashref) {
-        $line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list
-        $line->{"publisheddate"} = format_date($line->{"publisheddate"});
-        $line->{"planneddate"} = format_date($line->{"planneddate"});
-        push @serials,$line;
-    }
- # OK, now add the last 5 issues arrived/missing
-    my $query = qq|
-        SELECT   *
-        FROM     serial
-        WHERE    subscriptionid = ?
-        AND      (status in (2,4,5))
-        ORDER BY serialid DESC
-    |;
-    my $sth=$dbh->prepare($query);
-    $sth->execute($subscriptionid);
- while((my $line = $sth->fetchrow_hashref) && $counter <5) {
-        $counter++;
-        $line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list
-        $line->{"planneddate"} = format_date($line->{"planneddate"});
-        $line->{"publisheddate"} = format_date($line->{"publisheddate"});
-        push @serials,$line;
-    }
-    my $query = qq|
-        SELECT count(*)
-        FROM   serial
-        WHERE  subscriptionid=?
-    |;
-    $sth=$dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my ($totalissues) = $sth->fetchrow;
-    return ($totalissues, at serials);
-}
-
-=head2 GetLatestSerials
-
-=over 4
-
-\@serials = GetLatestSerials($subscriptionid,$limit)
-get the $limit's latest serials arrived or missing for a given subscription
-return :
-a ref to a table which it containts all of the latest serials stored into a hash.
-
-=back
-
-=cut
-sub GetLatestSerials {
-    my ($subscriptionid,$limit) = @_;
-    my $dbh = C4::Context->dbh;
-    # status = 2 is "arrived"
-    my $strsth=qq(
-        SELECT   serialid,serialseq, status, planneddate
-        FROM     serial
-        WHERE    subscriptionid = ?
-        AND      (status =2 or status=4)
-        ORDER BY planneddate DESC LIMIT 0,$limit
-    );
-    my $sth=$dbh->prepare($strsth);
-    $sth->execute($subscriptionid);
-    my @serials;
-    while(my $line = $sth->fetchrow_hashref) {
-        $line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list
-        $line->{"planneddate"} = format_date($line->{"planneddate"});
-        push @serials,$line;
-    }
-#     my $query = qq|
-#         SELECT count(*)
-#         FROM   serial
-#         WHERE  subscriptionid=?
-#     |;
-#     $sth=$dbh->prepare($query);
-#     $sth->execute($subscriptionid);
-#     my ($totalissues) = $sth->fetchrow;
-    return \@serials;
-}
-
-=head2 GetDistributedTo
-
-=over 4
-
-$distributedto=GetDistributedTo($subscriptionid)
-This function select the old previous value of distributedto in the database.
-
-=back
-
-=cut
-sub GetDistributedTo {
-    my $dbh = C4::Context->dbh;
-    my $distributedto;
-    my $subscriptionid = @_;
-    my $query = qq|
-        SELECT distributedto
-        FROM   subscription
-        WHERE  subscriptionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    return ($distributedto) = $sth->fetchrow;
-}
-
-=head2 GetNextSeq
-
-=over 4
-
-GetNextSeq($val)
-$val is a hashref containing all the attributes of the table 'subscription'
-This function get the next issue for the subscription given on input arg
-return:
-all the input params updated.
-
-=back
-
-=cut
-sub Get_Next_Seq {
-    my ($val) =@_;
-    my ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
-    $calculated = $val->{numberingmethod};
-# calculate the (expected) value of the next issue received.
-    $newlastvalue1 = $val->{lastvalue1};
-# check if we have to increase the new value.
-    $newinnerloop1 = $val->{innerloop1}+1;
-    $newinnerloop1=0 if ($newinnerloop1 >= $val->{every1});
-    $newlastvalue1 += $val->{add1} if ($newinnerloop1<1); # <1 to be true when 0 or empty.
-    $newlastvalue1=$val->{setto1} if ($newlastvalue1>$val->{whenmorethan1}); # reset counter if needed.
-    $calculated =~ s/\{X\}/$newlastvalue1/g;
-
-    $newlastvalue2 = $val->{lastvalue2};
-# check if we have to increase the new value.
-    $newinnerloop2 = $val->{innerloop2}+1;
-    $newinnerloop2=0 if ($newinnerloop2 >= $val->{every2});
-    $newlastvalue2 += $val->{add2} if ($newinnerloop2<1); # <1 to be true when 0 or empty.
-    $newlastvalue2=$val->{setto2} if ($newlastvalue2>$val->{whenmorethan2}); # reset counter if needed.
-    $calculated =~ s/\{Y\}/$newlastvalue2/g;
-
-    $newlastvalue3 = $val->{lastvalue3};
-# check if we have to increase the new value.
-    $newinnerloop3 = $val->{innerloop3}+1;
-    $newinnerloop3=0 if ($newinnerloop3 >= $val->{every3});
-    $newlastvalue3 += $val->{add3} if ($newinnerloop3<1); # <1 to be true when 0 or empty.
-    $newlastvalue3=$val->{setto3} if ($newlastvalue3>$val->{whenmorethan3}); # reset counter if needed.
-    $calculated =~ s/\{Z\}/$newlastvalue3/g;
-    return ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
-}
-
-
-sub GetNextSeq {
-    my ($val) =@_;
-    my ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
-    my $pattern = $val->{numberpattern};
-    my @seasons = ('nothing','Winter','Spring','Summer','Autumn');
-    my @southern_seasons = ('','Summer','Autumn','Winter','Spring');
-    $calculated = $val->{numberingmethod};
-    $newlastvalue1 = $val->{lastvalue1};
-    $newlastvalue2 = $val->{lastvalue2};
-    $newlastvalue3 = $val->{lastvalue3};
-    if($newlastvalue3 > 0){ # if x y and z columns are used
-	$newlastvalue3 = $newlastvalue3+1;
-	if($newlastvalue3 > $val->{whenmorethan3}){
-	    $newlastvalue3 = $val->{setto3};
-	    $newlastvalue2++;
-	    if($newlastvalue2 > $val->{whenmorethan2}){
-		$newlastvalue1++;
-		$newlastvalue2 = $val->{setto2};
-	    }
-	}
-	$calculated =~ s/\{X\}/$newlastvalue1/g;
-	if($pattern == 6){
-	    if($val->{hemisphere} == 2){
-		my $newlastvalue2seq = $southern_seasons[$newlastvalue2];
-		$calculated =~ s/\{Y\}/$newlastvalue2seq/g;
-	    } else {
-		my $newlastvalue2seq = $seasons[$newlastvalue2];
-		$calculated =~ s/\{Y\}/$newlastvalue2seq/g;
-	    }
-	} else {
-	    $calculated =~ s/\{Y\}/$newlastvalue2/g;
-	}
-	$calculated =~ s/\{Z\}/$newlastvalue3/g;
-    }
-    if($newlastvalue2 > 0 && $newlastvalue3 < 1){ # if x and y columns are used
-	$newlastvalue2 = $newlastvalue2+1;
-	if($newlastvalue2 > $val->{whenmorethan2}){
-	    $newlastvalue2 = $val->{setto2};
-	    $newlastvalue1++;
-	}
-	$calculated =~ s/\{X\}/$newlastvalue1/g;
-	if($pattern == 6){
-	    if($val->{hemisphere} == 2){
-		my $newlastvalue2seq = $southern_seasons[$newlastvalue2];
-		$calculated =~ s/\{Y\}/$newlastvalue2seq/g;
-	    } else {
-		my $newlastvalue2seq = $seasons[$newlastvalue2];
-		$calculated =~ s/\{Y\}/$newlastvalue2seq/g;
-	    }
-	} else {
-	    $calculated =~ s/\{Y\}/$newlastvalue2/g;
-	}
-    }
-    if($newlastvalue1 > 0 && $newlastvalue2 < 1 && $newlastvalue3 < 1){ # if column x only
-	$newlastvalue1 = $newlastvalue1+1;
-	if($newlastvalue1 > $val->{whenmorethan1}){
-	    $newlastvalue1 = $val->{setto2};
-	}
-	$calculated =~ s/\{X\}/$newlastvalue1/g;
-    }
-    return ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3);
-}
-
-
-=head2 GetNextDate
-
-=over 4
-
-$resultdate = GetNextDate($planneddate,$subscription)
-
-this function get the date after $planneddate.
-return:
-the date on ISO format.
-
-=back
-
-=cut
-
-=head2 GetSeq
-
-=over 4
-
-$calculated = GetSeq($val)
-$val is a hashref containing all the attributes of the table 'subscription'
-this function transforms {X},{Y},{Z} to 150,0,0 for example.
-return:
-the sequence in integer format
-
-=back
-
-=cut
-sub GetSeq {
-    my ($val) =@_;
-    my $calculated = $val->{numberingmethod};
-    my $x=$val->{'lastvalue1'};
-    $calculated =~ s/\{X\}/$x/g;
-    my $y=$val->{'lastvalue2'};
-    $calculated =~ s/\{Y\}/$y/g;
-    my $z=$val->{'lastvalue3'};
-    $calculated =~ s/\{Z\}/$z/g;
-    return $calculated;
-}
-
-=head2 GetSubscriptionExpirationDate
-
-=over 4
-
-$sensddate = GetSubscriptionExpirationDate($subscriptionid)
-
-this function return the expiration date for a subscription given on input args.
-
-return
-the enddate
-
-=back
-
-=cut
-sub GetSubscriptionExpirationDate {
-    my ($subscriptionid) = @_;
-    my $dbh              = C4::Context->dbh;
-    my $subscription     = GetSubscription($subscriptionid);
-    my $enddate          = $subscription->{startdate};
-
-# we don't do the same test if the subscription is based on X numbers or on X weeks/months
-#     warn "SUBSCRIPTIONID :$subscriptionid";
-#     use Data::Dumper; warn Dumper($subscription);
-
-    if ( $subscription->{numberlength} ) {
-        #calculate the date of the last issue.
-        my $length = $subscription->{numberlength};
-#         warn "ENDDATE ".$enddate;
-        for ( my $i = 1 ; $i <= $length ; $i++ ) {
-            $enddate = GetNextDate( $enddate, $subscription );
-#             warn "AFTER ENDDATE ".$enddate;
-        }
-    }
-    elsif ( $subscription->{monthlength} ){
-#         warn "dateCHECKRESERV :".$subscription->{startdate};
-        my @date=split (/-/,$subscription->{startdate});
-        my @enddate = Add_Delta_YM($date[0],$date[1],$date[2],0,$subscription->{monthlength});
-        $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]);
-    } elsif ( $subscription->{weeklength} ){
-        my @date=split (/-/,$subscription->{startdate});
-
-        my @enddate = Add_Delta_Days($date[0],$date[1],$date[2],$subscription->{weeklength}*7);
-        $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]);
-    }
-#     warn "date de fin :$enddate";
-    return $enddate;
-}
-
-=head2 CountSubscriptionFromBiblionumber
-
-=over 4
-
-$subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber)
-this count the number of subscription for a biblionumber given.
-return :
-the number of subscriptions with biblionumber given on input arg.
-
-=back
-
-=cut
-sub CountSubscriptionFromBiblionumber {
-    my ($biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT count(*)
-        FROM   subscription
-        WHERE  biblionumber=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    my $subscriptionsnumber = $sth->fetchrow;
-    return $subscriptionsnumber;
-}
-
-
-=head2 ModSubscriptionHistory
-
-=over 4
-
-ModSubscriptionHistory($subscriptionid,$histstartdate,$enddate,$receivedlist,$missinglist,$opacnote,$librariannote);
-
-this function modify the history of a subscription. Put your new values on input arg.
-
-=back
-
-=cut
-sub ModSubscriptionHistory {
-    my ($subscriptionid,$histstartdate,$enddate,$receivedlist,$missinglist,$opacnote,$librariannote)=@_;
-    my $dbh=C4::Context->dbh;
-    my $query = qq(
-        UPDATE subscriptionhistory 
-        SET histstartdate=?,enddate=?,receivedlist=?,missinglist=?,opacnote=?,librariannote=?
-        WHERE subscriptionid=?
-    );
-    my $sth = $dbh->prepare($query);
-    $receivedlist =~ s/^,//g;
-    $missinglist =~ s/^,//g;
-    $opacnote =~ s/^,//g;
-    $sth->execute($histstartdate,$enddate,$receivedlist,$missinglist,$opacnote,$librariannote,$subscriptionid);
-}
-
-=head2 ModSerialStatus
-
-=over 4
-
-ModSerialStatus($serialid,$serialseq, $publisheddate,$planneddate,$status,$notes)
-
-This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
-Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
-
-=back
-
-=cut
-sub ModSerialStatus {
-    my ($serialid,$serialseq, $publisheddate,$planneddate,$status,$notes,$itemnumber)=@_;
-
-    # 1st, get previous status :
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT subscriptionid,status
-        FROM   serial
-        WHERE  serialid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($serialid);
-    my ($subscriptionid,$oldstatus) = $sth->fetchrow;
-    # change status & update subscriptionhistory
-    if ($status eq 6){
-        DelIssue($serialseq, $subscriptionid)
-    } else {
-        my $query = qq(
-            UPDATE serial
-            SET    serialseq=?,publisheddate=?,planneddate=?,status=?,notes=?,itemnumber=?
-            WHERE  serialid = ?
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute($serialseq,format_date_in_iso($publisheddate),format_date_in_iso($planneddate),$status,$notes,$itemnumber,$serialid);
-        my $query = qq(
-            SELECT missinglist,receivedlist
-            FROM   subscriptionhistory
-            WHERE  subscriptionid=?
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute($subscriptionid);
-        my ($missinglist,$receivedlist) = $sth->fetchrow;
-        if ($status == 2 && $oldstatus != 2) {
-            $receivedlist .= ",$serialseq";
-        }
-        $missinglist .= ",$serialseq" if ($status eq 4) ;
-        $missinglist .= ",not issued $serialseq" if ($status eq 5);
-        my $query = qq(
-            UPDATE subscriptionhistory
-            SET    receivedlist=?, missinglist=?
-            WHERE  subscriptionid=?
-        );
-        $sth=$dbh->prepare($query);
-        $sth->execute($receivedlist,$missinglist,$subscriptionid);
-    }
-    # create new waited entry if needed (ie : was a "waited" and has changed)
-    if ($oldstatus eq 1 && $status ne 1) {
-        my $query = qq(
-            SELECT *
-            FROM   subscription
-            WHERE  subscriptionid = ?
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute($subscriptionid);
-        my $val = $sth->fetchrow_hashref;
-        # next issue number
-        my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = GetNextSeq($val);
-        # next date (calculated from actual date & frequency parameters)
-          my $nextplanneddate = GetNextDate($planneddate,$val);
-          my $nextpublisheddate = GetNextDate($publisheddate,$val);
-        NewIssue($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextpublisheddate,$nextplanneddate,0);
-        my $query = qq|
-            UPDATE subscription
-            SET    lastvalue1=?, lastvalue2=?, lastvalue3=?,
-                   innerloop1=?, innerloop2=?, innerloop3=?
-            WHERE  subscriptionid = ?
-        |;
-        $sth = $dbh->prepare($query);
-        $sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3,$subscriptionid);
-    }
-}
-
-=head2 ModSubscription
-
-=over 4
-
-this function modify a subscription. Put all new values on input args.
-
-=back
-
-=cut
-sub ModSubscription {
-    my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
-        $periodicity,$dow,$numberlength,$weeklength,$monthlength,
-        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-        $numberingmethod, $status, $biblionumber, $notes, $letter, $subscriptionid,$irregularity,$hemisphere,$callnumber,$numberpattern,$publisheddate)= @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        UPDATE subscription
-        SET     librarian=?, aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?,
-                periodicity=?,dow=?,numberlength=?,weeklength=?,monthlength=?,
-                add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,innerloop1=?,
-                add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,innerloop2=?,
-                add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
-                numberingmethod=?, status=?, biblionumber=?, notes=?, letter=?,irregularity=?,hemisphere=?,callnumber=?,numberpattern=? ,publisheddate=?
-        WHERE subscriptionid = ?
-    |;
-    my $sth=$dbh->prepare($query);
-    $sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
-        $periodicity,$dow,$numberlength,$weeklength,$monthlength,
-        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-        $numberingmethod, $status, $biblionumber, $notes, $letter, $irregularity,$hemisphere,$callnumber,$numberpattern,$publisheddate,$subscriptionid);
-    $sth->finish;
-}
-
-
-=head2 NewSubscription
-
-=over 4
-
-$subscriptionid = &NewSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-    $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
-    $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-    $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-    $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-    $numberingmethod, $status, $notes)
-
-Create a new subscription with value given on input args.
-
-return :
-the id of this new subscription
-
-=back
-
-=cut
-sub NewSubscription {
-    my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-        $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
-        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
-        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
-        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
-        $numberingmethod, $status, $notes, $letter,$irregularity,$hemisphere,$callnumber,$numberpattern,$publisheddate) = @_;
-
-    my $dbh = C4::Context->dbh;
-#save subscription (insert into database)
-    my $query = qq|
-        INSERT INTO subscription
-            (librarian,aqbooksellerid,cost,aqbudgetid,biblionumber,
-            startdate,periodicity,dow,numberlength,weeklength,monthlength,
-            add1,every1,whenmorethan1,setto1,lastvalue1,
-            add2,every2,whenmorethan2,setto2,lastvalue2,
-            add3,every3,whenmorethan3,setto3,lastvalue3,
-            numberingmethod, status, notes, letter,irregularity,hemisphere,callnumber,numberpattern,publisheddate)
-        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
-	|;
-    my $sth=$dbh->prepare($query);
-    $sth->execute(
-        $auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-        format_date_in_iso($startdate),$periodicity,$dow,$numberlength,$weeklength,$monthlength,
-        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
-        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
-        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
-        $numberingmethod, $status, $notes, $letter,$irregularity,$hemisphere,$callnumber,$numberpattern,format_date_in_iso($publisheddate));
-
-
-#then create the 1st waited number
-    my $subscriptionid = $dbh->{'mysql_insertid'};
-        my $enddate = GetSubscriptionExpirationDate($subscriptionid);
-    my $query = qq(
-        INSERT INTO subscriptionhistory
-            (biblionumber, subscriptionid, histstartdate, enddate, missinglist, receivedlist, opacnote, librariannote)
-        VALUES (?,?,?,?,?,?,?,?)
-        );
-    $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber, $subscriptionid, format_date_in_iso($startdate), format_date_in_iso($enddate), "", "", "", $notes);
-## User may have subscriptionid stored in MARC so check and fill it
-my $record=XMLgetbiblio($dbh,$biblionumber);
-$record=XML_xml2hash_onerecord($record);
-XML_writeline( $record, "subscriptionid", $subscriptionid,"biblios" );
-my $frameworkcode=MARCfind_frameworkcode($dbh,$biblionumber);
-NEWmodbiblio($dbh,$biblionumber,$record,$frameworkcode);
-# reread subscription to get a hash (for calculation of the 1st issue number)
-    my $query = qq(
-        SELECT *
-        FROM   subscription
-        WHERE  subscriptionid = ?
-    );
-    $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my $val = $sth->fetchrow_hashref;
-
-# calculate issue number
-    my $serialseq = GetSeq($val);
-    my $query = qq|
-        INSERT INTO serial
-            (serialseq,subscriptionid,biblionumber,status, planneddate,publisheddate)
-        VALUES (?,?,?,?,?,?)
-    |;
-
-    $sth = $dbh->prepare($query);
-    $sth->execute($serialseq, $subscriptionid, $val->{'biblionumber'}, 1, format_date_in_iso($startdate),format_date_in_iso($publisheddate));
-    return $subscriptionid;
-}
-
-
-=head2 ReNewSubscription
-
-=over 4
-
-ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
-
-this function renew a subscription with values given on input args.
-
-=back
-
-=cut
-sub ReNewSubscription {
-    my ($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note) = @_;
-    my $dbh = C4::Context->dbh;
-    my $subscription = GetSubscription($subscriptionid);
-    my $record=XMLgetbiblio($dbh,$subscription->{biblionumber});
-    $record=XML_xml2hash_onerecord($record);
-    my $biblio = XMLmarc2koha_onerecord($dbh,$record,"biblios");
-    NewSuggestion($user,$subscription->{bibliotitle},$biblio->{author},$biblio->{publishercode},$biblio->{note},'','','','','',$subscription->{biblionumber});
-    # renew subscription
-    my $query = qq|
-        UPDATE subscription
-        SET    startdate=?,numberlength=?,weeklength=?,monthlength=?
-        WHERE  subscriptionid=?
-    |;
-my    $sth=$dbh->prepare($query);
-    $sth->execute(format_date_in_iso($startdate),$numberlength,$weeklength,$monthlength, $subscriptionid);
-}
-
-
-=head2 NewIssue
-
-=over 4
-
-NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $publisheddate, $planneddate)
-
-Create a new issue stored on the database.
-Note : we have to update the receivedlist and missinglist on subscriptionhistory for this subscription.
-
-=back
-
-=cut
-sub NewIssue {
-    my ($serialseq,$subscriptionid,$biblionumber,$status, $publisheddate, $planneddate,$itemnumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        INSERT INTO serial
-            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,itemnumber)
-        VALUES (?,?,?,?,?,?,?)
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($serialseq,$subscriptionid,$biblionumber,$status,format_date_in_iso($publisheddate), format_date_in_iso($planneddate),$itemnumber);
-
-    my $query = qq|
-        SELECT missinglist,receivedlist
-        FROM   subscriptionhistory
-        WHERE  subscriptionid=?
-    |;
-    $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my ($missinglist,$receivedlist) = $sth->fetchrow;
-    if ($status eq 2) {
-        $receivedlist .= ",$serialseq";
-    }
-    if ($status eq 4) {
-        $missinglist .= ",$serialseq";
-    }
-    my $query = qq|
-        UPDATE subscriptionhistory
-        SET    receivedlist=?, missinglist=?
-        WHERE  subscriptionid=?
-    |;
-    $sth=$dbh->prepare($query);
-    $sth->execute($receivedlist,$missinglist,$subscriptionid);
-}
-
-=head2 serialchangestatus
-
-=over 4
-
-serialchangestatus($serialid,$serialseq,$planneddate,$status,$notes)
-
-Change the status of a serial issue.
-Note: this was the older subroutine
-
-=back
-
-=cut
-sub serialchangestatus {
-    my ($serialid,$serialseq,$planneddate,$status,$notes)=@_;
-    # 1st, get previous status : if we change from "waited" to something else, then we will have to create a new "waited" entry
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("select subscriptionid,status from serial where serialid=?");
-    $sth->execute($serialid);
-    my ($subscriptionid,$oldstatus) = $sth->fetchrow;
-    # change status & update subscriptionhistory
-    if ($status eq 6){
-        delissue($serialseq, $subscriptionid)
-    }else{
-        $sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=?,notes=? where serialid = ?");
-        $sth->execute($serialseq,format_date_in_iso($planneddate),$status,$notes,$serialid);
-
-        $sth = $dbh->prepare("select missinglist,receivedlist from subscriptionhistory where subscriptionid=?");
-        $sth->execute($subscriptionid);
-        my ($missinglist,$receivedlist) = $sth->fetchrow;
-        if ($status eq 2) {
-            $receivedlist .= "| $serialseq";
-            $receivedlist =~ s/^\| //g;
-        }
-        $missinglist .= "| $serialseq" if ($status eq 4) ;
-        $missinglist .= "| not issued $serialseq" if ($status eq 5);
-        $missinglist =~ s/^\| //g;
-        $sth=$dbh->prepare("update subscriptionhistory set receivedlist=?, missinglist=? where subscriptionid=?");
-        $sth->execute($receivedlist,$missinglist,$subscriptionid);
-    }
-    # create new waited entry if needed (ie : was a "waited" and has changed)
-    if ($oldstatus eq 1 && $status ne 1) {
-        $sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
-        $sth->execute($subscriptionid);
-        my $val = $sth->fetchrow_hashref;
-        # next issue number
-        my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3) = New_Get_Next_Seq($val);
-        my $nextplanneddate = GetNextDate($planneddate,$val);
-        NewIssue($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextplanneddate);
-        $sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=? where subscriptionid = ?");
-        $sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$subscriptionid);
-    }
-    # check if an alert must be sent... (= a letter is defined & status became "arrived"
-   	$sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
-	$sth->execute($subscriptionid);
-	my $subscription = $sth->fetchrow_hashref; 
-    if ($subscription->{letter} && $status eq 2) {
-        sendalerts('issue',$subscription->{subscriptionid},$subscription->{letter});
-    }
-}
-
-
-
-
-=head2 HasSubscriptionExpired
-
-=over 4
-
-1 or 0 = HasSubscriptionExpired($subscriptionid)
-
-the subscription has expired when the next issue to arrive is out of subscription limit.
-
-return :
-1 if true, 0 if false.
-
-=back
-
-=cut
-sub HasSubscriptionExpired {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $subscription = GetSubscription($subscriptionid);
-    my $expirationdate   = GetSubscriptionExpirationDate($subscriptionid);
-    my $query = qq|
-            SELECT max(planneddate)
-            FROM   serial
-            WHERE  subscriptionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my ($res) = $sth->fetchrow  ;
-    my @res=split (/-/,$res);
-    my @endofsubscriptiondate=split(/-/,$expirationdate);
-    return 1 if ( (@endofsubscriptiondate && Delta_Days($res[0],$res[1],$res[2],
-                  $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2]) <= 0)
-                  || (!$res));
-    return 0;
-}
-
-=head2 SetDistributedto
-
-=over 4
-
-SetDistributedto($distributedto,$subscriptionid);
-This function update the value of distributedto for a subscription given on input arg.
-
-=back
-
-=cut
-sub SetDistributedto {
-    my ($distributedto,$subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        UPDATE subscription
-        SET    distributedto=?
-        WHERE  subscriptionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($distributedto,$subscriptionid);
-}
-
-=head2 DelSubscription
-
-=over 4
-
-DelSubscription($subscriptionid)
-this function delete the subscription which has $subscriptionid as id.
-
-=back
-
-=cut
-sub DelSubscription {
-    my ($subscriptionid,$biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-## User may have subscriptionid stored in MARC so check and remove it
-my $record=XMLgetbibliohash($dbh,$biblionumber);
-XML_writeline( $record, "subscriptionid", "","biblios" );
-my $frameworkcode=MARCfind_frameworkcode($dbh,$biblionumber);
-NEWmodbiblio($dbh,$biblionumber,$record,$frameworkcode);
-    $subscriptionid=$dbh->quote($subscriptionid);
-    $dbh->do("DELETE FROM subscription WHERE subscriptionid=$subscriptionid");
-    $dbh->do("DELETE FROM subscriptionhistory WHERE subscriptionid=$subscriptionid");
-    $dbh->do("DELETE FROM serial WHERE subscriptionid=$subscriptionid");
-
-}
-
-=head2 DelIssue
-
-=over 4
-
-DelIssue($serialseq,$subscriptionid)
-this function delete an issue which has $serialseq and $subscriptionid given on input arg.
-
-=back
-
-=cut
-sub DelIssue {
-    my ($serialseq,$subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        DELETE FROM serial
-        WHERE       serialseq= ?
-        AND         subscriptionid= ?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($serialseq,$subscriptionid);
-}
-
-=head2 GetMissingIssues
-
-=over 4
-
-($count, at issuelist) = &GetMissingIssues($supplierid,$serialid)
-
-this function select missing issues on database - where serial.status = 4
-
-return :
-a count of the number of missing issues
-the issuelist into a table. Each line of this table containts a ref to a hash which it containts
-name,title,planneddate,serialseq,serial.subscriptionid from tables : subscription, serial & biblio
-
-=back
-
-=cut
-sub GetMissingIssues {
-    my ($supplierid,$serialid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    my $byserial='';
-    if($serialid) {
-	$byserial = "and serialid = ".$serialid;
-    }
-    if ($supplierid) {
-	$sth = $dbh->prepare("SELECT serialid,aqbooksellerid,name,title,planneddate,serialseq,serial.subscriptionid,claimdate
-                                  FROM subscription, serial, biblio
-                                  LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-                                  WHERE subscription.subscriptionid = serial.subscriptionid AND
-                                  serial.STATUS = 4 and
-                                  subscription.aqbooksellerid=$supplierid and
-                                  biblio.biblionumber = subscription.biblionumber ".$byserial." order by title
-                                  ");
-    } else {
-	$sth = $dbh->prepare("SELECT serialid,aqbooksellerid,name,title,planneddate,serialseq,serial.subscriptionid,claimdate
-                                  FROM subscription, serial, biblio
-                                  LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-                                  WHERE subscription.subscriptionid = serial.subscriptionid AND
-                                  serial.STATUS =4 and
-                                  biblio.biblionumber = subscription.biblionumber ".$byserial." order by title
-                                  ");
-    }
-    $sth->execute;
-    my @issuelist;
-    my $last_title;
-    my $odd=0;
-    my $count=0;
-    while (my $line = $sth->fetchrow_hashref) {
-	$odd++ unless $line->{title} eq $last_title;
-	$last_title = $line->{title} if ($line->{title});
-	$line->{planneddate} = format_date($line->{planneddate});
-	$line->{claimdate} = format_date($line->{claimdate});
-	$line->{'odd'} = 1 if $odd %2 ;
-	$count++;
-	push @issuelist,$line;
-    }
-    return $count, at issuelist;
-}
-
-=head2 removeMissingIssue
-
-=over 4
-
-removeMissingIssue($subscriptionid)
-
-this function removes an issue from being part of the missing string in 
-subscriptionlist.missinglist column
-
-called when a missing issue is found from the statecollection.pl file
-
-=back
-
-=cut
-sub removeMissingIssue {
-    my ($sequence,$subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT * FROM subscriptionhistory WHERE subscriptionid = ?");
-    $sth->execute($subscriptionid);
-    my $data = $sth->fetchrow_hashref;
-    my $missinglist = $data->{'missinglist'};
-    my $missinglistbefore = $missinglist;
-    # warn $missinglist." before";
-    $missinglist =~ s/($sequence)//;
-    # warn $missinglist." after";
-    if($missinglist ne $missinglistbefore){
-	$missinglist =~ s/\|\s\|/\|/g;
-	$missinglist =~ s/^\| //g;
-	$missinglist =~ s/\|$//g;
-	my $sth2= $dbh->prepare("UPDATE subscriptionhistory
-                                       SET missinglist = ?
-                                       WHERE subscriptionid = ?");
-        $sth2->execute($missinglist,$subscriptionid);
-    }
-}
-
-=head2 updateClaim
-
-=over 4
-
-&updateClaim($serialid)
-
-this function updates the time when a claim is issued for late/missing items
-
-called from claims.pl file
-
-=back
-
-=cut
-sub updateClaim {
-    my ($serialid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("UPDATE serial SET claimdate = now()
-                                   WHERE serialid = ?
-                                   ");
-    $sth->execute($serialid);
-}
-
-=head2 getsupplierbyserialid
-
-=over 4
-
-($result) = &getsupplierbyserialid($serialid)
-
-this function is used to find the supplier id given a serial id
-
-return :
-hashref containing serialid, subscriptionid, and aqbooksellerid
-
-=back
-
-=cut
-sub getsupplierbyserialid {
-    my ($serialid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT serialid, serial.subscriptionid, aqbooksellerid
-                                   FROM serial, subscription
-                                   WHERE serial.subscriptionid = subscription.subscriptionid
-                                   AND serialid = ?
-                                   ");
-    $sth->execute($serialid);
-    my $line = $sth->fetchrow_hashref;
-    my $result = $line->{'aqbooksellerid'};
-    return $result;
-}
-
-=head2 check_routing
-
-=over 4
-
-($result) = &check_routing($subscriptionid)
-
-this function checks to see if a serial has a routing list and returns the count of routingid
-used to show either an 'add' or 'edit' link
-=back
-
-=cut
-sub check_routing {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT count(routingid) routingids FROM subscriptionroutinglist, subscription
-                              WHERE subscription.subscriptionid = subscriptionroutinglist.subscriptionid
-                              AND subscription.subscriptionid = ? ORDER BY ranking ASC
-                              ");
-    $sth->execute($subscriptionid);
-    my $line = $sth->fetchrow_hashref;
-    my $result = $line->{'routingids'};
-    return $result;
-}
-
-=head2 addroutingmember
-
-=over 4
-
-&addroutingmember($bornum,$subscriptionid)
-
-this function takes a borrowernumber and subscriptionid and add the member to the
-routing list for that serial subscription and gives them a rank on the list
-of either 1 or highest current rank + 1
-
-=back
-
-=cut
-sub addroutingmember {
-    my ($bornum,$subscriptionid) = @_;
-    my $rank;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT max(ranking) rank FROM subscriptionroutinglist WHERE subscriptionid = ?");
-    $sth->execute($subscriptionid);
-    while(my $line = $sth->fetchrow_hashref){
-	if($line->{'rank'}>0){
-	    $rank = $line->{'rank'}+1;
-	} else {
-	    $rank = 1;
-	}
-    }
-    $sth = $dbh->prepare("INSERT INTO subscriptionroutinglist VALUES (null,?,?,?,null)");
-    $sth->execute($subscriptionid,$bornum,$rank);
-}
-
-=head2 reorder_members
-
-=over 4
-
-&reorder_members($subscriptionid,$routingid,$rank)
-
-this function is used to reorder the routing list
-
-it takes the routingid of the member one wants to re-rank and the rank it is to move to
-- it gets all members on list puts their routingid's into an array
-- removes the one in the array that is $routingid
-- then reinjects $routingid at point indicated by $rank
-- then update the database with the routingids in the new order
-
-=back
-
-=cut
-sub reorder_members {
-    my ($subscriptionid,$routingid,$rank) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT * FROM subscriptionroutinglist WHERE subscriptionid = ? ORDER BY ranking ASC");
-    $sth->execute($subscriptionid);
-    my @result;
-    while(my $line = $sth->fetchrow_hashref){
-	push(@result,$line->{'routingid'});
-    }
-    # To find the matching index
-    my $i;
-    my $key = -1; # to allow for 0 being a valid response
-    for ($i = 0; $i < @result; $i++) {
-	if ($routingid == $result[$i]) {
-	    $key = $i; # save the index
-	    last;
-	}
-    }
-    # if index exists in array then move it to new position
-    if($key > -1 && $rank > 0){
-	my $new_rank = $rank-1; # $new_rank is what you want the new index to be in the array
-	my $moving_item = splice(@result, $key, 1);
-	splice(@result, $new_rank, 0, $moving_item);
-    }
-    for(my $j = 0; $j < @result; $j++){
-	my $sth = $dbh->prepare("UPDATE subscriptionroutinglist SET ranking = '" . ($j+1) . "' WHERE routingid = '". $result[$j]."'");
-	$sth->execute;
-    }
-}
-
-=head2 delroutingmember
-
-=over 4
-
-&delroutingmember($routingid,$subscriptionid)
-
-this function either deletes one member from routing list if $routingid exists otherwise
-deletes all members from the routing list
-
-=back
-
-=cut
-sub delroutingmember {
-    # if $routingid exists then deletes that row otherwise deletes all with $subscriptionid
-    my ($routingid,$subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    if($routingid){
-	my $sth = $dbh->prepare("DELETE FROM subscriptionroutinglist WHERE routingid = ?");
-	$sth->execute($routingid);
-	reorder_members($subscriptionid,$routingid);
-    } else {
-	my $sth = $dbh->prepare("DELETE FROM subscriptionroutinglist WHERE subscriptionid = ?");
-	$sth->execute($subscriptionid);
-    }
-}
-
-=head2 getroutinglist
-
-=over 4
-
-($count, at routinglist) = &getroutinglist($subscriptionid)
-
-this gets the info from the subscriptionroutinglist for $subscriptionid
-
-return :
-a count of the number of members on routinglist
-the routinglist into a table. Each line of this table containts a ref to a hash which containts
-routingid - a unique id, borrowernumber, ranking, and biblionumber of subscription
-
-=back
-
-=cut
-sub getroutinglist {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT routingid, borrowernumber,
-                              ranking, biblionumber FROM subscriptionroutinglist, subscription
-                              WHERE subscription.subscriptionid = subscriptionroutinglist.subscriptionid
-                              AND subscription.subscriptionid = ? ORDER BY ranking ASC
-                              ");
-    $sth->execute($subscriptionid);
-    my @routinglist;
-    my $count=0;
-    while (my $line = $sth->fetchrow_hashref) {
-	$count++;
-	push(@routinglist,$line);
-    }
-    return ($count, at routinglist);
-}
-
-=head2 abouttoexpire
-
-=over 4
-
-$result = &abouttoexpire($subscriptionid)
-
-this function alerts you to the penultimate issue for a serial subscription
-
-returns 1 - if this is the penultimate issue
-returns 0 - if not
-
-=back
-
-=cut
-
-sub abouttoexpire { 
-     my ($subscriptionid) = @_;
-    my $dbh              = C4::Context->dbh;
-    my $subscription     = GetSubscription($subscriptionid);
-    my $expirationdate   = GetSubscriptionExpirationDate($subscriptionid);
-    my $sth =
-      $dbh->prepare(
-        "select max(planneddate) from serial where subscriptionid=?");
-    $sth->execute($subscriptionid);
-    my ($res) = $sth->fetchrow ;
-#     warn "date expiration : ".$expirationdate." date courante ".$res;
-    my @res=split /-/,$res;
-    my @endofsubscriptiondate=split/-/,$expirationdate;
-    my $per = $subscription->{'periodicity'};
-    my $x;
-    if ( $per == 1 ) {$x=7;}
-    if ( $per == 2 ) {$x=7; }
-    if ( $per == 3 ) {$x=14;}
-    if ( $per == 4 ) { $x = 21; }
-    if ( $per == 5 ) { $x = 31; }
-    if ( $per == 6 ) { $x = 62; }
-    if ( $per == 7 || $per == 8 ) { $x = 93; }
-    if ( $per == 9 )  { $x = 190; }
-    if ( $per == 10 ) { $x = 365; }
-    if ( $per == 11 ) { $x = 730; }
-    my @datebeforeend=Add_Delta_Days(  $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2],
-                  - (3 * $x)) if (@endofsubscriptiondate);
-            # warn "DATE BEFORE END: $datebeforeend";
-    return 1 if ( @res && 
-                  (@datebeforeend && 
-                      Delta_Days($res[0],$res[1],$res[2],
-                      $datebeforeend[0],$datebeforeend[1],$datebeforeend[2]) <= 0) && 
-                  (@endofsubscriptiondate && 
-                      Delta_Days($res[0],$res[1],$res[2],
-                      $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2]) >= 0) );
-    return 0;
-}
-
-
-
-=head2 GetNextDate
-
-=over 4
-
-($resultdate) = &GetNextDate($planneddate,$subscription)
-
-this function  takes the planneddate and will return the next issue's date and will skip dates if there
-exists an irregularity
-- eg if periodicity is monthly and $planneddate is 2007-02-10 but if March and April is to be 
-skipped then the returned date will be 2007-05-10
-
-return :
-$resultdate - then next date in the sequence
-
-=back
-
-=cut
-sub GetNextDate {
-    my ( $planneddate, $subscription ) = @_;
-    my @irreg = split( /\,/, $subscription->{irregularity} );
-
-    #date supposed to be in ISO.
-    
-    my ( $year, $month, $day ) = split(/-/, $planneddate);
-    $month=1 unless ($month);
-    $day=1 unless ($day);
-    my @resultdate;
-
-    #       warn "DOW $dayofweek";
-    if ( $subscription->{periodicity} == 1 ) {
-        my $dayofweek = Day_of_Week( $year,$month, $day );
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            $dayofweek = 0 if ( $dayofweek == 7 ); 
-            if ( in_array( ($dayofweek + 1), @irreg ) ) {
-                ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 1 );
-                $dayofweek++;
-            }
-        }
-        @resultdate = Add_Delta_Days($year,$month, $day , 1 );
-    }
-    if ( $subscription->{periodicity} == 2 ) {
-        my ($wkno,$year) = Week_of_Year( $year,$month, $day );
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($wkno!=51)?($wkno +1) % 52 :52)) {
-                ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 7 );
-                $wkno=(($wkno!=51)?($wkno +1) % 52 :52);
-            }
-        }
-        @resultdate = Add_Delta_Days( $year,$month, $day, 7);
-    }
-    if ( $subscription->{periodicity} == 3 ) {
-        my ($wkno,$year) = Week_of_Year( $year,$month, $day );
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($wkno!=50)?($wkno +2) % 52 :52)) {
-            ### BUGFIX was previously +1 ^
-                ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 14 );
-                $wkno=(($wkno!=50)?($wkno +2) % 52 :52);
-            }
-        }
-        @resultdate = Add_Delta_Days($year,$month, $day , 14 );
-    }
-    if ( $subscription->{periodicity} == 4 ) {
-        my ($wkno,$year) = Week_of_Year( $year,$month, $day );
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($wkno!=49)?($wkno +3) % 52 :52)) {
-                ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 21 );
-                $wkno=(($wkno!=49)?($wkno +3) % 52 :52);
-            }
-        }
-        @resultdate = Add_Delta_Days($year,$month, $day , 21 );
-    }
-    my $tmpmonth=$month;
-    if ( $subscription->{periodicity} == 5 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=11)?($tmpmonth +1) % 12 :12)) {
-                ($year,$month,$day) = Add_Delta_YMD($year,$month, $day ,0,1,0 );
-                $tmpmonth=(($tmpmonth!=11)?($tmpmonth +1) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YMD($year,$month, $day ,0,1,0 );
-    }
-    if ( $subscription->{periodicity} == 6 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=10)?($tmpmonth +2) % 12 :12)) {
-                ($year,$month,$day) = Add_Delta_YMD($year,$month, $day ,0,2,0 );
-                $tmpmonth=(($tmpmonth!=10)?($tmpmonth + 2) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YMD($year,$month, $day, 0, 2,0 );
-    }
-    if ( $subscription->{periodicity} == 7 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=9)?($tmpmonth +3) % 12 :12)) {
-                ($year,$month,$day) = Add_Delta_YMD($year,$month, $day, 0, 3,0 );
-                $tmpmonth=(($tmpmonth!=9)?($tmpmonth + 3) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YMD($year,$month, $day, 0, 3, 0);
-    }
-    if ( $subscription->{periodicity} == 8 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=9)?($tmpmonth +3) % 12 :12)) {
-                ($year,$month,$day) = Add_Delta_YMD($year,$month, $day, 0, 3,0 );
-                $tmpmonth=(($tmpmonth!=9)?($tmpmonth + 3) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YMD($year,$month, $day, 0, 3, 0);
-    }
-    if ( $subscription->{periodicity} == 9 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=9)?($tmpmonth +3) % 12 :12)) {
-            ### BUFIX Seems to need more Than One ?
-                ($year,$month,$day) = Add_Delta_YM($year,$month, $day, 0, 6 );
-                $tmpmonth=(($tmpmonth!=6)?($tmpmonth + 6) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YM($year,$month, $day, 0, 6);
-    }
-    if ( $subscription->{periodicity} == 10 ) {
-        @resultdate = Add_Delta_YM($year,$month, $day, 1, 0 );
-    }
-    if ( $subscription->{periodicity} == 11 ) {
-        @resultdate = Add_Delta_YM($year,$month, $day, 2, 0 );
-    }
-    my $resultdate=sprintf("%04d-%02d-%02d",$resultdate[0],$resultdate[1],$resultdate[2]);
-#     warn "dateNEXTSEQ : ".$resultdate;
-    return "$resultdate";
-}
-
-
-	
-1;
-__END__

Index: modules/C4/Serials.pm
===================================================================
RCS file: modules/C4/Serials.pm
diff -N modules/C4/Serials.pm
--- modules/C4/Serials.pm	11 Mar 2007 20:03:27 -0000	1.1.2.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,1792 +0,0 @@
-package C4::Serials; #assumes C4/Serials.pm
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Serials.pm,v 1.1.2.2 2007/03/11 20:03:27 tgarip1957 Exp $
-#Date::Calc added
-use strict;
-use C4::Date;
-use Date::Calc qw(:all);
-use C4::Suggestions;
-use C4::Biblio;
-use C4::Search;
-use C4::Letters;
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.2 $' =~ /\d+/g;
-        shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
-
-
-=head1 NAME
-
-C4::Serials - Give functions for serializing.
-
-=head1 SYNOPSIS
-
-  use C4::Serials;
-
-=head1 DESCRIPTION
-
-Give all XYZ functions
-
-=head1 FUNCTIONS
-
-=cut
- at ISA = qw(Exporter);
- at EXPORT = qw(
-    &NewSubscription &ModSubscription &DelSubscription &GetSubscriptions &GetSubscription
-    &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber 
-    &GetFullSubscriptionsFromBiblionumber &GetNextSeq
-    &ModSubscriptionHistory &NewIssue 
-    &GetSerials &GetLatestSerials &ModSerialStatus
-    &HasSubscriptionExpired &GetSubscriptionExpirationDate &ReNewSubscription
-    &GetSuppliersWithLateIssues &GetLateIssues &GetMissingIssues
-    &GetDistributedTo &SetDistributedto 
-    &getroutinglist &delroutingmember &addroutingmember &reorder_members
-    &check_routing &getsupplierbyserialid &updateClaim &removeMissingIssue &abouttoexpire
-    &Get_Next_Date
-);
-
-=head2 GetSuppliersWithLateIssues
-
-=over 4
-
-%supplierlist = &GetSuppliersWithLateIssues
-
-this function get all suppliers with late issues.
-
-return :
-the supplierlist into a hash. this hash containts id & name of the supplier
-
-=back
-
-=cut
-sub GetSuppliersWithLateIssues {
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT DISTINCT id, name
-        FROM            subscription, serial
-        LEFT JOIN       aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-        WHERE           subscription.subscriptionid = serial.subscriptionid
-        AND             (planneddate < now() OR serial.STATUS = 3 OR serial.STATUS = 4)
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute;
-    my %supplierlist;
-    while (my ($id,$name) = $sth->fetchrow) {
-        $supplierlist{$id} = $name;
-    }
-    if(C4::Context->preference("RoutingSerials")){
-	$supplierlist{''} = "All Suppliers";
-    }
-    return %supplierlist;
-}
-
-=head2 GetLateIssues
-
-=over 4
-
- at issuelist = &GetLateIssues($supplierid)
-
-this function select late issues on database
-
-return :
-the issuelist into an table. Each line of this table containts a ref to a hash which it containts
-name,title,planneddate,serialseq,serial.subscriptionid from tables : subscription, serial & biblio
-
-=back
-
-=cut
-sub GetLateIssues {
-    my ($supplierid) = shift;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if ($supplierid) {
-        my $query = qq |
-            SELECT     name,title,planneddate,serialseq,serial.subscriptionid
-            FROM       subscription, serial, biblio
-            LEFT JOIN  aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-            WHERE      subscription.subscriptionid = serial.subscriptionid
-            AND        ((planneddate < now() AND serial.STATUS =1) OR serial.STATUS = 3)
-            AND        subscription.aqbooksellerid=$supplierid
-            AND        biblio.biblionumber = subscription.biblionumber
-            ORDER BY   title
-        |;
-        $sth = $dbh->prepare($query);
-    } else {
-        my $query = qq|
-            SELECT     name,title,planneddate,serialseq,serial.subscriptionid
-            FROM       subscription, serial, biblio
-            LEFT JOIN  aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-            WHERE      subscription.subscriptionid = serial.subscriptionid
-            AND        ((planneddate < now() AND serial.STATUS =1) OR serial.STATUS = 3)
-            AND        biblio.biblionumber = subscription.biblionumber
-            ORDER BY   title
-        |;
-        $sth = $dbh->prepare($query);
-    }
-    $sth->execute;
-    my @issuelist;
-    my $last_title;
-    my $odd=0;
-    my $count=0;
-    while (my $line = $sth->fetchrow_hashref) {
-        $odd++ unless $line->{title} eq $last_title;
-        $line->{title} = "" if $line->{title} eq $last_title;
-        $last_title = $line->{title} if ($line->{title});
-        $line->{planneddate} = format_date($line->{planneddate});
-        $line->{'odd'} = 1 if $odd %2 ;
-	$count++;
-        push @issuelist,$line;
-    }
-    return $count, at issuelist;
-}
-
-=head2 GetSubscriptionHistoryFromSubscriptionId
-
-=over 4
-
-$sth = GetSubscriptionHistoryFromSubscriptionId()
-this function just prepare the SQL request.
-After this function, don't forget to execute it by using $sth->execute($subscriptionid)
-return :
-$sth = $dbh->prepare($query).
-
-=back
-
-=cut
-sub GetSubscriptionHistoryFromSubscriptionId() {
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT *
-        FROM   subscriptionhistory
-        WHERE  subscriptionid = ?
-    |;
-    return $dbh->prepare($query);
-}
-
-=head2 GetSerialStatusFromSerialId
-
-=over 4
-
-$sth = GetSerialStatusFromSerialId();
-this function just prepare the SQL request.
-After this function, don't forget to execute it by using $sth->execute($serialid)
-return :
-$sth = $dbh->prepare($query).
-
-=back
-
-=cut
-sub GetSerialStatusFromSerialId(){
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT status
-        FROM   serial
-        WHERE  serialid = ?
-    |;
-    return $dbh->prepare($query);
-}
-
-
-=head2 GetSubscription
-
-=over 4
-
-$subs = GetSubscription($subscriptionid)
-this function get the subscription which has $subscriptionid as id.
-return :
-a hashref. This hash containts
-subscription, subscriptionhistory, aqbudget.bookfundid, biblio.title
-
-=back
-
-=cut
-sub GetSubscription {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query =qq(
-        SELECT  subscription.*,
-                subscriptionhistory.*,
-                aqbudget.bookfundid,
-                aqbooksellers.name AS aqbooksellername,
-                biblio.title AS bibliotitle
-       FROM subscription
-       LEFT JOIN subscriptionhistory ON subscription.subscriptionid=subscriptionhistory.subscriptionid
-       LEFT JOIN aqbudget ON subscription.aqbudgetid=aqbudget.aqbudgetid
-       LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
-       LEFT JOIN biblio ON biblio.biblionumber=subscription.biblionumber
-       WHERE subscription.subscriptionid = ?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my $subs = $sth->fetchrow_hashref;
-    return $subs;
-}
-
-=head2 GetSubscriptionsFromBiblionumber
-
-=over 4
-
-\@res = GetSubscriptionsFromBiblionumber($biblionumber)
-this function get the subscription list. it reads on subscription table.
-return :
-table of subscription which has the biblionumber given on input arg.
-each line of this table is a hashref. All hashes containt
-planned, histstartdate,opacnote,missinglist,receivedlist,periodicity,status & enddate
-
-=back
-
-=cut
-sub GetSubscriptionsFromBiblionumber {
-    my ($biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq(
-        SELECT subscription.*,
-               subscriptionhistory.*,
-               aqbudget.bookfundid,
-               aqbooksellers.name AS aqbooksellername,
-               biblio.title AS bibliotitle
-       FROM subscription
-       LEFT JOIN subscriptionhistory ON subscription.subscriptionid=subscriptionhistory.subscriptionid
-       LEFT JOIN aqbudget ON subscription.aqbudgetid=aqbudget.aqbudgetid
-       LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
-       LEFT JOIN biblio ON biblio.biblionumber=subscription.biblionumber
-       WHERE subscription.biblionumber = ?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    my @res;
-    while (my $subs = $sth->fetchrow_hashref) {
-        $subs->{planneddate} = format_date($subs->{planneddate});
-          $subs->{publisheddate} = format_date($subs->{publisheddate});
-        $subs->{histstartdate} = format_date($subs->{histstartdate});
-        $subs->{opacnote} =~ s/\n/\<br\/\>/g;
-        $subs->{missinglist} =~ s/\n/\<br\/\>/g;
-        $subs->{receivedlist} =~ s/\n/\<br\/\>/g;
-        $subs->{"periodicity".$subs->{periodicity}} = 1;
-        $subs->{"status".$subs->{'status'}} = 1;
-        if ($subs->{enddate} eq '0000-00-00') {
-            $subs->{enddate}='';
-        } else {
-            $subs->{enddate} = format_date($subs->{enddate});
-        }
-        push @res,$subs;
-    }
-    return \@res;
-}
-=head2 GetFullSubscriptionsFromBiblionumber
-
-=over 4
-
-   \@res = GetFullSubscriptionsFromBiblionumber($biblionumber)
-   this function read on serial table.
-
-=back
-
-=cut
-sub GetFullSubscriptionsFromBiblionumber {
-    my ($biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query=qq|
-                SELECT  serial.serialseq,
-                        serial.planneddate,
-                        serial.publisheddate,
-                        serial.status,
-                        serial.notes,
-                        year(serial.publisheddate) AS year,
-                        aqbudget.bookfundid,aqbooksellers.name AS aqbooksellername,
-                        biblio.title AS bibliotitle
-                FROM serial
-                LEFT JOIN subscription ON
-                    (serial.subscriptionid=subscription.subscriptionid AND subscription.biblionumber=serial.biblionumber)
-                LEFT JOIN aqbudget ON subscription.aqbudgetid=aqbudget.aqbudgetid 
-                LEFT JOIN aqbooksellers on subscription.aqbooksellerid=aqbooksellers.id
-                LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber
-                WHERE subscription.biblionumber = ?
-                ORDER BY year,serial.publisheddate,serial.subscriptionid,serial.planneddate
-    |;
-
-    my $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    my @res;
-    my $year;
-    my $startdate;
-    my $aqbooksellername;
-    my $bibliotitle;
-    my @loopissues;
-    my $first;
-    my $previousnote="";
-    while (my $subs = $sth->fetchrow_hashref) {
-        ### BUG To FIX: When there is no published date, will create many null ids!!!
-
-        if ($year and ($year==$subs->{year})){
-            if ($first eq 1){$first=0;}
-            my $temp=$res[scalar(@res)-1]->{'serials'};
-            push @$temp,
-                {'publisheddate' =>format_date($subs->{'publisheddate'}),
-                'planneddate' => format_date($subs->{'planneddate'}), 
-                'serialseq' => $subs->{'serialseq'},
-                "status".$subs->{'status'} => 1,
-                'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes},
-                };
-        } else {
-            $first=1 if (not $year);
-            $year= $subs->{'year'};
-            $startdate= format_date($subs->{'startdate'});
-            $aqbooksellername= $subs->{'aqbooksellername'};
-            $bibliotitle= $subs->{'bibliotitle'};
-            my @temp;
-            push @temp,
-                {'publisheddate' =>format_date($subs->{'publisheddate'}),
-                            'planneddate' => format_date($subs->{'planneddate'}), 
-                'serialseq' => $subs->{'serialseq'},
-                "status".$subs->{'status'} => 1,
-                'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes},
-                };
-
-            push @res,{
-                'year'=>$year,
-                'startdate'=>$startdate,
-                'aqbooksellername'=>$aqbooksellername,
-                'bibliotitle'=>$bibliotitle,
-                'serials'=>\@temp,
-                'first'=>$first 
-            };
-        }
-        $previousnote=$subs->{notes};
-    }
-    return \@res;
-}
-
-
-=head2 GetSubscriptions
-
-=over 4
-
- at results = GetSubscriptions($title,$ISSN,$biblionumber);
-this function get all subscriptions which has title like $title,ISSN like $ISSN and biblionumber like $biblionumber.
-return:
-a table of hashref. Each hash containt the subscription.
-
-=back
-
-=cut
-sub GetSubscriptions {
-    my ($title,$ISSN,$biblionumber,$supplierid) = @_;
-    return unless $title or $ISSN or $biblionumber or $supplierid;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if ($biblionumber) {
-        my $query = qq(
-            SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber
-            FROM   subscription,biblio
-            WHERE  biblio.biblionumber = subscription.biblionumber
-                AND biblio.biblionumber=?
-            ORDER BY title
-        );
-    $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    } elsif ($ISSN and $title){
-            my $query = qq|
-                SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber,aqbooksellerid
-                FROM   subscription,biblio
-                WHERE biblio.biblionumber= subscription.biblionumber
-                    AND (biblio.title LIKE ? or biblio.issn = ?)
-                ORDER BY title
-            |;
-            $sth = $dbh->prepare($query);
-            $sth->execute("%$title%",$ISSN);
-        } elsif ($ISSN){
-                my $query = qq(
-                    SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber,aqbooksellerid
-                    FROM   subscription,biblio
-                       WHERE biblio.biblionumber=subscription.biblionumber
-                        AND biblio.issn = ?
-                    ORDER BY title
-                );
-                $sth = $dbh->prepare($query);
-                $sth->execute($ISSN);
-       }elsif ($supplierid){
-                my $query = qq(
-                    SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber,aqbooksellerid
-                    FROM   subscription,biblio
-                   WHERE biblio.biblionumber=subscription.biblionumber
-                        AND subscription.aqbooksellerid = ?
-                    ORDER BY title
-                );
-                $sth = $dbh->prepare($query);
-                $sth->execute($supplierid);
-            } else {
-                my $query = qq(
-                    SELECT subscription.subscriptionid,biblio.title,biblio.issn,subscription.notes,biblio.biblionumber,aqbooksellerid
-                    FROM   subscription,biblio
-                    WHERE biblio.biblionumber=subscription.biblionumber
-                        AND biblio.title LIKE ?
-                    ORDER BY title
-                );
-                $sth = $dbh->prepare($query);
-                $sth->execute("%$title%");
-        }
-        
-   
-    my @results;
-    my $previoustitle="";
-    my $odd=1;
-    while (my $line = $sth->fetchrow_hashref) {
-        if ($previoustitle eq $line->{title}) {
-            $line->{title}="";
-            $line->{issn}="";
-            $line->{toggle} = 1 if $odd==1;
-        } else {
-            $previoustitle=$line->{title};
-            $odd=-$odd;
-            $line->{toggle} = 1 if $odd==1;
-        }
-        push @results, $line;
-    }
-    return @results;
-}
-
-=head2 GetSerials
-
-=over 4
-
-($totalissues, at serials) = GetSerials($subscriptionid);
-this function get every serial not arrived for a given subscription
-as well as the number of issues registered in the database (all types)
-this number is used to see if a subscription can be deleted (=it must have only 1 issue)
-
-=back
-
-=cut
-sub GetSerials {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-   
-    my $counter=0;
-    my @serials;
-   
-    # status = 2 is "arrived"
-    my $query = qq|
-        SELECT *
-        FROM   serial
-        WHERE  subscriptionid = ? AND status NOT IN (2,4,5)
-    |;
-    my $sth=$dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    while(my $line = $sth->fetchrow_hashref) {
-        $line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list
-        $line->{"publisheddate"} = format_date($line->{"publisheddate"});
-        $line->{"planneddate"} = format_date($line->{"planneddate"});
-        push @serials,$line;
-    }
- # OK, now add the last 5 issues arrived/missing
-    my $query = qq|
-        SELECT   *
-        FROM     serial
-        WHERE    subscriptionid = ?
-        AND      (status in (2,4,5))
-        ORDER BY serialid DESC
-    |;
-    my $sth=$dbh->prepare($query);
-    $sth->execute($subscriptionid);
- while((my $line = $sth->fetchrow_hashref) && $counter <5) {
-        $counter++;
-        $line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list
-        $line->{"planneddate"} = format_date($line->{"planneddate"});
-        $line->{"publisheddate"} = format_date($line->{"publisheddate"});
-        push @serials,$line;
-    }
-    my $query = qq|
-        SELECT count(*)
-        FROM   serial
-        WHERE  subscriptionid=?
-    |;
-    $sth=$dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my ($totalissues) = $sth->fetchrow;
-    return ($totalissues, at serials);
-}
-
-=head2 GetLatestSerials
-
-=over 4
-
-\@serials = GetLatestSerials($subscriptionid,$limit)
-get the $limit's latest serials arrived or missing for a given subscription
-return :
-a ref to a table which it containts all of the latest serials stored into a hash.
-
-=back
-
-=cut
-sub GetLatestSerials {
-    my ($subscriptionid,$limit) = @_;
-    my $dbh = C4::Context->dbh;
-    # status = 2 is "arrived"
-    my $strsth=qq(
-        SELECT   serialid,serialseq, status, planneddate
-        FROM     serial
-        WHERE    subscriptionid = ?
-        AND      (status =2 or status=4)
-        ORDER BY planneddate DESC LIMIT 0,$limit
-    );
-    my $sth=$dbh->prepare($strsth);
-    $sth->execute($subscriptionid);
-    my @serials;
-    while(my $line = $sth->fetchrow_hashref) {
-        $line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list
-        $line->{"planneddate"} = format_date($line->{"planneddate"});
-        push @serials,$line;
-    }
-#     my $query = qq|
-#         SELECT count(*)
-#         FROM   serial
-#         WHERE  subscriptionid=?
-#     |;
-#     $sth=$dbh->prepare($query);
-#     $sth->execute($subscriptionid);
-#     my ($totalissues) = $sth->fetchrow;
-    return \@serials;
-}
-
-=head2 GetDistributedTo
-
-=over 4
-
-$distributedto=GetDistributedTo($subscriptionid)
-This function select the old previous value of distributedto in the database.
-
-=back
-
-=cut
-sub GetDistributedTo {
-    my $dbh = C4::Context->dbh;
-    my $distributedto;
-    my $subscriptionid = @_;
-    my $query = qq|
-        SELECT distributedto
-        FROM   subscription
-        WHERE  subscriptionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    return ($distributedto) = $sth->fetchrow;
-}
-
-=head2 GetNextSeq
-
-=over 4
-
-GetNextSeq($val)
-$val is a hashref containing all the attributes of the table 'subscription'
-This function get the next issue for the subscription given on input arg
-return:
-all the input params updated.
-
-=back
-
-=cut
-sub Get_Next_Seq {
-    my ($val) =@_;
-    my ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
-    $calculated = $val->{numberingmethod};
-# calculate the (expected) value of the next issue received.
-    $newlastvalue1 = $val->{lastvalue1};
-# check if we have to increase the new value.
-    $newinnerloop1 = $val->{innerloop1}+1;
-    $newinnerloop1=0 if ($newinnerloop1 >= $val->{every1});
-    $newlastvalue1 += $val->{add1} if ($newinnerloop1<1); # <1 to be true when 0 or empty.
-    $newlastvalue1=$val->{setto1} if ($newlastvalue1>$val->{whenmorethan1}); # reset counter if needed.
-    $calculated =~ s/\{X\}/$newlastvalue1/g;
-
-    $newlastvalue2 = $val->{lastvalue2};
-# check if we have to increase the new value.
-    $newinnerloop2 = $val->{innerloop2}+1;
-    $newinnerloop2=0 if ($newinnerloop2 >= $val->{every2});
-    $newlastvalue2 += $val->{add2} if ($newinnerloop2<1); # <1 to be true when 0 or empty.
-    $newlastvalue2=$val->{setto2} if ($newlastvalue2>$val->{whenmorethan2}); # reset counter if needed.
-    $calculated =~ s/\{Y\}/$newlastvalue2/g;
-
-    $newlastvalue3 = $val->{lastvalue3};
-# check if we have to increase the new value.
-    $newinnerloop3 = $val->{innerloop3}+1;
-    $newinnerloop3=0 if ($newinnerloop3 >= $val->{every3});
-    $newlastvalue3 += $val->{add3} if ($newinnerloop3<1); # <1 to be true when 0 or empty.
-    $newlastvalue3=$val->{setto3} if ($newlastvalue3>$val->{whenmorethan3}); # reset counter if needed.
-    $calculated =~ s/\{Z\}/$newlastvalue3/g;
-    return ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
-}
-
-
-sub GetNextSeq {
-    my ($val) =@_;
-    my ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
-    my $pattern = $val->{numberpattern};
-    my @seasons = ('nothing','Winter','Spring','Summer','Autumn');
-    my @southern_seasons = ('','Summer','Autumn','Winter','Spring');
-    $calculated = $val->{numberingmethod};
-    $newlastvalue1 = $val->{lastvalue1};
-    $newlastvalue2 = $val->{lastvalue2};
-    $newlastvalue3 = $val->{lastvalue3};
-    if($newlastvalue3 > 0){ # if x y and z columns are used
-	$newlastvalue3 = $newlastvalue3+1;
-	if($newlastvalue3 > $val->{whenmorethan3}){
-	    $newlastvalue3 = $val->{setto3};
-	    $newlastvalue2++;
-	    if($newlastvalue2 > $val->{whenmorethan2}){
-		$newlastvalue1++;
-		$newlastvalue2 = $val->{setto2};
-	    }
-	}
-	$calculated =~ s/\{X\}/$newlastvalue1/g;
-	if($pattern == 6){
-	    if($val->{hemisphere} == 2){
-		my $newlastvalue2seq = $southern_seasons[$newlastvalue2];
-		$calculated =~ s/\{Y\}/$newlastvalue2seq/g;
-	    } else {
-		my $newlastvalue2seq = $seasons[$newlastvalue2];
-		$calculated =~ s/\{Y\}/$newlastvalue2seq/g;
-	    }
-	} else {
-	    $calculated =~ s/\{Y\}/$newlastvalue2/g;
-	}
-	$calculated =~ s/\{Z\}/$newlastvalue3/g;
-    }
-    if($newlastvalue2 > 0 && $newlastvalue3 < 1){ # if x and y columns are used
-	$newlastvalue2 = $newlastvalue2+1;
-	if($newlastvalue2 > $val->{whenmorethan2}){
-	    $newlastvalue2 = $val->{setto2};
-	    $newlastvalue1++;
-	}
-	$calculated =~ s/\{X\}/$newlastvalue1/g;
-	if($pattern == 6){
-	    if($val->{hemisphere} == 2){
-		my $newlastvalue2seq = $southern_seasons[$newlastvalue2];
-		$calculated =~ s/\{Y\}/$newlastvalue2seq/g;
-	    } else {
-		my $newlastvalue2seq = $seasons[$newlastvalue2];
-		$calculated =~ s/\{Y\}/$newlastvalue2seq/g;
-	    }
-	} else {
-	    $calculated =~ s/\{Y\}/$newlastvalue2/g;
-	}
-    }
-    if($newlastvalue1 > 0 && $newlastvalue2 < 1 && $newlastvalue3 < 1){ # if column x only
-	$newlastvalue1 = $newlastvalue1+1;
-	if($newlastvalue1 > $val->{whenmorethan1}){
-	    $newlastvalue1 = $val->{setto2};
-	}
-	$calculated =~ s/\{X\}/$newlastvalue1/g;
-    }
-    return ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3);
-}
-
-
-=head2 GetNextDate
-
-=over 4
-
-$resultdate = GetNextDate($planneddate,$subscription)
-
-this function get the date after $planneddate.
-return:
-the date on ISO format.
-
-=back
-
-=cut
-
-=head2 GetSeq
-
-=over 4
-
-$calculated = GetSeq($val)
-$val is a hashref containing all the attributes of the table 'subscription'
-this function transforms {X},{Y},{Z} to 150,0,0 for example.
-return:
-the sequence in integer format
-
-=back
-
-=cut
-sub GetSeq {
-    my ($val) =@_;
-    my $calculated = $val->{numberingmethod};
-    my $x=$val->{'lastvalue1'};
-    $calculated =~ s/\{X\}/$x/g;
-    my $y=$val->{'lastvalue2'};
-    $calculated =~ s/\{Y\}/$y/g;
-    my $z=$val->{'lastvalue3'};
-    $calculated =~ s/\{Z\}/$z/g;
-    return $calculated;
-}
-
-=head2 GetSubscriptionExpirationDate
-
-=over 4
-
-$sensddate = GetSubscriptionExpirationDate($subscriptionid)
-
-this function return the expiration date for a subscription given on input args.
-
-return
-the enddate
-
-=back
-
-=cut
-sub GetSubscriptionExpirationDate {
-    my ($subscriptionid) = @_;
-    my $dbh              = C4::Context->dbh;
-    my $subscription     = GetSubscription($subscriptionid);
-    my $enddate          = $subscription->{startdate};
-
-# we don't do the same test if the subscription is based on X numbers or on X weeks/months
-#     warn "SUBSCRIPTIONID :$subscriptionid";
-#     use Data::Dumper; warn Dumper($subscription);
-
-    if ( $subscription->{numberlength} ) {
-        #calculate the date of the last issue.
-        my $length = $subscription->{numberlength};
-#         warn "ENDDATE ".$enddate;
-        for ( my $i = 1 ; $i <= $length ; $i++ ) {
-            $enddate = GetNextDate( $enddate, $subscription );
-#             warn "AFTER ENDDATE ".$enddate;
-        }
-    }
-    elsif ( $subscription->{monthlength} ){
-#         warn "dateCHECKRESERV :".$subscription->{startdate};
-        my @date=split (/-/,$subscription->{startdate});
-        my @enddate = Add_Delta_YM($date[0],$date[1],$date[2],0,$subscription->{monthlength});
-        $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]);
-    } elsif ( $subscription->{weeklength} ){
-        my @date=split (/-/,$subscription->{startdate});
-
-        my @enddate = Add_Delta_Days($date[0],$date[1],$date[2],$subscription->{weeklength}*7);
-        $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]);
-    }
-#     warn "date de fin :$enddate";
-    return $enddate;
-}
-
-=head2 CountSubscriptionFromBiblionumber
-
-=over 4
-
-$subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber)
-this count the number of subscription for a biblionumber given.
-return :
-the number of subscriptions with biblionumber given on input arg.
-
-=back
-
-=cut
-sub CountSubscriptionFromBiblionumber {
-    my ($biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT count(*)
-        FROM   subscription
-        WHERE  biblionumber=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    my $subscriptionsnumber = $sth->fetchrow;
-    return $subscriptionsnumber;
-}
-
-
-=head2 ModSubscriptionHistory
-
-=over 4
-
-ModSubscriptionHistory($subscriptionid,$histstartdate,$enddate,$receivedlist,$missinglist,$opacnote,$librariannote);
-
-this function modify the history of a subscription. Put your new values on input arg.
-
-=back
-
-=cut
-sub ModSubscriptionHistory {
-    my ($subscriptionid,$histstartdate,$enddate,$receivedlist,$missinglist,$opacnote,$librariannote)=@_;
-    my $dbh=C4::Context->dbh;
-    my $query = qq(
-        UPDATE subscriptionhistory 
-        SET histstartdate=?,enddate=?,receivedlist=?,missinglist=?,opacnote=?,librariannote=?
-        WHERE subscriptionid=?
-    );
-    my $sth = $dbh->prepare($query);
-    $receivedlist =~ s/^,//g;
-    $missinglist =~ s/^,//g;
-    $opacnote =~ s/^,//g;
-    $sth->execute($histstartdate,$enddate,$receivedlist,$missinglist,$opacnote,$librariannote,$subscriptionid);
-}
-
-=head2 ModSerialStatus
-
-=over 4
-
-ModSerialStatus($serialid,$serialseq, $publisheddate,$planneddate,$status,$notes)
-
-This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
-Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
-
-=back
-
-=cut
-sub ModSerialStatus {
-    my ($serialid,$serialseq, $publisheddate,$planneddate,$status,$notes,$itemnumber)=@_;
-
-    # 1st, get previous status :
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT subscriptionid,status
-        FROM   serial
-        WHERE  serialid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($serialid);
-    my ($subscriptionid,$oldstatus) = $sth->fetchrow;
-    # change status & update subscriptionhistory
-    if ($status eq 6){
-        DelIssue($serialseq, $subscriptionid)
-    } else {
-        my $query = qq(
-            UPDATE serial
-            SET    serialseq=?,publisheddate=?,planneddate=?,status=?,notes=?,itemnumber=?
-            WHERE  serialid = ?
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute($serialseq,format_date_in_iso($publisheddate),format_date_in_iso($planneddate),$status,$notes,$itemnumber,$serialid);
-        my $query = qq(
-            SELECT missinglist,receivedlist
-            FROM   subscriptionhistory
-            WHERE  subscriptionid=?
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute($subscriptionid);
-        my ($missinglist,$receivedlist) = $sth->fetchrow;
-        if ($status == 2 && $oldstatus != 2) {
-            $receivedlist .= ",$serialseq";
-        }
-        $missinglist .= ",$serialseq" if ($status eq 4) ;
-        $missinglist .= ",not issued $serialseq" if ($status eq 5);
-        my $query = qq(
-            UPDATE subscriptionhistory
-            SET    receivedlist=?, missinglist=?
-            WHERE  subscriptionid=?
-        );
-        $sth=$dbh->prepare($query);
-        $sth->execute($receivedlist,$missinglist,$subscriptionid);
-    }
-    # create new waited entry if needed (ie : was a "waited" and has changed)
-    if ($oldstatus eq 1 && $status ne 1) {
-        my $query = qq(
-            SELECT *
-            FROM   subscription
-            WHERE  subscriptionid = ?
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute($subscriptionid);
-        my $val = $sth->fetchrow_hashref;
-        # next issue number
-        my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = GetNextSeq($val);
-        # next date (calculated from actual date & frequency parameters)
-          my $nextplanneddate = GetNextDate($planneddate,$val);
-          my $nextpublisheddate = GetNextDate($publisheddate,$val);
-        NewIssue($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextpublisheddate,$nextplanneddate,0);
-        my $query = qq|
-            UPDATE subscription
-            SET    lastvalue1=?, lastvalue2=?, lastvalue3=?,
-                   innerloop1=?, innerloop2=?, innerloop3=?
-            WHERE  subscriptionid = ?
-        |;
-        $sth = $dbh->prepare($query);
-        $sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3,$subscriptionid);
-    }
-}
-
-=head2 ModSubscription
-
-=over 4
-
-this function modify a subscription. Put all new values on input args.
-
-=back
-
-=cut
-sub ModSubscription {
-    my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
-        $periodicity,$dow,$numberlength,$weeklength,$monthlength,
-        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-        $numberingmethod, $status, $biblionumber, $notes, $letter, $subscriptionid,$irregularity,$hemisphere,$callnumber,$numberpattern,$publisheddate)= @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        UPDATE subscription
-        SET     librarian=?, aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?,
-                periodicity=?,dow=?,numberlength=?,weeklength=?,monthlength=?,
-                add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,innerloop1=?,
-                add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,innerloop2=?,
-                add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
-                numberingmethod=?, status=?, biblionumber=?, notes=?, letter=?,irregularity=?,hemisphere=?,callnumber=?,numberpattern=? ,publisheddate=?
-        WHERE subscriptionid = ?
-    |;
-    my $sth=$dbh->prepare($query);
-    $sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
-        $periodicity,$dow,$numberlength,$weeklength,$monthlength,
-        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-        $numberingmethod, $status, $biblionumber, $notes, $letter, $irregularity,$hemisphere,$callnumber,$numberpattern,$publisheddate,$subscriptionid);
-    $sth->finish;
-}
-
-
-=head2 NewSubscription
-
-=over 4
-
-$subscriptionid = &NewSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-    $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
-    $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-    $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-    $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-    $numberingmethod, $status, $notes)
-
-Create a new subscription with value given on input args.
-
-return :
-the id of this new subscription
-
-=back
-
-=cut
-sub NewSubscription {
-    my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-        $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
-        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
-        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
-        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
-        $numberingmethod, $status, $notes, $letter,$irregularity,$hemisphere,$callnumber,$numberpattern,$publisheddate) = @_;
-
-    my $dbh = C4::Context->dbh;
-#save subscription (insert into database)
-    my $query = qq|
-        INSERT INTO subscription
-            (librarian,aqbooksellerid,cost,aqbudgetid,biblionumber,
-            startdate,periodicity,dow,numberlength,weeklength,monthlength,
-            add1,every1,whenmorethan1,setto1,lastvalue1,
-            add2,every2,whenmorethan2,setto2,lastvalue2,
-            add3,every3,whenmorethan3,setto3,lastvalue3,
-            numberingmethod, status, notes, letter,irregularity,hemisphere,callnumber,numberpattern,publisheddate)
-        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
-	|;
-    my $sth=$dbh->prepare($query);
-    $sth->execute(
-        $auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-        format_date_in_iso($startdate),$periodicity,$dow,$numberlength,$weeklength,$monthlength,
-        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
-        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
-        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
-        $numberingmethod, $status, $notes, $letter,$irregularity,$hemisphere,$callnumber,$numberpattern,format_date_in_iso($publisheddate));
-
-
-#then create the 1st waited number
-    my $subscriptionid = $dbh->{'mysql_insertid'};
-        my $enddate = GetSubscriptionExpirationDate($subscriptionid);
-    my $query = qq(
-        INSERT INTO subscriptionhistory
-            (biblionumber, subscriptionid, histstartdate, enddate, missinglist, receivedlist, opacnote, librariannote)
-        VALUES (?,?,?,?,?,?,?,?)
-        );
-    $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber, $subscriptionid, format_date_in_iso($startdate), format_date_in_iso($enddate), "", "", "", $notes);
-## User may have subscriptionid stored in MARC so check and fill it
-my $record=XMLgetbiblio($dbh,$biblionumber);
-$record=XML_xml2hash_onerecord($record);
-XML_writeline( $record, "subscriptionid", $subscriptionid,"biblios" );
-my $frameworkcode=MARCfind_frameworkcode($dbh,$biblionumber);
-NEWmodbiblio($dbh,$biblionumber,$record,$frameworkcode);
-# reread subscription to get a hash (for calculation of the 1st issue number)
-    my $query = qq(
-        SELECT *
-        FROM   subscription
-        WHERE  subscriptionid = ?
-    );
-    $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my $val = $sth->fetchrow_hashref;
-
-# calculate issue number
-    my $serialseq = GetSeq($val);
-    my $query = qq|
-        INSERT INTO serial
-            (serialseq,subscriptionid,biblionumber,status, planneddate,publisheddate)
-        VALUES (?,?,?,?,?,?)
-    |;
-
-    $sth = $dbh->prepare($query);
-    $sth->execute($serialseq, $subscriptionid, $val->{'biblionumber'}, 1, format_date_in_iso($startdate),format_date_in_iso($publisheddate));
-    return $subscriptionid;
-}
-
-
-=head2 ReNewSubscription
-
-=over 4
-
-ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
-
-this function renew a subscription with values given on input args.
-
-=back
-
-=cut
-sub ReNewSubscription {
-    my ($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note) = @_;
-    my $dbh = C4::Context->dbh;
-    my $subscription = GetSubscription($subscriptionid);
-    my $record=XMLgetbiblio($dbh,$subscription->{biblionumber});
-    $record=XML_xml2hash_onerecord($record);
-    my $biblio = XMLmarc2koha_onerecord($dbh,$record,"biblios");
-    NewSuggestion($user,$subscription->{bibliotitle},$biblio->{author},$biblio->{publishercode},$biblio->{note},'','','','','',$subscription->{biblionumber});
-    # renew subscription
-    my $query = qq|
-        UPDATE subscription
-        SET    startdate=?,numberlength=?,weeklength=?,monthlength=?
-        WHERE  subscriptionid=?
-    |;
-my    $sth=$dbh->prepare($query);
-    $sth->execute(format_date_in_iso($startdate),$numberlength,$weeklength,$monthlength, $subscriptionid);
-}
-
-
-=head2 NewIssue
-
-=over 4
-
-NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $publisheddate, $planneddate)
-
-Create a new issue stored on the database.
-Note : we have to update the receivedlist and missinglist on subscriptionhistory for this subscription.
-
-=back
-
-=cut
-sub NewIssue {
-    my ($serialseq,$subscriptionid,$biblionumber,$status, $publisheddate, $planneddate,$itemnumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        INSERT INTO serial
-            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,itemnumber)
-        VALUES (?,?,?,?,?,?,?)
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($serialseq,$subscriptionid,$biblionumber,$status,format_date_in_iso($publisheddate), format_date_in_iso($planneddate),$itemnumber);
-
-    my $query = qq|
-        SELECT missinglist,receivedlist
-        FROM   subscriptionhistory
-        WHERE  subscriptionid=?
-    |;
-    $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my ($missinglist,$receivedlist) = $sth->fetchrow;
-    if ($status eq 2) {
-        $receivedlist .= ",$serialseq";
-    }
-    if ($status eq 4) {
-        $missinglist .= ",$serialseq";
-    }
-    my $query = qq|
-        UPDATE subscriptionhistory
-        SET    receivedlist=?, missinglist=?
-        WHERE  subscriptionid=?
-    |;
-    $sth=$dbh->prepare($query);
-    $sth->execute($receivedlist,$missinglist,$subscriptionid);
-}
-
-=head2 serialchangestatus
-
-=over 4
-
-serialchangestatus($serialid,$serialseq,$planneddate,$status,$notes)
-
-Change the status of a serial issue.
-Note: this was the older subroutine
-
-=back
-
-=cut
-sub serialchangestatus {
-    my ($serialid,$serialseq,$planneddate,$status,$notes)=@_;
-    # 1st, get previous status : if we change from "waited" to something else, then we will have to create a new "waited" entry
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("select subscriptionid,status from serial where serialid=?");
-    $sth->execute($serialid);
-    my ($subscriptionid,$oldstatus) = $sth->fetchrow;
-    # change status & update subscriptionhistory
-    if ($status eq 6){
-        delissue($serialseq, $subscriptionid)
-    }else{
-        $sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=?,notes=? where serialid = ?");
-        $sth->execute($serialseq,format_date_in_iso($planneddate),$status,$notes,$serialid);
-
-        $sth = $dbh->prepare("select missinglist,receivedlist from subscriptionhistory where subscriptionid=?");
-        $sth->execute($subscriptionid);
-        my ($missinglist,$receivedlist) = $sth->fetchrow;
-        if ($status eq 2) {
-            $receivedlist .= "| $serialseq";
-            $receivedlist =~ s/^\| //g;
-        }
-        $missinglist .= "| $serialseq" if ($status eq 4) ;
-        $missinglist .= "| not issued $serialseq" if ($status eq 5);
-        $missinglist =~ s/^\| //g;
-        $sth=$dbh->prepare("update subscriptionhistory set receivedlist=?, missinglist=? where subscriptionid=?");
-        $sth->execute($receivedlist,$missinglist,$subscriptionid);
-    }
-    # create new waited entry if needed (ie : was a "waited" and has changed)
-    if ($oldstatus eq 1 && $status ne 1) {
-        $sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
-        $sth->execute($subscriptionid);
-        my $val = $sth->fetchrow_hashref;
-        # next issue number
-        my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3) = New_Get_Next_Seq($val);
-        my $nextplanneddate = GetNextDate($planneddate,$val);
-        NewIssue($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextplanneddate);
-        $sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=? where subscriptionid = ?");
-        $sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$subscriptionid);
-    }
-    # check if an alert must be sent... (= a letter is defined & status became "arrived"
-   	$sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
-	$sth->execute($subscriptionid);
-	my $subscription = $sth->fetchrow_hashref; 
-    if ($subscription->{letter} && $status eq 2) {
-        sendalerts('issue',$subscription->{subscriptionid},$subscription->{letter});
-    }
-}
-
-
-
-
-=head2 HasSubscriptionExpired
-
-=over 4
-
-1 or 0 = HasSubscriptionExpired($subscriptionid)
-
-the subscription has expired when the next issue to arrive is out of subscription limit.
-
-return :
-1 if true, 0 if false.
-
-=back
-
-=cut
-sub HasSubscriptionExpired {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $subscription = GetSubscription($subscriptionid);
-    my $expirationdate   = GetSubscriptionExpirationDate($subscriptionid);
-    my $query = qq|
-            SELECT max(planneddate)
-            FROM   serial
-            WHERE  subscriptionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    my ($res) = $sth->fetchrow  ;
-    my @res=split (/-/,$res);
-    my @endofsubscriptiondate=split(/-/,$expirationdate);
-    return 1 if ( (@endofsubscriptiondate && Delta_Days($res[0],$res[1],$res[2],
-                  $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2]) <= 0)
-                  || (!$res));
-    return 0;
-}
-
-=head2 SetDistributedto
-
-=over 4
-
-SetDistributedto($distributedto,$subscriptionid);
-This function update the value of distributedto for a subscription given on input arg.
-
-=back
-
-=cut
-sub SetDistributedto {
-    my ($distributedto,$subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        UPDATE subscription
-        SET    distributedto=?
-        WHERE  subscriptionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($distributedto,$subscriptionid);
-}
-
-=head2 DelSubscription
-
-=over 4
-
-DelSubscription($subscriptionid)
-this function delete the subscription which has $subscriptionid as id.
-
-=back
-
-=cut
-sub DelSubscription {
-    my ($subscriptionid,$biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-## User may have subscriptionid stored in MARC so check and remove it
-my $record=XMLgetbibliohash($dbh,$biblionumber);
-XML_writeline( $record, "subscriptionid", "","biblios" );
-my $frameworkcode=MARCfind_frameworkcode($dbh,$biblionumber);
-NEWmodbiblio($dbh,$biblionumber,$record,$frameworkcode);
-    $subscriptionid=$dbh->quote($subscriptionid);
-    $dbh->do("DELETE FROM subscription WHERE subscriptionid=$subscriptionid");
-    $dbh->do("DELETE FROM subscriptionhistory WHERE subscriptionid=$subscriptionid");
-    $dbh->do("DELETE FROM serial WHERE subscriptionid=$subscriptionid");
-
-}
-
-=head2 DelIssue
-
-=over 4
-
-DelIssue($serialseq,$subscriptionid)
-this function delete an issue which has $serialseq and $subscriptionid given on input arg.
-
-=back
-
-=cut
-sub DelIssue {
-    my ($serialseq,$subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        DELETE FROM serial
-        WHERE       serialseq= ?
-        AND         subscriptionid= ?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($serialseq,$subscriptionid);
-}
-
-=head2 GetMissingIssues
-
-=over 4
-
-($count, at issuelist) = &GetMissingIssues($supplierid,$serialid)
-
-this function select missing issues on database - where serial.status = 4
-
-return :
-a count of the number of missing issues
-the issuelist into a table. Each line of this table containts a ref to a hash which it containts
-name,title,planneddate,serialseq,serial.subscriptionid from tables : subscription, serial & biblio
-
-=back
-
-=cut
-sub GetMissingIssues {
-    my ($supplierid,$serialid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    my $byserial='';
-    if($serialid) {
-	$byserial = "and serialid = ".$serialid;
-    }
-    if ($supplierid) {
-	$sth = $dbh->prepare("SELECT serialid,aqbooksellerid,name,title,planneddate,serialseq,serial.subscriptionid,claimdate
-                                  FROM subscription, serial, biblio
-                                  LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-                                  WHERE subscription.subscriptionid = serial.subscriptionid AND
-                                  serial.STATUS = 4 and
-                                  subscription.aqbooksellerid=$supplierid and
-                                  biblio.biblionumber = subscription.biblionumber ".$byserial." order by title
-                                  ");
-    } else {
-	$sth = $dbh->prepare("SELECT serialid,aqbooksellerid,name,title,planneddate,serialseq,serial.subscriptionid,claimdate
-                                  FROM subscription, serial, biblio
-                                  LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
-                                  WHERE subscription.subscriptionid = serial.subscriptionid AND
-                                  serial.STATUS =4 and
-                                  biblio.biblionumber = subscription.biblionumber ".$byserial." order by title
-                                  ");
-    }
-    $sth->execute;
-    my @issuelist;
-    my $last_title;
-    my $odd=0;
-    my $count=0;
-    while (my $line = $sth->fetchrow_hashref) {
-	$odd++ unless $line->{title} eq $last_title;
-	$last_title = $line->{title} if ($line->{title});
-	$line->{planneddate} = format_date($line->{planneddate});
-	$line->{claimdate} = format_date($line->{claimdate});
-	$line->{'odd'} = 1 if $odd %2 ;
-	$count++;
-	push @issuelist,$line;
-    }
-    return $count, at issuelist;
-}
-
-=head2 removeMissingIssue
-
-=over 4
-
-removeMissingIssue($subscriptionid)
-
-this function removes an issue from being part of the missing string in 
-subscriptionlist.missinglist column
-
-called when a missing issue is found from the statecollection.pl file
-
-=back
-
-=cut
-sub removeMissingIssue {
-    my ($sequence,$subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT * FROM subscriptionhistory WHERE subscriptionid = ?");
-    $sth->execute($subscriptionid);
-    my $data = $sth->fetchrow_hashref;
-    my $missinglist = $data->{'missinglist'};
-    my $missinglistbefore = $missinglist;
-    # warn $missinglist." before";
-    $missinglist =~ s/($sequence)//;
-    # warn $missinglist." after";
-    if($missinglist ne $missinglistbefore){
-	$missinglist =~ s/\|\s\|/\|/g;
-	$missinglist =~ s/^\| //g;
-	$missinglist =~ s/\|$//g;
-	my $sth2= $dbh->prepare("UPDATE subscriptionhistory
-                                       SET missinglist = ?
-                                       WHERE subscriptionid = ?");
-        $sth2->execute($missinglist,$subscriptionid);
-    }
-}
-
-=head2 updateClaim
-
-=over 4
-
-&updateClaim($serialid)
-
-this function updates the time when a claim is issued for late/missing items
-
-called from claims.pl file
-
-=back
-
-=cut
-sub updateClaim {
-    my ($serialid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("UPDATE serial SET claimdate = now()
-                                   WHERE serialid = ?
-                                   ");
-    $sth->execute($serialid);
-}
-
-=head2 getsupplierbyserialid
-
-=over 4
-
-($result) = &getsupplierbyserialid($serialid)
-
-this function is used to find the supplier id given a serial id
-
-return :
-hashref containing serialid, subscriptionid, and aqbooksellerid
-
-=back
-
-=cut
-sub getsupplierbyserialid {
-    my ($serialid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT serialid, serial.subscriptionid, aqbooksellerid
-                                   FROM serial, subscription
-                                   WHERE serial.subscriptionid = subscription.subscriptionid
-                                   AND serialid = ?
-                                   ");
-    $sth->execute($serialid);
-    my $line = $sth->fetchrow_hashref;
-    my $result = $line->{'aqbooksellerid'};
-    return $result;
-}
-
-=head2 check_routing
-
-=over 4
-
-($result) = &check_routing($subscriptionid)
-
-this function checks to see if a serial has a routing list and returns the count of routingid
-used to show either an 'add' or 'edit' link
-=back
-
-=cut
-sub check_routing {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT count(routingid) routingids FROM subscriptionroutinglist, subscription
-                              WHERE subscription.subscriptionid = subscriptionroutinglist.subscriptionid
-                              AND subscription.subscriptionid = ? ORDER BY ranking ASC
-                              ");
-    $sth->execute($subscriptionid);
-    my $line = $sth->fetchrow_hashref;
-    my $result = $line->{'routingids'};
-    return $result;
-}
-
-=head2 addroutingmember
-
-=over 4
-
-&addroutingmember($bornum,$subscriptionid)
-
-this function takes a borrowernumber and subscriptionid and add the member to the
-routing list for that serial subscription and gives them a rank on the list
-of either 1 or highest current rank + 1
-
-=back
-
-=cut
-sub addroutingmember {
-    my ($bornum,$subscriptionid) = @_;
-    my $rank;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT max(ranking) rank FROM subscriptionroutinglist WHERE subscriptionid = ?");
-    $sth->execute($subscriptionid);
-    while(my $line = $sth->fetchrow_hashref){
-	if($line->{'rank'}>0){
-	    $rank = $line->{'rank'}+1;
-	} else {
-	    $rank = 1;
-	}
-    }
-    $sth = $dbh->prepare("INSERT INTO subscriptionroutinglist VALUES (null,?,?,?,null)");
-    $sth->execute($subscriptionid,$bornum,$rank);
-}
-
-=head2 reorder_members
-
-=over 4
-
-&reorder_members($subscriptionid,$routingid,$rank)
-
-this function is used to reorder the routing list
-
-it takes the routingid of the member one wants to re-rank and the rank it is to move to
-- it gets all members on list puts their routingid's into an array
-- removes the one in the array that is $routingid
-- then reinjects $routingid at point indicated by $rank
-- then update the database with the routingids in the new order
-
-=back
-
-=cut
-sub reorder_members {
-    my ($subscriptionid,$routingid,$rank) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT * FROM subscriptionroutinglist WHERE subscriptionid = ? ORDER BY ranking ASC");
-    $sth->execute($subscriptionid);
-    my @result;
-    while(my $line = $sth->fetchrow_hashref){
-	push(@result,$line->{'routingid'});
-    }
-    # To find the matching index
-    my $i;
-    my $key = -1; # to allow for 0 being a valid response
-    for ($i = 0; $i < @result; $i++) {
-	if ($routingid == $result[$i]) {
-	    $key = $i; # save the index
-	    last;
-	}
-    }
-    # if index exists in array then move it to new position
-    if($key > -1 && $rank > 0){
-	my $new_rank = $rank-1; # $new_rank is what you want the new index to be in the array
-	my $moving_item = splice(@result, $key, 1);
-	splice(@result, $new_rank, 0, $moving_item);
-    }
-    for(my $j = 0; $j < @result; $j++){
-	my $sth = $dbh->prepare("UPDATE subscriptionroutinglist SET ranking = '" . ($j+1) . "' WHERE routingid = '". $result[$j]."'");
-	$sth->execute;
-    }
-}
-
-=head2 delroutingmember
-
-=over 4
-
-&delroutingmember($routingid,$subscriptionid)
-
-this function either deletes one member from routing list if $routingid exists otherwise
-deletes all members from the routing list
-
-=back
-
-=cut
-sub delroutingmember {
-    # if $routingid exists then deletes that row otherwise deletes all with $subscriptionid
-    my ($routingid,$subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    if($routingid){
-	my $sth = $dbh->prepare("DELETE FROM subscriptionroutinglist WHERE routingid = ?");
-	$sth->execute($routingid);
-	reorder_members($subscriptionid,$routingid);
-    } else {
-	my $sth = $dbh->prepare("DELETE FROM subscriptionroutinglist WHERE subscriptionid = ?");
-	$sth->execute($subscriptionid);
-    }
-}
-
-=head2 getroutinglist
-
-=over 4
-
-($count, at routinglist) = &getroutinglist($subscriptionid)
-
-this gets the info from the subscriptionroutinglist for $subscriptionid
-
-return :
-a count of the number of members on routinglist
-the routinglist into a table. Each line of this table containts a ref to a hash which containts
-routingid - a unique id, borrowernumber, ranking, and biblionumber of subscription
-
-=back
-
-=cut
-sub getroutinglist {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT routingid, borrowernumber,
-                              ranking, biblionumber FROM subscriptionroutinglist, subscription
-                              WHERE subscription.subscriptionid = subscriptionroutinglist.subscriptionid
-                              AND subscription.subscriptionid = ? ORDER BY ranking ASC
-                              ");
-    $sth->execute($subscriptionid);
-    my @routinglist;
-    my $count=0;
-    while (my $line = $sth->fetchrow_hashref) {
-	$count++;
-	push(@routinglist,$line);
-    }
-    return ($count, at routinglist);
-}
-
-=head2 abouttoexpire
-
-=over 4
-
-$result = &abouttoexpire($subscriptionid)
-
-this function alerts you to the penultimate issue for a serial subscription
-
-returns 1 - if this is the penultimate issue
-returns 0 - if not
-
-=back
-
-=cut
-
-sub abouttoexpire { 
-     my ($subscriptionid) = @_;
-    my $dbh              = C4::Context->dbh;
-    my $subscription     = GetSubscription($subscriptionid);
-    my $expirationdate   = GetSubscriptionExpirationDate($subscriptionid);
-    my $sth =
-      $dbh->prepare(
-        "select max(planneddate) from serial where subscriptionid=?");
-    $sth->execute($subscriptionid);
-    my ($res) = $sth->fetchrow ;
-#     warn "date expiration : ".$expirationdate." date courante ".$res;
-    my @res=split /-/,$res;
-    my @endofsubscriptiondate=split/-/,$expirationdate;
-    my $per = $subscription->{'periodicity'};
-    my $x;
-    if ( $per == 1 ) {$x=7;}
-    if ( $per == 2 ) {$x=7; }
-    if ( $per == 3 ) {$x=14;}
-    if ( $per == 4 ) { $x = 21; }
-    if ( $per == 5 ) { $x = 31; }
-    if ( $per == 6 ) { $x = 62; }
-    if ( $per == 7 || $per == 8 ) { $x = 93; }
-    if ( $per == 9 )  { $x = 190; }
-    if ( $per == 10 ) { $x = 365; }
-    if ( $per == 11 ) { $x = 730; }
-    my @datebeforeend=Add_Delta_Days(  $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2],
-                  - (3 * $x)) if (@endofsubscriptiondate);
-            # warn "DATE BEFORE END: $datebeforeend";
-    return 1 if ( @res && 
-                  (@datebeforeend && 
-                      Delta_Days($res[0],$res[1],$res[2],
-                      $datebeforeend[0],$datebeforeend[1],$datebeforeend[2]) <= 0) && 
-                  (@endofsubscriptiondate && 
-                      Delta_Days($res[0],$res[1],$res[2],
-                      $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2]) >= 0) );
-    return 0;
-}
-
-
-
-=head2 GetNextDate
-
-=over 4
-
-($resultdate) = &GetNextDate($planneddate,$subscription)
-
-this function  takes the planneddate and will return the next issue's date and will skip dates if there
-exists an irregularity
-- eg if periodicity is monthly and $planneddate is 2007-02-10 but if March and April is to be 
-skipped then the returned date will be 2007-05-10
-
-return :
-$resultdate - then next date in the sequence
-
-=back
-
-=cut
-sub GetNextDate {
-    my ( $planneddate, $subscription ) = @_;
-    my @irreg = split( /\,/, $subscription->{irregularity} );
-
-    #date supposed to be in ISO.
-    
-    my ( $year, $month, $day ) = split(/-/, $planneddate);
-    $month=1 unless ($month);
-    $day=1 unless ($day);
-    my @resultdate;
-
-    #       warn "DOW $dayofweek";
-    if ( $subscription->{periodicity} == 1 ) {
-        my $dayofweek = Day_of_Week( $year,$month, $day );
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            $dayofweek = 0 if ( $dayofweek == 7 ); 
-            if ( in_array( ($dayofweek + 1), @irreg ) ) {
-                ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 1 );
-                $dayofweek++;
-            }
-        }
-        @resultdate = Add_Delta_Days($year,$month, $day , 1 );
-    }
-    if ( $subscription->{periodicity} == 2 ) {
-        my ($wkno,$year) = Week_of_Year( $year,$month, $day );
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($wkno!=51)?($wkno +1) % 52 :52)) {
-                ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 7 );
-                $wkno=(($wkno!=51)?($wkno +1) % 52 :52);
-            }
-        }
-        @resultdate = Add_Delta_Days( $year,$month, $day, 7);
-    }
-    if ( $subscription->{periodicity} == 3 ) {
-        my ($wkno,$year) = Week_of_Year( $year,$month, $day );
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($wkno!=50)?($wkno +2) % 52 :52)) {
-            ### BUGFIX was previously +1 ^
-                ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 14 );
-                $wkno=(($wkno!=50)?($wkno +2) % 52 :52);
-            }
-        }
-        @resultdate = Add_Delta_Days($year,$month, $day , 14 );
-    }
-    if ( $subscription->{periodicity} == 4 ) {
-        my ($wkno,$year) = Week_of_Year( $year,$month, $day );
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($wkno!=49)?($wkno +3) % 52 :52)) {
-                ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 21 );
-                $wkno=(($wkno!=49)?($wkno +3) % 52 :52);
-            }
-        }
-        @resultdate = Add_Delta_Days($year,$month, $day , 21 );
-    }
-    my $tmpmonth=$month;
-    if ( $subscription->{periodicity} == 5 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=11)?($tmpmonth +1) % 12 :12)) {
-                ($year,$month,$day) = Add_Delta_YMD($year,$month, $day ,0,1,0 );
-                $tmpmonth=(($tmpmonth!=11)?($tmpmonth +1) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YMD($year,$month, $day ,0,1,0 );
-    }
-    if ( $subscription->{periodicity} == 6 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=10)?($tmpmonth +2) % 12 :12)) {
-                ($year,$month,$day) = Add_Delta_YMD($year,$month, $day ,0,2,0 );
-                $tmpmonth=(($tmpmonth!=10)?($tmpmonth + 2) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YMD($year,$month, $day, 0, 2,0 );
-    }
-    if ( $subscription->{periodicity} == 7 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=9)?($tmpmonth +3) % 12 :12)) {
-                ($year,$month,$day) = Add_Delta_YMD($year,$month, $day, 0, 3,0 );
-                $tmpmonth=(($tmpmonth!=9)?($tmpmonth + 3) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YMD($year,$month, $day, 0, 3, 0);
-    }
-    if ( $subscription->{periodicity} == 8 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=9)?($tmpmonth +3) % 12 :12)) {
-                ($year,$month,$day) = Add_Delta_YMD($year,$month, $day, 0, 3,0 );
-                $tmpmonth=(($tmpmonth!=9)?($tmpmonth + 3) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YMD($year,$month, $day, 0, 3, 0);
-    }
-    if ( $subscription->{periodicity} == 9 ) {
-        for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-            if ( $irreg[$i] == (($tmpmonth!=9)?($tmpmonth +3) % 12 :12)) {
-            ### BUFIX Seems to need more Than One ?
-                ($year,$month,$day) = Add_Delta_YM($year,$month, $day, 0, 6 );
-                $tmpmonth=(($tmpmonth!=6)?($tmpmonth + 6) % 12 :12);
-            }
-        }
-        @resultdate = Add_Delta_YM($year,$month, $day, 0, 6);
-    }
-    if ( $subscription->{periodicity} == 10 ) {
-        @resultdate = Add_Delta_YM($year,$month, $day, 1, 0 );
-    }
-    if ( $subscription->{periodicity} == 11 ) {
-        @resultdate = Add_Delta_YM($year,$month, $day, 2, 0 );
-    }
-    my $resultdate=sprintf("%04d-%02d-%02d",$resultdate[0],$resultdate[1],$resultdate[2]);
-#     warn "dateNEXTSEQ : ".$resultdate;
-    return "$resultdate";
-}
-
-
-	
-1;
-__END__

Index: modules/C4/Stats.pm
===================================================================
RCS file: modules/C4/Stats.pm
diff -N modules/C4/Stats.pm
--- modules/C4/Stats.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,245 +0,0 @@
-package C4::Stats;
-
-# $Id: Stats.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-# Modified by TG
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-
-use C4::Context;
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Stats - Update Koha statistics (log)
-
-=head1 SYNOPSIS
-
-  use C4::Stats;
-
-=head1 DESCRIPTION
-
-The C<&UpdateStats> function adds an entry to the statistics table in
-the Koha database, which acts as an activity log.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&UpdateStats &statsreport &TotalOwing
-&TotalPaid &getcharges &Getpaidbranch &unfilledreserves &getcredits &getinvoices);
-
-=item UpdateStats
-
-  &UpdateStats($env, $branch, $type, $value, $other, $itemnumber,
-               $itemtype, $borrowernumber);
-
-Adds a line to the statistics table of the Koha database. In effect,
-it logs an event.
-
-C<$branch>, C<$type>, C<$value>, C<$other>, C<$itemnumber>,
-C<$itemtype>, and C<$borrowernumber> correspond to the fields of the
-statistics table in the Koha database.
-
-If C<$branch> is the empty string, the branch code will be taken from
-C<$env-E<gt>{branchcode}>.
-
-C<$env-E<gt>{usercode}> specifies the value of the C<usercode> field.
-
-=cut
-#'
-sub UpdateStats {
-        #module to insert stats data into stats table
-        my ($env,$branch,$type,$amount,$other,$itemnum,$itemtype,$borrowernumber,$accountno)=@_;
-        my $dbh = C4::Context->dbh;
-	$env=C4::Context->userenv unless $env;
-        if ($branch eq ''){
-                $branch=$env->{'branchcode'};
-        }
-        my $user = C4::Context->userenv;
-#        print $borrowernumber;
-	my $userid=$user->{'cardnumber'} if $user;
-        # FIXME - Use $dbh->do() instead
-        my $sth=$dbh->prepare("Insert into statistics (datetime,branch,type,usercode,value,
-                                        other,itemnumber,itemtype,borrowernumber,proccode) values (now(),?,?,?,?,?,?,?,?,?)");
-        $sth->execute($branch,$type,$userid,$amount,$other,$itemnum,$itemtype,$borrowernumber,$accountno);
-        $sth->finish;
-}
-
-# Otherwise, it'd need a POD.
-sub TotalPaid {
-        my ($time,$time2)=@_;
-        $time2=$time unless $time2;
-        my $dbh = C4::Context->dbh;
-
-
-        my $query="Select * from accountlines,borrowers where (accounttype = 'Pay' or accounttype='W')
-                                        and accountlines.borrowernumber = borrowers.borrowernumber";
-        my @bind = ();
-        if ($time eq 'today'){
-                $query .= " and date = now()";
-        } else {
-                $query.=" and date>=? and date<=?";
-                @bind = ($time,$time2);
-        }
-
-      
-
-
-           $query.=" order by timestamp";
-
-          # print $query;
-
-        my $sth=$dbh->prepare($query);
-
-       # $sth->execute();
-         $sth->execute(@bind);
-        my @results;
-        my $i=0;
-        while (my $data=$sth->fetchrow_hashref){
-                $results[$i]=$data;
-                $i++;
-        }
-        $sth->finish;
-        #  print $query;
-        return(@results);
-}
-
-# Otherwise, it needs a POD.
-sub getcharges{
-        my($borrowerno,$offset,$accountno)=@_;
-        my $dbh = C4::Context->dbh;
-        my $query="";
-        my $sth;
-
-        # getcharges is now taking accountno. as an argument
-        if ($offset){
-              $sth=$dbh->prepare("Select * from accountlines where borrowernumber=?
-              and accountno = ? and amount>0");
-              $sth->execute($borrowerno,$offset);
-
-        # this bit left in for old 2 arg usage of getcharges
-        } else {
-                 $sth=$dbh->prepare("Select * from accountlines where borrowernumber=?
-              and accountno = ?");
-              $sth->execute($borrowerno,$accountno);
-        }
-
-        #  print $query,"<br>";
-        my $i=0;
-        my @results;
-        while (my $data=$sth->fetchrow_hashref){
-        #    if ($data->{'timestamp'} == $timestamp){
-                $results[$i]=$data;
-                $i++;
-        #    }
-        }
-        return(@results);
-}
-
-# Otherwise, it needs a POD.
-sub getcredits{
-        my ($date,$date2)=@_;
-        my $dbh = C4::Context->dbh;
-
-
-
-        my $sth=$dbh->prepare("Select * from accountlines,borrowers where (( (accounttype <> 'Pay'))
-                                   and amount < 0  and accountlines.borrowernumber = borrowers.borrowernumber
-                                   and date >=?  and date <=?)");
-        $sth->execute($date, $date2);
-
-        my $i=0;
-        my @results;
-        while (my $data=$sth->fetchrow_hashref){
-                $results[$i]=$data;
-                $i++;
-        }
-        return(@results);
-}
-
-sub getinvoices{
-        my ($date,$date2)=@_;
-        my $dbh = C4::Context->dbh;
-        my $sth=$dbh->prepare("Select * from accountlines,borrowers where amount>0 and amountoutstanding > 0  and accountlines.borrowernumber = borrowers.borrowernumber
-                                   and (date >=?  and date <=?)");
-        $sth->execute($date, $date2);
-
-        my $i=0;
-        my @results;
-        while (my $data=$sth->fetchrow_hashref){
-                $results[$i]=$data;
-                $i++;
-        }
-        return(@results);
-}
-
-
-# Otherwise, this needs a POD.
-sub Getpaidbranch{
-        my($date,$borrno)=@_;
-        my $dbh = C4::Context->dbh;
-        my $sth=$dbh->prepare("select * from statistics where type='payment' and datetime >? and  borrowernumber=?");
-        $sth->execute($date,$borrno);
-        #  print $query;
-        my $data=$sth->fetchrow_hashref;
-        $sth->finish;
-        return($data->{'branch'});
-}
-
-# FIXME - This is only used in reservereport.pl and reservereport.xls,
-# neither of which is used.
-# Otherwise, it needs a POD.
-sub unfilledreserves {
-        my $dbh = C4::Context->dbh;
-      
-        my $i=0;
-        my @results;
-       
-   my     $sth=$dbh->prepare("select *,biblio.title from reserves,biblio,borrowers where (found <> '1' or found is NULL) and cancellationdate
-                is NULL and biblio.biblionumber=reserves.biblionumber  and
-                reserves.borrowernumber=borrowers.borrowernumber
-                order by
-                reserves.reservedate,biblio.title");
-        $sth->execute;
-        while (my $data=$sth->fetchrow_hashref){
-                $results[$i]=$data;
-                $i++;
-        }
-        $sth->finish;
-        return($i,\@results);
-}
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut
-

Index: modules/C4/Suggestions.pm
===================================================================
RCS file: modules/C4/Suggestions.pm
diff -N modules/C4/Suggestions.pm
--- modules/C4/Suggestions.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,466 +0,0 @@
-package C4::Suggestions;
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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
-
-# $Id: Suggestions.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-use strict;
-require Exporter;
-use C4::Context;
-use C4::Output;
-use Mail::Sendmail;
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g;
-  shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
-
-=head1 NAME
-
-C4::Suggestions - Some useful functions for dealings with suggestions.
-
-=head1 SYNOPSIS
-
-use C4::Suggestions;
-
-=head1 DESCRIPTION
-
-=over 4
-
-The functions in this module deal with the suggestions in OPAC and in librarian interface
-
-A suggestion is done in the OPAC. It has the status "ASKED"
-
-When a librarian manages the suggestion, he can set the status to "REJECTED" or "ACCEPTED".
-
-When the book is ordered, the suggestion status becomes "ORDERED"
-
-When a book is ordered and arrived in the library, the status becomes "AVAILABLE"
-
-All suggestions of a borrower can be seen by the borrower itself.
-Suggestions done by other borrowers can be seen when not "AVAILABLE"
-
-=back
-
-=head1 FUNCTIONS
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-    &NewSuggestion
-    &SearchSuggestion
-    &GetSuggestion
-    &DelSuggestion
-    &CountSuggestion
-    &ModStatus
-    &ConnectSuggestionAndBiblio
-    &GetSuggestionFromBiblionumber
- );
-
-=head2 SearchSuggestion
-
-=over 4
-
-(\@array) = &SearchSuggestion($user,$author,$title,$publishercode,$status,$suggestedbyme)
-
-searches for a suggestion
-
-return :
-C<\@array> : the suggestions found. Array of hash.
-Note the status is stored twice :
-* in the status field
-* as parameter ( for example ASKED => 1, or REJECTED => 1) . This is for template & translation purposes.
-
-=back
-
-=cut
-
-sub SearchSuggestion  {
-    my ($user,$author,$title,$publishercode,$status,$suggestedbyme)=@_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-    SELECT suggestions.*,
-        U1.surname   AS surnamesuggestedby,
-        U1.firstname AS firstnamesuggestedby,
-        U2.surname   AS surnamemanagedby,
-        U2.firstname AS firstnamemanagedby
-    FROM suggestions
-    LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber
-    LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber
-    WHERE 1=1 |;
-
-    my @sql_params;
-    if ($author) {
-       push @sql_params,"%".$author."%";
-       $query .= " and author like ?";
-    }
-    if ($title) {
-        push @sql_params,"%".$title."%";
-        $query .= " and suggestions.title like ?";
-    }
-    if ($publishercode) {
-        push @sql_params,"%".$publishercode."%";
-        $query .= " and publishercode like ?";
-    }
-    if ($status) {
-        push @sql_params,$status;
-        $query .= " and status=?";
-    }
-
-    if (C4::Context->preference("IndependantBranches")) {
-        my $userenv = C4::Context->userenv;
-        if ($userenv) {
-            unless ($userenv->{flags} == 1){
-                push @sql_params,$userenv->{branch};
-                $query .= " and (U1.branchcode = ? or U1.branchcode ='')";
-            }
-        }
-    }
-    if ($suggestedbyme) {
-        unless ($suggestedbyme eq -1) {
-            push @sql_params,$user;
-            $query .= " and suggestedby=?";
-        }
-    } else {
-        $query .= " and managedby is NULL";
-    }
-    my $sth=$dbh->prepare($query);
-    $sth->execute(@sql_params);
-    my @results;
-    my $even=1; # the even variable is used to set even / odd lines, for highlighting
-    while (my $data=$sth->fetchrow_hashref){
-        $data->{$data->{STATUS}} = 1;
-        if ($even) {
-            $even=0;
-            $data->{even}=1;
-        } else {
-            $even=1;
-        }
-        push(@results,$data);
-    }
-    return (\@results);
-}
-
-=head2 GetSuggestion
-
-=over 4
-
-\%sth = &GetSuggestion($suggestionid)
-
-this function get the detail of the suggestion $suggestionid (input arg)
-
-return :
-    the result of the SQL query as a hash : $sth->fetchrow_hashref.
-
-=back
-
-=cut
-sub GetSuggestion {
-    my ($suggestionid) = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq|
-        SELECT *
-        FROM   suggestions
-        WHERE  suggestionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($suggestionid);
-    return($sth->fetchrow_hashref);
-}
-
-=head2 GetSuggestionFromBiblionumber
-
-=over 4
-
-$suggestionid = &GetSuggestionFromBiblionumber($dbh,$biblionumber)
-
-Get a suggestion from it's biblionumber.
-
-return :
-the id of the suggestion which is related to the biblionumber given on input args.
-
-=back
-
-=cut
-sub GetSuggestionFromBiblionumber {
-    my ($dbh,$biblionumber) = @_;
-    my $query = qq|
-        SELECT suggestionid
-        FROM   suggestions
-        WHERE  biblionumber=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber);
-    my ($suggestionid) = $sth->fetchrow;
-    return $suggestionid;
-}
-
-
-=head2 CountSuggestion
-
-=over 4
-
-&CountSuggestion($status)
-
-Count the number of suggestions with the status given on input argument.
-the arg status can be :
-
-=over
-
-=over
-
-=item * ASKED : asked by the user, not dealed by the librarian
-
-=item * ACCEPTED : accepted by the librarian, but not yet ordered
-
-=item * REJECTED : rejected by the librarian (definitive status)
-
-=item * ORDERED : ordered by the librarian (acquisition module)
-
-=back
-
-=back
-
-return :
-the number of suggestion with this status.
-
-=back
-
-=cut
-sub CountSuggestion {
-    my ($status) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if (C4::Context->preference("IndependantBranches")){
-        my $userenv = C4::Context->userenv;
-        if ($userenv->{flags} == 1){
-            my $query = qq |
-                SELECT count(*)
-                FROM   suggestions
-                WHERE  status=?
-            |;
-            $sth = $dbh->prepare($query);
-            $sth->execute($status);
-        }
-        else {
-            my $query = qq |
-                SELECT count(*)
-                FROM suggestions,borrowers
-                WHERE status=?
-                AND borrowers.borrowernumber=suggestions.suggestedby
-                AND (borrowers.branchcode='' OR borrowers.branchcode =?)
-            |;
-            $sth = $dbh->prepare($query);
-            $sth->execute($status,$userenv->{branch});
-        }
-    }
-    else {
-        my $query = qq |
-            SELECT count(*)
-            FROM suggestions
-            WHERE status=?
-        |;
-         $sth = $dbh->prepare($query);
-        $sth->execute($status);
-    }
-    my ($result) = $sth->fetchrow;
-    return $result;
-}
-
-=head2 NewSuggestion
-
-
-=over 4
-
-&NewSuggestion($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber)
-
-Insert a new suggestion on database with value given on input arg.
-
-=back
-
-=cut
-sub NewSuggestion {
-    my ($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber) = @_;
-    my $dbh = C4::Context->dbh;
-
-    my $query = qq |
-        INSERT INTO suggestions
-            (status,suggestedby,title,author,publishercode,note,copyrightdate,
-            volumedesc,publicationyear,place,isbn,biblionumber)
-        VALUES ('ASKED',?,?,?,?,?,?,?,?,?,?,?)
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber);
-}
-
-=head2 ModStatus
-
-=over 4
-
-&ModStatus($suggestionid,$status,$managedby,$biblionumber)
-
-Modify the status (status can be 'ASKED', 'ACCEPTED', 'REJECTED', 'ORDERED')
-and send a mail to notify the user that did the suggestion.
-
-Note that there is no function to modify a suggestion : only the status can be modified, thus the name of the function.
-
-=back
-
-=cut
-sub ModStatus {
-    my ($suggestionid,$status,$managedby,$biblionumber,$input) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth;
-    if ($managedby>0) {
-        if ($biblionumber) {
-        my $query = qq|
-            UPDATE suggestions
-            SET    status=?,managedby=?,biblionumber=?
-            WHERE  suggestionid=?
-        |;
-        $sth = $dbh->prepare($query);
-        $sth->execute($status,$managedby,$biblionumber,$suggestionid);
-        } else {
-            my $query = qq|
-                UPDATE suggestions
-                SET    status=?,managedby=?
-                WHERE  suggestionid=?
-            |;
-            $sth = $dbh->prepare($query);
-            $sth->execute($status,$managedby,$suggestionid);
-        }
-   } else {
-        if ($biblionumber) {
-            my $query = qq|
-                UPDATE suggestions
-                SET    status=?,biblionumber=?
-                WHERE  suggestionid=?
-            |;
-            $sth = $dbh->prepare($query);
-            $sth->execute($status,$biblionumber,$suggestionid);
-        }
-        else {
-            my $query = qq|
-                UPDATE suggestions
-                SET    status=?
-                WHERE  suggestionid=?
-            |;
-            $sth = $dbh->prepare($query);
-            $sth->execute($status,$suggestionid);
-        }
-    }
-    # check mail sending.
-    my $queryMail = qq|
-        SELECT suggestions.*,
-            boby.surname AS bysurname,
-            boby.firstname AS byfirstname,
-            boby.emailaddress AS byemail,
-            lib.surname AS libsurname,
-            lib.firstname AS libfirstname,
-            lib.emailaddress AS libemail
-        FROM suggestions
-            LEFT JOIN borrowers AS boby ON boby.borrowernumber=suggestedby
-            LEFT JOIN borrowers AS lib ON lib.borrowernumber=managedby
-        WHERE suggestionid=?
-    |;
-    $sth = $dbh->prepare($queryMail);
-    $sth->execute($suggestionid);
-    my $emailinfo = $sth->fetchrow_hashref;
-if ($emailinfo->{byemail}){
-    my $template = gettemplate("suggestion/mail_suggestion_$status.tmpl","intranet",$input);
-
-    $template->param(
-        byemail => $emailinfo->{byemail},
-        libemail => $emailinfo->{libemail},
-        status => $emailinfo->{status},
-        title => $emailinfo->{title},
-        author =>$emailinfo->{author},
-        libsurname => $emailinfo->{libsurname},
-        libfirstname => $emailinfo->{libfirstname},
-        byfirstname => $emailinfo->{byfirstname},
-        bysurname => $emailinfo->{bysurname},
-    );
-    my %mail = (
-        To => $emailinfo->{byemail},
-        From => $emailinfo->{libemail},
-        Subject => 'Koha suggestion',
-        Message => "".$template->output
-    );
-    sendmail(%mail);
-}
-}
-
-=head2 ConnectSuggestionAndBiblio
-
-=over 4
-&ConnectSuggestionAndBiblio($suggestionid,$biblionumber)
-
-connect a suggestion to an existing biblio
-
-=back
-
-=cut
-sub ConnectSuggestionAndBiblio {
-    my ($suggestionid,$biblionumber) = @_;
-    my $dbh=C4::Context->dbh;
-    my $query = qq |
-        UPDATE suggestions
-        SET    biblionumber=?
-        WHERE  suggestionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($biblionumber,$suggestionid);
-}
-
-=head2 DelSuggestion
-
-=over 4
-
-&DelSuggestion($borrowernumber,$suggestionid)
-
-Delete a suggestion. A borrower can delete a suggestion only if he is its owner.
-
-=back
-
-=cut
-
-sub DelSuggestion {
-    my ($borrowernumber,$suggestionid) = @_;
-    my $dbh = C4::Context->dbh;
-    # check that the suggestion comes from the suggestor
-    my $query = qq |
-        SELECT suggestedby
-        FROM   suggestions
-        WHERE  suggestionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($suggestionid);
-    my ($suggestedby) = $sth->fetchrow;
-    if ($suggestedby eq $borrowernumber) {
-        my $queryDelete = qq|
-            DELETE FROM suggestions
-            WHERE suggestionid=?
-        |;
-        $sth = $dbh->prepare($queryDelete);
-        $sth->execute($suggestionid);
-    }
-}
-
-1;
-__END__;
\ No newline at end of file

Index: modules/C4/Z3950.pm
===================================================================
RCS file: modules/C4/Z3950.pm
diff -N modules/C4/Z3950.pm
--- modules/C4/Z3950.pm	10 Mar 2007 01:35:34 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,380 +0,0 @@
-package C4::Z3950;
-
-# $Id: Z3950.pm,v 1.1.2.1 2007/03/10 01:35:34 tgarip1957 Exp $
-
-# Routines for handling Z39.50 lookups
-
-# Koha library project  www.koha.org
-
-# Licensed under the GPL
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-
-# standard or CPAN modules used
-
-# Koha modules used
-use C4::Context;
-use C4::Input;
-use C4::Biblio;
-
-#------------------
-
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Z3950 - Functions dealing with Z39.50 queries
-
-=head1 SYNOPSIS
-
-  use C4::Z3950;
-
-=head1 DESCRIPTION
-
-This module contains functions for looking up Z39.50 servers, and for
-entering Z39.50 lookup requests.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-	&getz3950servers
-	&z3950servername
-	&addz3950queue
-	&checkz3950searchdone
-);
-
-#------------------------------------------------
-=item getz3950servers
-
-  @servers= &getz3950servers(checked);
-
-Returns the list of declared z3950 servers
-
-C<$checked> should always be true (1) => returns only active servers.
-If 0 => returns all servers
-
-=cut
-sub getz3950servers {
-	my ($checked) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth;
-	if ($checked) {
-		$sth = $dbh->prepare("select * from z3950servers where checked=1");
-	} else {
-		$sth = $dbh->prepare("select * from z3950servers");
-	}
-	my @result;
-	while ( my ($host, $port, $db, $userid, $password,$servername) = $sth->fetchrow ) {
-		push @result, "$servername/$host\:$port/$db/$userid/$password";
-	} # while
-	return @result;
-}
-
-=item z3950servername
-
-  $name = &z3950servername($dbh, $server_id, $default_name);
-
-Looks up a Z39.50 server by ID number, and returns its full name. If
-the server is not found, returns C<$default_name>.
-
-C<$server_id> is the Z39.50 server ID to look up.
-
-C<$dbh> is ignored.
-
-=cut
-#'
-
-sub z3950servername {
-	# inputs
-	my ($srvid,		# server id number
-		$default,)=@_;
-	# return
-	my $longname;
-	#----
-
-	my $dbh = C4::Context->dbh;
-
-	my $sti=$dbh->prepare("select name from z3950servers where id=?");
-
-	$sti->execute($srvid);
-	if ( ! $sti->err ) {
-		($longname)=$sti->fetchrow;
-	}
-	if (! $longname) {
-		$longname="$default";
-	}
-		return $longname;
-} # sub z3950servername
-
-#---------------------------------------
-
-=item addz3950queue
-
-  $errmsg = &addz3950queue($query, $type, $request_id, @servers);
-
-Adds a Z39.50 search query for the Z39.50 server to look up.
-
-C<$query> is the term to search for.
-
-C<$type> is the query type, e.g. C<isbn>, C<lccn>, etc.
-
-C<$request_id> is a unique string that will identify this query.
-
-C<@servers> is a list of servers to query (obviously, this can be
-given either as an array, or as a list of scalars). Each element may
-be either a Z39.50 server ID from the z3950server table of the Koha
-database, the string C<DEFAULT> or C<CHECKED>, or a complete server
-specification containing a colon.
-
-C<DEFAULT> and C<CHECKED> are synonymous, and refer to those servers
-in the z3950servers table whose 'checked' field is set and non-NULL.
-
-Once the query has been submitted to the Z39.50 daemon,
-C<&addz3950queue> sends a SIGHUP to the daemon to tell it to process
-this new request.
-
-C<&addz3950queue> returns an error message. If it was successful, the
-error message is the empty string.
-
-=cut
-#'
-sub addz3950queue {
-	use strict;
-	# input
-	my (
-		$query,		# value to look up
-		$type,			# type of value ("isbn", "lccn", "title", "author", "keyword")
-		$requestid,	# Unique value to prevent duplicate searches from multiple HTML form submits
-		@z3950list,	# list of z3950 servers to query
-	)=@_;
-	# Returns:
-	my $error;
-
-	my (
-		$sth,
-		@serverlist,
-		$server,
-		$failed,
-		$servername,
-	);
-
-	# FIXME - Should be configurable, probably in /etc/koha.conf.
-	my $pidfile='/var/log/koha/processz3950queue.pid';
-
-	$error="";
-
-	my $dbh = C4::Context->dbh;
-	# list of servers: entry can be a fully qualified URL-type entry
-	#   or simply just a server ID number.
-	foreach $server (@z3950list) {
-		if ($server =~ /:/ ) {
-			push @serverlist, $server;
-		} elsif ($server eq 'DEFAULT' || $server eq 'CHECKED' ) {
-			$sth=$dbh->prepare("select host,port,db,userid,password ,name,syntax from z3950servers where checked <> 0 ");
-			$sth->execute;
-			while ( my ($host, $port, $db, $userid, $password,$servername,$syntax) = $sth->fetchrow ) {
-				push @serverlist, "$servername/$host\:$port/$db/$userid/$password/$syntax";
-			} # while
-		} else {
-			$sth=$dbh->prepare("select host,port,db,userid,password,syntax from z3950servers where id=? ");
-			$sth->execute($server);
-			my ($host, $port, $db, $userid, $password,$syntax) = $sth->fetchrow;
-			push @serverlist, "$server/$host\:$port/$db/$userid/$password/$syntax";
-		}
-	}
-
-	my $serverlist='';
-
-	$serverlist = join("|", @serverlist);
-# 	chop $serverlist;
-
-	# FIXME - Is this test supposed to test whether @serverlist is
-	# empty? If so, then a) there are better ways to do that in
-	# Perl (e.g., "if (@serverlist eq ())"), and b) it doesn't
-	# work anyway, since it checks whether $serverlist is composed
-	# of one or more spaces, which is never the case, not even
-	# when there are 0 or 1 elements in @serverlist.
-	if ( $serverlist !~ /^ +$/ ) {
-		# Don't allow reinsertion of the same request identifier.
-		$sth=$dbh->prepare("select identifier from z3950queue
-			where identifier=?");
-		$sth->execute($requestid);
-		if ( ! $sth->rows) {
-			$sth=$dbh->prepare("insert into z3950queue (term,type,servers, identifier) values (?, ?, ?, ?)");
-			$sth->execute($query, $type, $serverlist, $requestid);
-			if ( -r $pidfile ) {
-				# FIXME - Perl is good at opening files. No need to
-				# spawn a separate 'cat' process.
-				my $pid=`cat $pidfile`;
-				chomp $pid;
-				warn "PID : $pid";
-				# Kill -HUP the Z39.50 daemon to tell it to process
-				# this query.
-				my $processcount=kill 1, $pid;
-				if ($processcount==0) {
-					$error.="Z39.50 search daemon error: no process signalled. ";
-				}
-			} else {
-				# FIXME - Error-checking like this should go close
-				# to the test.
-				$error.="No Z39.50 search daemon running: no file $pidfile. ";
-			} # if $pidfile
-		} else {
-			# FIXME - Error-checking like this should go close
-			# to the test.
-			$error.="Duplicate request ID $requestid. ";
-		} # if rows
-	} else {
-		# FIXME - Error-checking like this should go close to the
-		# test. I.e.,
-		#	return "No Z39.50 search servers specified. "
-		#		if @serverlist eq ();
-
-		# server list is empty
-		$error.="No Z39.50 search servers specified. ";
-	} # if serverlist empty
-
-	return $error;
-
-} # sub addz3950queue
-
-=item &checkz3950searchdone
-
-  $numberpending= &	&checkz3950searchdone($random);
-
-Returns the number of pending z3950 requests
-
-C<$random> is the random z3950 query number.
-
-=cut
-sub checkz3950searchdone {
-	my ($z3950random) = @_;
-	my $dbh = C4::Context->dbh;
-	# first, check that the deamon already created the requests...
-	my $sth = $dbh->prepare("select count(*) from z3950queue,z3950results where z3950queue.id = z3950results.queryid and z3950queue.identifier=?");
-	$sth->execute($z3950random);
-	my ($result) = $sth->fetchrow;
-	if ($result eq 0) { # search not yet begun => should be searches to do !
-		return "??";
-	}
-	# second, count pending requests
-	$sth = $dbh->prepare("select count(*) from z3950queue,z3950results where z3950queue.id = z3950results.queryid and z3950results.enddate is null and z3950queue.identifier=?");
-	$sth->execute($z3950random);
-	($result) = $sth->fetchrow;
-	return $result;
-}
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut
-
-#--------------------------------------
-# $Log: Z3950.pm,v $
-# Revision 1.1.2.1  2007/03/10 01:35:34  tgarip1957
-# fresh files for rel_TG
-#
-# Revision 1.13  2006/09/06 16:21:03  tgarip1957
-# Clean up before final commits
-#
-# Revision 1.10  2003/10/01 15:08:14  tipaul
-# fix fog bug #622 : processz3950queue fails
-#
-# Revision 1.9  2003/04/29 16:50:51  tipaul
-# really proud of this commit :-)
-# z3950 search and import seems to works fine.
-# Let me explain how :
-# * a "search z3950" button is added in the addbiblio template.
-# * when clicked, a popup appears and z3950/search.pl is called
-# * z3950/search.pl calls addz3950search in the DB
-# * the z3950 daemon retrieve the records and stores them in z3950results AND in marc_breeding table.
-# * as long as there as searches pending, the popup auto refresh every 2 seconds, and says how many searches are pending.
-# * when the user clicks on a z3950 result => the parent popup is called with the requested biblio, and auto-filled
-#
-# Note :
-# * character encoding support : (It's a nightmare...) In the z3950servers table, a "encoding" column has been added. You can put "UNIMARC" or "USMARC" in this column. Depending on this, the char_decode in C4::Biblio.pm replaces marc-char-encode by an iso 8859-1 encoding. Note that in the breeding import this value has been added too, for a better support.
-# * the marc_breeding and z3950* tables have been modified : they have an encoding column and the random z3950 number is stored too for convenience => it's the key I use to list only requested biblios in the popup.
-#
-# Revision 1.8  2003/04/29 08:09:45  tipaul
-# z3950 support is coming...
-# * adding a syntax column in z3950 table = this column will say wether the z3950 must be called with PerferedRecordsyntax => USMARC or PerferedRecordsyntax => UNIMARC. I tried some french UNIMARC z3950 servers, and some only send USMARC, some only UNIMARC, some can answer with both.
-# Note this is a 1st draft. More to follow (today ? I hope).
-#
-# Revision 1.7  2003/02/19 01:01:06  wolfpac444
-# Removed the unecessary $dbh argument from being passed.
-# Resolved a few minor FIXMEs.
-#
-# Revision 1.6  2002/10/13 08:30:53  arensb
-# Deleted unused variables.
-# Removed trailing whitespace.
-#
-# Revision 1.5  2002/10/13 06:13:23  arensb
-# Removed bogus #! line (this isn't a script!)
-# Removed unused global variables.
-# Added POD.
-# Added some explanatory comments.
-# Added some FIXME comments.
-#
-# Revision 1.4  2002/10/11 12:35:35  arensb
-# Replaced &requireDBI with C4::Context->dbh
-#
-# Revision 1.3  2002/08/14 18:12:52  tonnesen
-# Added copyright statement to all .pl and .pm files
-#
-# Revision 1.2  2002/07/02 20:31:33  tonnesen
-# module added from rel-1-2 branch
-#
-# Revision 1.1.2.5  2002/06/29 17:33:47  amillar
-# Allow DEFAULT as input to addz3950search.
-# Check for existence of pid file (cat crashed otherwise).
-# Return error messages in addz3950search.
-#
-# Revision 1.1.2.4  2002/06/28 18:07:27  tonnesen
-# marcimport.pl will print an error message if it can not signal the
-# processz3950queue program.  The message contains instructions for starting the
-# daemon.
-#
-# Revision 1.1.2.3  2002/06/28 17:45:39  tonnesen
-# z3950queue now listens for a -HUP signal before processing the queue.  Z3950.pm
-# sends the -HUP signal when queries are added to the queue.
-#
-# Revision 1.1.2.2  2002/06/26 20:54:31  tonnesen
-# use warnings breaks on perl 5.005...
-#
-# Revision 1.1.2.1  2002/06/26 07:26:41  amillar
-# New module for Z39.50 searching
-#

Index: modules/C4/Barcodes/PrinterConfig.pm
===================================================================
RCS file: modules/C4/Barcodes/PrinterConfig.pm
diff -N modules/C4/Barcodes/PrinterConfig.pm
--- modules/C4/Barcodes/PrinterConfig.pm	10 Mar 2007 01:36:44 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,220 +0,0 @@
-package C4::Barcodes::PrinterConfig;
-
-# 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 strict;
-require Exporter;
-use vars qw($VERSION @EXPORT);
-
-use PDF::API2;
-use PDF::API2::Page;
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Barcodes::PrinterConfig - Koha module dealing with labels in a PDF.
-
-=head1 SYNOPSIS
-
-	use C4::Barcodes::PrinterConfig;
-
-=head1 DESCRIPTION
-
-This package is used to deal with labels in a pdf file. Giving some parameters,
-this package contains several functions to handle every label considering the 
-environment of the pdf file.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at EXPORT = qw(&labelsPage &getLabelPosition setPositionsForX setPositionsForY);
-
-my @positionsForX; # Takes all the X positions of the pdf file.
-my @positionsForY; # Takes all the Y positions of the pdf file.
-my $firstLabel = 1; # Test if the label passed as a parameter is the first label to be printed into the pdf file.
-
-=item setPositionsForX
-
-	C4::Barcodes::PrinterConfig::setPositionsForX($marginLeft, $labelWidth, $columns, $pageType);
-
-Calculate and stores all the X positions across the pdf page.
-
-C<$marginLeft> Indicates how much left margin do you want in your page type.
-
-C<$labelWidth> Indicates the width of the label that you are going to use.
-
-C<$columns> Indicates how many columns do you want in your page type.
-
-C<$pageType> Page type to print (eg: a4, legal, etc).
-
-=cut
-#'
-sub setPositionsForX {
-	my ($marginLeft, $labelWidth, $columns, $pageType) = @_;
-	my $defaultDpi = 72/25.4; # By default we know 25.4 mm -> 1 inch -> 72 dots per inch
-	my $whereToStart = ($marginLeft + ($labelWidth/2));
-	my $firstLabel = $whereToStart*$defaultDpi;
-	my $spaceBetweenLabels = $labelWidth*$defaultDpi;
-	my @positions;
-	for (my $i = 0; $i < $columns ; $i++) {
-		push @positions, ($firstLabel+($spaceBetweenLabels*$i));
-	}
-	@positionsForX = @positions;
-}
-
-=item setPositionsForY
-
-	C4::Barcodes::PrinterConfig::setPositionsForY($marginBottom, $labelHeigth, $rows, $pageType);
-
-Calculate and stores all tha Y positions across the pdf page.
-
-C<$marginBottom> Indicates how much bottom margin do you want in your page type.
-
-C<$labelHeigth> Indicates the height of the label that you are going to use.
-
-C<$rows> Indicates how many rows do you want in your page type.
-
-C<$pageType> Page type to print (eg: a4, legal, etc).
-
-=cut
-#'
-sub setPositionsForY {
-	my ($marginBottom, $labelHeigth, $rows, $pageType) = @_;
-	my $defaultDpi = 72/25.4; # By default we know 25.4 mm -> 1 inch -> 72 dots per inch
-	my $whereToStart = ($marginBottom + ($labelHeigth/2));
-	my $firstLabel = $whereToStart*$defaultDpi;
-	my $spaceBetweenLabels = $labelHeigth*$defaultDpi;
-	my @positions;
-	for (my $i = 0; $i < $rows; $i++) {
-		unshift @positions, ($firstLabel+($spaceBetweenLabels*$i));
-	}
-	@positionsForY = @positions;
-}
-
-=item getLabelPosition
-
-	(my $x, my $y, $pdfObject, $pageObject, $gfxObject, $textObject, $coreObject, $labelPosition) = 
-					C4::Barcodes::PrinterConfig::getLabelPosition($labelPosition, 
-																  $pdfObject, 
-																  $page,
-																  $gfx,
-																  $text,
-																  $fontObject,
-																  $pageType);	
-
-Return the (x,y) position of the label that you are going to print considering the environment.
-
-C<$labelPosition> Indicates which label positions do you want to place by x and y coordinates.
-
-C<$pdfObject> The PDF object in use.
-
-C<$page> The page in use.
-
-C<$gfx> The gfx resource to handle with barcodes objects.
-
-C<$text> The text resource to handle with text.
-
-C<$fontObject> The font object
-
-C<$pageType> Page type to print (eg: a4, legal, etc).
-
-=cut
-#'
-sub getLabelPosition {
-	my ($labelNum, $pdf, $page, $gfxObject, $textObject, $fontObject, $pageType) = @_;
-	my $indexX = $labelNum % @positionsForX;
-	my $indexY = int($labelNum / @positionsForX);
-	# Calculates the next label position and return that label number
-	my $nextIndexX = $labelNum % @positionsForX;
-	my $nextIndexY = $labelNum % @positionsForY;
-	if ($firstLabel) {
-          $page = $pdf->page;
-          $page->mediabox($pageType);
-          $gfxObject = $page->gfx;
-          $textObject = $page->text;
-          $textObject->font($fontObject, 7);
-		  $firstLabel = 0;
-	} elsif ($labelNum== 0) {
-          $page = $pdf->page;
-          $page->mediabox($pageType);
-          $gfxObject = $page->gfx;
-          $textObject = $page->text;
-          $textObject->font($fontObject, 7);
-	}
-	$labelNum = $labelNum + 1;	
-	if ($labelNum == (@positionsForX*@positionsForY)) {
-		$labelNum = 0;
-	}
-	return ($positionsForX[$indexX], $positionsForY[$indexY], $pdf, $page, $gfxObject, $textObject, $fontObject, $labelNum);
-}
-
-=item labelsPage
-
-	my @labelTable = C4::Barcodes::PrinterConfig::labelsPage($rows, $columns);
-
-This function will help you to build the labels panel, where you can choose
-wich label position do you want to start the printer process.
-
-C<$rows> Indicates how many rows do you want in your page type.
-
-C<$columns> Indicates how many rows do you want in your page type.
-
-=cut
-#'
-sub labelsPage{
-	my ($rows, $columns) = @_;
-	my @pageType;
-	my $tagname = 0;
-	my $labelname = 1;
-	my $check;
-	for (my $i = 1; $i <= $rows; $i++) {
-		my @column;
-		for (my $j = 1; $j <= $columns; $j++) {
-			my %cell;
-			if ($tagname == 0) {
-				$check = 'checked';
-			} else {
-				$check = '';
-			}		
-			%cell = (check => $check,
-					 tagname => $tagname,
-			         labelname => $labelname);
-			$tagname = $tagname + 1;	
-			$labelname = $labelname + 1;	
-			push @column, \%cell;
-		}
-		my %columns = (columns => \@column);
-		push @pageType, \%columns;
-	}
-	return @pageType;
-}
-
-1;
-
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Physics Library UNLP <matias_veleda at hotmail.com>
-
-=cut
\ No newline at end of file

Index: modules/C4/Calendar/Calendar.pm
===================================================================
RCS file: modules/C4/Calendar/Calendar.pm
diff -N modules/C4/Calendar/Calendar.pm
--- modules/C4/Calendar/Calendar.pm	11 Mar 2007 20:04:01 -0000	1.1.2.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,563 +0,0 @@
-package C4::Calendar::Calendar;
-
-# 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 strict;
-require Exporter;
-use vars qw($VERSION @EXPORT);
-
-use C4::Context;
-use Date::Calc qw(Add_Delta_Days Day_of_Week);
-
-# set the version for version checking
-$VERSION = 1.01;
-
-=head1 NAME
-
-C4::Calendar::Calendar - Koha module dealing with holidays.
-
-=head1 SYNOPSIS
-
-	use C4::Calendar::Calendar;
-
-=head1 DESCRIPTION
-
-This package is used to deal with holidays. Through this package, you can set all kind of holidays for the library.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at EXPORT = qw(&new 
-             &change_branchcode 
-			 &get_week_days_holidays 
-			 &get_day_month_holidays 
-             &get_exception_holidays 
-			 &get_single_holidays 
-			 &insert_week_day_holiday 
-			 &insert_day_month_holiday 
-			 &insert_single_holiday 
-			 &insert_exception_holiday
-			 &delete_holiday 
-			 &isHoliday 
-			 &addDate
-			 &daysBetween);
-
-=item new
-
-	$calendar = C4::Calendar::Calendar->new(branchcode => $branchcode);
-
-C<$branchcode> Is the branch code wich you want to use calendar.
-
-=cut
-
-sub new {
-	my $classname = shift @_;
-	my %options = @_;
-
-	my %hash;
-	my $self = bless(\%hash, $classname);
-
-	foreach my $optionName (keys %options) {
-		$self->{lc($optionName)} = $options{$optionName};
-	}
-
-	$self->_init;
-
-	return $self;
-}
-
-sub _init {
-	my $self = shift @_;
-
-	my $dbh = C4::Context->dbh();
-	my $week_days_sql = $dbh->prepare("select weekday, title, description from repeatable_holidays where ('$self->{branchcode}' = branchcode) and (NOT(ISNULL(weekday)))");
-	$week_days_sql->execute;
-	my %week_days_holidays;
-	while (my ($weekday, $title, $description) = $week_days_sql->fetchrow) {
-		$week_days_holidays{$weekday}{title} = $title;
-		$week_days_holidays{$weekday}{description} = $description;
-	}
-	$week_days_sql->finish;
-	$self->{'week_days_holidays'} = \%week_days_holidays;
-
-	my $day_month_sql = $dbh->prepare("select day, month, title, description from repeatable_holidays where ('$self->{branchcode}' = branchcode) and ISNULL(weekday)");
-	$day_month_sql->execute;
-	my %day_month_holidays;
-	while (my ($day, $month, $title, $description) = $day_month_sql->fetchrow) {
-		$day_month_holidays{"$month/$day"}{title} = $title;
-		$day_month_holidays{"$month/$day"}{description} = $description;
-	}
-	$day_month_sql->finish;
-	$self->{'day_month_holidays'} = \%day_month_holidays;
-
-	my $exception_holidays_sql = $dbh->prepare("select day, month, year, title, description from special_holidays where ('$self->{branchcode}' = branchcode) and (isexception = 1)");
-	$exception_holidays_sql->execute;
-	my %exception_holidays;
-	while (my ($day, $month, $year, $title, $description) = $exception_holidays_sql->fetchrow) {
-		$exception_holidays{"$year/$month/$day"}{title} = $title;
-		$exception_holidays{"$year/$month/$day"}{description} = $description;
-	}
-	$exception_holidays_sql->finish;
-	$self->{'exception_holidays'} = \%exception_holidays;
-
-	my $holidays_sql = $dbh->prepare("select day, month, year, title, description from special_holidays where ('$self->{branchcode}' = branchcode) and (isexception = 0)");
-	$holidays_sql->execute;
-	my %single_holidays;
-	while (my ($day, $month, $year, $title, $description) = $holidays_sql->fetchrow) {
-		$single_holidays{"$year/$month/$day"}{title} = $title;
-		$single_holidays{"$year/$month/$day"}{description} = $description;
-	}
-	$holidays_sql->finish;
-	$self->{'single_holidays'} = \%single_holidays;
-}
-
-=item change_branchcode
-
-	$calendar->change_branchcode(branchcode => $branchcode)
-
-Change the calendar branch code. This means to change the holidays structure.
-
-C<$branchcode> Is the branch code wich you want to use calendar.
-
-=cut
-
-sub change_branchcode {
-	my ($self, $branchcode) = @_;
-	my %options = @_;
-
-	foreach my $optionName (keys %options) {
-		$self->{lc($optionName)} = $options{$optionName};
-	}
-	$self->_init;
-
-	return $self;
-}
-
-=item get_week_days_holidays
-
-	$week_days_holidays = $calendar->get_week_days_holidays();
-
-Returns a hash reference to week days holidays.
-
-=cut
-
-sub get_week_days_holidays {
-	my $self = shift @_;
-	my $week_days_holidays = $self->{'week_days_holidays'};
-	return $week_days_holidays;
-}
-
-=item get_day_month_holidays
-	
-	$day_month_holidays = $calendar->get_day_month_holidays();
-
-Returns a hash reference to day month holidays.
-
-=cut
-
-sub get_day_month_holidays {
-	my $self = shift @_;
-	my $day_month_holidays = $self->{'day_month_holidays'};
-	return $day_month_holidays;
-}
-
-=item get_exception_holidays
-	
-	$exception_holidays = $calendar->exception_holidays();
-
-Returns a hash reference to exception holidays. This kind of days are those
-which stands for a holiday, but you wanted to make an exception for this particular
-date.
-
-=cut
-
-sub get_exception_holidays {
-	my $self = shift @_;
-	my $exception_holidays = $self->{'exception_holidays'};
-	return $exception_holidays;
-}
-
-=item get_single_holidays
-	
-	$single_holidays = $calendar->get_single_holidays();
-
-Returns a hash reference to single holidays. This kind of holidays are those which
-happend just one time.
-
-=cut
-
-sub get_single_holidays {
-	my $self = shift @_;
-	my $single_holidays = $self->{'single_holidays'};
-	return $single_holidays;
-}
-
-=item insert_week_day_holiday
-
-	insert_week_day_holiday(weekday => $weekday,
-							title => $title,
-							description => $description);
-
-Inserts a new week day for $self->{branchcode}.
-
-C<$day> Is the week day to make holiday.
-
-C<$title> Is the title to store for the holiday formed by $year/$month/$day.
-
-C<$description> Is the description to store for the holiday formed by $year/$month/$day.
-
-=cut
-
-sub insert_week_day_holiday {
-	my $self = shift @_;
-	my %options = @_;
-
-	my $dbh = C4::Context->dbh();
-	my $insertHoliday = $dbh->prepare("insert into repeatable_holidays (id,branchcode,weekday,day,month,title,description) values ('', '$self->{branchcode}', $options{weekday}, NULL, NULL, '$options{title}', '$options{description}')");
-	$insertHoliday->execute;
-	$insertHoliday->finish;
-
-	$self->{'week_days_holidays'}->{$options{weekday}}{title} = $options{title};
-	$self->{'week_days_holidays'}->{$options{weekday}}{description} = $options{description};
-	return $self;
-}
-
-=item insert_day_month_holiday
-
-	insert_day_month_holiday(day => $day,
-	                         month => $month,
-							 title => $title,
-							 description => $description);
-
-Inserts a new day month holiday for $self->{branchcode}.
-
-C<$day> Is the day month to make the date to insert.
-
-C<$month> Is month to make the date to insert.
-
-C<$title> Is the title to store for the holiday formed by $year/$month/$day.
-
-C<$description> Is the description to store for the holiday formed by $year/$month/$day.
-
-=cut
-
-sub insert_day_month_holiday {
-	my $self = shift @_;
-	my %options = @_;
-
-	my $dbh = C4::Context->dbh();
-	my $insertHoliday = $dbh->prepare("insert into repeatable_holidays (id,branchcode,weekday,day,month,title,description) values ('', '$self->{branchcode}', NULL, $options{day}, $options{month}, '$options{title}', '$options{description}')");
-	$insertHoliday->execute;
-	$insertHoliday->finish;
-
-	$self->{'day_month_holidays'}->{"$options{month}/$options{day}"}{title} = $options{title};
-	$self->{'day_month_holidays'}->{"$options{month}/$options{day}"}{description} = $options{description};
-	return $self;
-}
-
-=item insert_single_holiday
-
-	insert_single_holiday(day => $day,
-	                      month => $month,
-						  year => $year,
-						  title => $title,
-						  description => $description);
-
-Inserts a new single holiday for $self->{branchcode}.
-
-C<$day> Is the day month to make the date to insert.
-
-C<$month> Is month to make the date to insert.
-
-C<$year> Is year to make the date to insert.
-
-C<$title> Is the title to store for the holiday formed by $year/$month/$day.
-
-C<$description> Is the description to store for the holiday formed by $year/$month/$day.
-
-=cut
-
-sub insert_single_holiday {
-	my $self = shift @_;
-	my %options = @_;
-
-	my $dbh = C4::Context->dbh();
-	my $isexception = 0;
-	my $insertHoliday = $dbh->prepare("insert into special_holidays (id,branchcode,day,month,year,isexception,title,description) values ('', '$self->{branchcode}', $options{day}, $options{month}, $options{year}, $isexception, '$options{title}', '$options{description}')");
-	$insertHoliday->execute;
-	$insertHoliday->finish;
-
-	$self->{'single_holidays'}->{"$options{year}/$options{month}/$options{day}"}{title} = $options{title};
-	$self->{'single_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description};
-	return $self;
-}
-
-=item insert_exception_holiday
-
-	insert_exception_holiday(day => $day,
-	                         month => $month,
-						     year => $year,
-						     title => $title,
-						     description => $description);
-
-Inserts a new exception holiday for $self->{branchcode}.
-
-C<$day> Is the day month to make the date to insert.
-
-C<$month> Is month to make the date to insert.
-
-C<$year> Is year to make the date to insert.
-
-C<$title> Is the title to store for the holiday formed by $year/$month/$day.
-
-C<$description> Is the description to store for the holiday formed by $year/$month/$day.
-
-=cut
-
-sub insert_exception_holiday {
-	my $self = shift @_;
-	my %options = @_;
-
-	my $dbh = C4::Context->dbh();
-	my $isexception = 1;
-	my $insertException = $dbh->prepare("insert into special_holidays (id,branchcode,day,month,year,isexception,title,description) values ('', '$self->{branchcode}', $options{day}, $options{month}, $options{year}, $isexception, '$options{title}', '$options{description}')");
-	$insertException->execute;
-	$insertException->finish;
-
-	$self->{'exceptions_holidays'}->{"$options{year}/$options{month}/$options{day}"}{title} = $options{title};
-	$self->{'exceptions_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description};
-	return $self;
-}
-
-=item delete_holiday
-
-	delete_holiday(weekday => $weekday
-	               day => $day,
-	               month => $month,
-				   year => $year);
-
-Delete a holiday for $self->{branchcode}.
-
-C<$weekday> Is the week day to delete.
-
-C<$day> Is the day month to make the date to delete.
-
-C<$month> Is month to make the date to delete.
-
-C<$year> Is year to make the date to delete.
-
-=cut
-
-sub delete_holiday {
-	my $self = shift @_;
-	my %options = @_;
-
-	# Verify what kind of holiday that day is. For example, if it is
-	# a repeatable holiday, this should check if there are some exception
-	# for that holiday rule. Otherwise, if it is a regular holiday, it´s 
-	# ok just deleting it.
-
-	my $dbh = C4::Context->dbh();
-	my $isSingleHoliday = $dbh->prepare("select id from special_holidays where (branchcode = '$self->{branchcode}') and (day = $options{day}) and (month = $options{month}) and (year = $options{year})");
-	$isSingleHoliday->execute;
-	if ($isSingleHoliday->rows) {
-		my $id = $isSingleHoliday->fetchrow;
-		$isSingleHoliday->finish; # Close the last query
-
-		my $deleteHoliday = $dbh->prepare("delete from special_holidays where (id = $id)");
-		$deleteHoliday->execute;
-		$deleteHoliday->finish; # Close the last query
-		delete($self->{'single_holidays'}->{"$options{year}/$options{month}/$options{day}"});
-	} else {	
-		$isSingleHoliday->finish; # Close the last query
-
-		my $isWeekdayHoliday = $dbh->prepare("select id from repeatable_holidays where (branchcode = '$self->{branchcode}') and (weekday = $options{weekday})");
-		$isWeekdayHoliday->execute;
-		if ($isWeekdayHoliday->rows) {
-			my $id = $isWeekdayHoliday->fetchrow;
-			$isWeekdayHoliday->finish; # Close the last query
-
-			my $updateExceptions = $dbh->prepare("update special_holidays set isexception = 0 where (WEEKDAY(CONCAT(special_holidays.year,'-',special_holidays.month,'-',special_holidays.day)) = $options{weekday}) and (branchcode = '$self->{branchcode}')");
-			$updateExceptions->execute;
-			$updateExceptions->finish; # Close the last query
-
-			my $deleteHoliday = $dbh->prepare("delete from repeatable_holidays where (id = $id)");
-			$deleteHoliday->execute;
-			$deleteHoliday->finish;
-			delete($self->{'week_days_holidays'}->{$options{weekday}});
-		} else {
-			$isWeekdayHoliday->finish; # Close the last query
-
-			my $isDayMonthHoliday = $dbh->prepare("select id from repeatable_holidays where (branchcode = '$self->{branchcode}') (day = $options{day}) and (month = $options{month})");
-			$isDayMonthHoliday->execute;
-			if ($isDayMonthHoliday->rows) {
-				my $id = $isDayMonthHoliday->fetchrow;
-				$isDayMonthHoliday->finish;
-				my $updateExceptions = $dbh->prepare("update special_holidays set isexception = 0 where (special_holidays.branchcode = '$self->{branchcode}') and (special_holidays.day = $options{day}) and (special_holidays.month = $options{month})");
-				$updateExceptions->execute;
-				$updateExceptions->finish; # Close the last query
-
-				my $deleteHoliday = $dbh->prepare("delete from repeatable_holidays where (id = $id)");
-				$deleteHoliday->execute;
-				$deleteHoliday->finish; # Close the last query
-				$isDayMonthHoliday->finish; # Close the last query
-				delete($self->{'day_month_holidays'}->{"$options{month}/$options{day}"});
-			}
-		}
-	}	
-	return $self;
-}
-
-=item isHoliday
-	
-	$isHoliday = isHoliday($day, $month $year);
-
-
-C<$day> Is the day to check wether if is a holiday or not.
-
-C<$month> Is the month to check wether its a holiday or not.
-
-C<$year> Is the year to check wether if its a holiday or not.
-
-=cut
-
-sub isHoliday {
-	my ($self, $day, $month, $year) = @_;
-
-	my $weekday = Day_of_Week($month, $day, $year);	
-	my $weekDays = $self->get_week_days_holidays();
-	my $dayMonths = $self->get_day_month_holidays();
-	my $exceptions = $self->get_exception_holidays();
-	my $singles = $self->get_single_holidays();
-
-	if (defined($exceptions->{"$year/$month/$day"})) {
-		return 0;
-	} else {		
-		if ((exists($weekDays->{$weekday})) || 
-			(exists($dayMonths->{"$month/$day"})) || 
-			(exists($singles->{"$year/$month/$day"}))) {			
-			return 1;
-		} else {
-			return 0;
-		}
-	}
-
-}
-
-=item addDate
-
-	my ($day, $month, $year) = $calendar->addDate($day, $month, $year, $offset)
-
-C<$day> Is the starting day of the interval.
-
-C<$month> Is the starting month of the interval.
-
-C<$year> Is the starting year of the interval.
-
-C<$offset> Is the number of days that this function has to count from $date.
-
-=cut
-
-sub addDate {
-	my ($self, $day, $month, $year, $offset) = @_;
-	if ($offset < 0) { # In case $offset is negative
-		$offset = $offset*(-1);
-	}
-
-	my $daysMode = C4::Context->preference('useDaysMode');
-	if ($daysMode eq 'normal') {
-		($year, $month, $day) = Add_Delta_Days($year, $month, $day, ($offset - 1));
-	} else {
-		while ($offset > 0) {								
-			if (!($self->isHoliday($day, $month, $year))) {
-				$offset = $offset - 1;					
-			}				
-			if ($offset > 0) {
-				($year, $month, $day) = Add_Delta_Days($year, $month, $day, 1);
-			}				
-		}
-	}
-	return($day, $month, $year);	
-}
-
-=item daysBetween
-
-	my $daysBetween = $calendar->daysBetween($dayFrom, $monthFrom, $yearFrom,
-	                                         $dayTo, $monthTo, $yearTo)
-
-C<$dayFrom> Is the starting day of the interval.
-
-C<$monthFrom> Is the starting month of the interval.
-
-C<$yearFrom> Is the starting year of the interval.
-
-C<$dayTo> Is the ending day of the interval.
-
-C<$monthTo> Is the ending month of the interval.
-
-C<$yearTo> Is the ending year of the interval.
-
-=cut
-
-sub daysBetween {
-	my ($self, $dayFrom, $monthFrom, $yearFrom, $dayTo, $monthTo, $yearTo) = @_;
-	 
-	my $daysMode = C4::Context->preference('useDaysMode');
-	my $count = 1;
-	my $continue = 1;
-	if ($daysMode eq 'normal') {
-		while ($continue) {
-			if (($yearFrom != $yearTo) || ($monthFrom != $monthTo) || ($dayFrom != $dayTo)) {
-				($yearFrom, $monthFrom, $dayFrom) = Add_Delta_Days($yearFrom, $monthFrom, $dayFrom, 1);
-				$count++;
-			} else {
-				$continue = 0;	
-			}
-		}		
-	} else {
-		while ($continue) {
-			if (($yearFrom != $yearTo) || ($monthFrom != $monthTo) || ($dayFrom != $dayTo)) {
-				if (!($self->isHoliday($dayFrom, $monthFrom, $yearFrom))) {
-					$count++;
-				}	
-				($yearFrom, $monthFrom, $dayFrom) = Add_Delta_Days($yearFrom, $monthFrom, $dayFrom, 1);				
-			} else {
-				$continue = 0;	
-			}
-		}		
-	}
-	return($count);	
-}
-
-
-
-
-
-
-1;
-
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Physics Library UNLP <matias_veleda at hotmail.com>
-Modified by Tumer Garip NEU Grand Library --No more Date::Manip
-=cut
\ No newline at end of file

Index: modules/C4/Circulation/Circ2.pm
===================================================================
RCS file: modules/C4/Circulation/Circ2.pm
diff -N modules/C4/Circulation/Circ2.pm
--- modules/C4/Circulation/Circ2.pm	10 Mar 2007 01:39:27 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,2003 +0,0 @@
-package C4::Circulation::Circ2;
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-
-use C4::Context;
-use C4::Stats;
-use C4::Reserves2;
-use C4::Koha;
-use C4::Accounts2;
-use C4::Biblio;
-use C4::Calendar::Calendar;
-use C4::Search;
-use C4::Members;
-use C4::Date;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
-
-=head1 NAME
-
-C4::Circulation::Circ2 - Koha circulation module
-
-=head1 SYNOPSIS
-
-  use C4::Circulation::Circ2;
-
-=head1 DESCRIPTION
-
-The functions in this module deal with circulation, issues, and
-returns, as well as general information about the library.
-Also deals with stocktaking.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-	&currentissues 
-	&getissues 
-	&getiteminformation 
-	&renewstatus 
-	&renewbook
-	&canbookbeissued 
-	&issuebook 
-	&returnbook 
-	&find_reserves 
-	&transferbook 
-	&decode
-
-	&listitemsforinventory 
-	&itemseen 
-	&itemseenbarcode
-	&fixdate 
-	&itemissues 
-
-	 &get_current_return_date_of
-                &get_transfert_infos
-		&checktransferts
-		&GetReservesForBranch
-		&GetReservesToBranch
-		&GetTransfersFromBib
-		&getBranchIp);
-
-# &getbranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
-=item itemissues
-
-  @issues = &itemissues($biblionumber, $biblio);
-
-Looks up information about who has borrowed the bookZ<>(s) with the
-given biblionumber.
-
-C<$biblio> is ignored.
-
-C<&itemissues> returns an array of references-to-hash. The keys
-include the fields from the C<items> table in the Koha database.
-Additional keys include:
-
-=over 4
-
-=item C<date_due>
-
-If the item is currently on loan, this gives the due date.
-
-If the item is not on loan, then this is either "Available" or
-"Cancelled", if the item has been withdrawn.
-
-=item C<card>
-
-If the item is currently on loan, this gives the card number of the
-patron who currently has the item.
-
-=item C<timestamp0>, C<timestamp1>, C<timestamp2>
-
-These give the timestamp for the last three times the item was
-borrowed.
-
-=item C<card0>, C<card1>, C<card2>
-
-The card number of the last three patrons who borrowed this item.
-
-=item C<borrower0>, C<borrower1>, C<borrower2>
-
-The borrower number of the last three patrons who borrowed this item.
-
-=back
-
-=cut
-#'
-sub itemissues {
-    my ($dbh,$data, $itemnumber)=@_;
-    
-      
-    my $i     = 0;
-    my @results;
-
-
-        # Find out who currently has this item.
-        # FIXME - Wouldn't it be better to do this as a left join of
-        # some sort? Currently, this code assumes that if
-        # fetchrow_hashref() fails, then the book is on the shelf.
-        # fetchrow_hashref() can fail for any number of reasons (e.g.,
-        # database server crash), not just because no items match the
-        # search criteria.
-        my $sth2   = $dbh->prepare("select * from issues,borrowers
-where itemnumber = ?
-and returndate is NULL
-and issues.borrowernumber = borrowers.borrowernumber");
-
-        $sth2->execute($itemnumber);
-        if (my $data2 = $sth2->fetchrow_hashref) {
-
-  	$data->{'date_due'}=$data2->{'date_due'};
-	$data->{'datelastborrowed'} = $data2->{'issue_date'};
-            $data->{'card'}     = $data2->{'cardnumber'};
-	    $data->{'borrower'}     = $data2->{'borrowernumber'};
-	$data->{issues}++;
-        } 
-
-        $sth2->finish;
-	 my $sth2   = $dbh->prepare("select * from reserveissue,borrowers
-where itemnumber = ?
-and rettime is NULL
-and reserveissue.borrowernumber = borrowers.borrowernumber");
-
-        $sth2->execute($itemnumber);
-        if (my $data2 = $sth2->fetchrow_hashref) {
-
-  	$data->{'date_due'}=$data2->{'duetime'};
-	$data->{'datelastborrowed'} = $data2->{'restime'};
-            $data->{'card'}     = $data2->{'cardnumber'};
-	    $data->{'borrower'}     = $data2->{'borrowernumber'};
-	$data->{issues}++;
-        } 
-
-        $sth2->finish;
-        # Find the last 2 people who borrowed this item.
-        $sth2 = $dbh->prepare("select * from issues, borrowers
-						where itemnumber = ?
-									and issues.borrowernumber = borrowers.borrowernumber
-									and returndate is not NULL
-									order by returndate desc,timestamp desc limit 2") ;
-        $sth2->execute($itemnumber) ;
-my $i2=0;
-          while (my $data2  = $sth2->fetchrow_hashref) {
-                $data->{"timestamp$i2"} = $data2->{'timestamp'};
-                $data->{"card$i2"}      = $data2->{'cardnumber'};
-                $data->{"borrower$i2"}  = $data2->{'borrowernumber'};
-$data->{'datelastborrowed'} = $data2->{'issue_date'} unless $data->{'datelastborrowed'};
-	$i2++;
-            } # while
-
-        $sth2->finish;
-    return($data);
-}
-
-
-
-=head2 itemseen
-
-&itemseen($dbh,$itemnum)
-Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking
-C<$itemnum> is the item number
-
-=cut
-
-sub itemseen {
-	my ($dbh,$itemnumber) = @_;
-my $sth=$dbh->prepare("select biblionumber from items where itemnumber=?");
-	$sth->execute($itemnumber);
-my ($biblionumber)=$sth->fetchrow; 
-XMLmoditemonefield($dbh,$biblionumber,$itemnumber,'itemlost',"0",1);
-# find today's date
-my ($sec,$min,$hour,$mday,$mon,$year) = localtime();
-	$year += 1900;
-	$mon += 1;
-	my $timestamp = sprintf("%4d%02d%02d%02d%02d%02d.0",
-		$year,$mon,$mday,$hour,$min,$sec);
-XMLmoditemonefield($dbh,$biblionumber,$itemnumber,'datelastseen', $timestamp);	
-}
-sub itemseenbarcode {
-	my ($dbh,$barcode) = @_;
-my $sth=$dbh->prepare("select biblionumber,itemnumber from items where barcode=$barcode");
-	$sth->execute();
-my ($biblionumber,$itemnumber)=$sth->fetchrow; 
-XMLmoditemonefield($dbh,$biblionumber,$itemnumber,'itemlost',"0",1);
-my ($sec,$min,$hour,$mday,$mon,$year) = localtime();
-	$year += 1900;
-	$mon += 1;
-my $timestamp = sprintf("%4d%02d%02d%02d%02d%02d.0",$year,$mon,$mday,$hour,$min,$sec);
-XMLmoditemonefield($dbh,$biblionumber,$itemnumber,'datelastseen', $timestamp);	
-}
-
-
-
-
-
-=head2 decode
-
-=over 4
-
-=head3 $str = &decode($chunk);
-
-=over 4
-
-Decodes a segment of a string emitted by a CueCat barcode scanner and
-returns it.
-
-=back
-
-=back
-
-=cut
-
-# FIXME - At least, I'm pretty sure this is for decoding CueCat stuff.
-sub decode {
-	my ($encoded) = @_;
-	my $seq = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-';
-	my @s = map { index($seq,$_); } split(//,$encoded);
-	my $l = ($#s+1) % 4;
-	if ($l)
-	{
-		if ($l == 1)
-		{
-			print "Error!";
-			return;
-		}
-		$l = 4-$l;
-		$#s += $l;
-	}
-	my $r = '';
-	while ($#s >= 0)
-	{
-		my $n = (($s[0] << 6 | $s[1]) << 6 | $s[2]) << 6 | $s[3];
-		$r .=chr(($n >> 16) ^ 67) .
-		chr(($n >> 8 & 255) ^ 67) .
-		chr(($n & 255) ^ 67);
-		@s = @s[4..$#s];
-	}
-	$r = substr($r,0,length($r)-$l);
-	return $r;
-}
-
-=head2 getiteminformation
-
-=over 4
-
-$item = &getiteminformation($env, $itemnumber, $barcode);
-
-Looks up information about an item, given either its item number or
-its barcode. If C<$itemnumber> is a nonzero value, it is used;
-otherwise, C<$barcode> is used.
-
-C<$env> is effectively ignored, but should be a reference-to-hash.
-
-C<$item> is a reference-to-hash whose keys are fields from the biblio,
-items, and biblioitems tables of the Koha database. It may also
-contain the following keys:
-
-=head3 date_due
-
-=over 4
-
-The due date on this item, if it has been borrowed and not returned
-yet. The date is in YYYY-MM-DD format.
-
-=back
-
-=head3 notforloan
-
-=over 4
-
-True if the item may not be borrowed.
-
-=back
-
-=back
-
-=cut
-
-
-sub getiteminformation {
-# returns a hash of item information together with biblio given either the itemnumber or the barcode
-	my ($env, $itemnumber, $barcode) = @_;
-	my $dbh=C4::Context->dbh;
-	my ($itemrecord)=XMLgetitem($dbh,$itemnumber,$barcode);
-	return undef unless $itemrecord; ## This is to prevent a system crash if barcode does not exist	
-	 my $itemhash=XML_xml2hash_onerecord($itemrecord);	
-	my $iteminformation=XMLmarc2koha_onerecord($dbh,$itemhash,"holdings");
-##Now get full biblio details from MARC
-	if ($iteminformation) {
-my ($record)=XMLgetbiblio($dbh,$iteminformation->{'biblionumber'});
-	my $recordhash=XML_xml2hash_onerecord($record);
-my $biblio=XMLmarc2koha_onerecord($dbh,$recordhash,"biblios");
-		foreach my $field (keys %$biblio){
-		$iteminformation->{$field}=$biblio->{$field};
-		} 
-	$iteminformation->{'date_due'}="" if $iteminformation->{'date_due'} eq "0000-00-00";
-	($iteminformation->{'dewey'} == 0) && ($iteminformation->{'dewey'}='');	
-	}
-	return($iteminformation);
-}
-
-=head2 transferbook
-
-=over 4
-
-($dotransfer, $messages, $iteminformation) = &transferbook($newbranch, $barcode, $ignore_reserves);
-
-Transfers an item to a new branch. If the item is currently on loan, it is automatically returned before the actual transfer.
-
-C<$newbranch> is the code for the branch to which the item should be transferred.
-
-C<$barcode> is the barcode of the item to be transferred.
-
-If C<$ignore_reserves> is true, C<&transferbook> ignores reserves.
-Otherwise, if an item is reserved, the transfer fails.
-
-Returns three values:
-
-=head3 $dotransfer 
-
-is true if the transfer was successful.
-
-=head3 $messages
- 
-is a reference-to-hash which may have any of the following keys:
-
-=over 4
-
-C<BadBarcode>
-
-There is no item in the catalog with the given barcode. The value is C<$barcode>.
-
-C<IsPermanent>
-
-The item's home branch is permanent. This doesn't prevent the item from being transferred, though. The value is the code of the item's home branch.
-
-C<DestinationEqualsHolding>
-
-The item is already at the branch to which it is being transferred. The transfer is nonetheless considered to have failed. The value should be ignored.
-
-C<WasReturned>
-
-The item was on loan, and C<&transferbook> automatically returned it before transferring it. The value is the borrower number of the patron who had the item.
-
-C<ResFound>
-
-The item was reserved. The value is a reference-to-hash whose keys are fields from the reserves table of the Koha database, and C<biblioitemnumber>. It also has the key C<ResFound>, whose value is either C<Waiting> or C<Reserved>.
-
-C<WasTransferred>
-
-The item was eligible to be transferred. Barring problems communicating with the database, the transfer should indeed have succeeded. The value should be ignored.
-
-=back
-
-=back
-
-=back
-
-=cut
-
-##This routine is reverted to origional state
-##This routine is used when a book physically arrives at a branch due to user returning it there
-## so record the fact that holdingbranch is changed.
-sub transferbook {
-# transfer book code....
-	my ($tbr, $barcode, $ignoreRs,$user) = @_;
-	my $messages;
-	my %env;
-	my $dbh=C4::Context->dbh;
-	my $dotransfer = 1;
-	my $branches = GetBranches();
-
-	my $iteminformation = getiteminformation(\%env, 0, $barcode);
-	# bad barcode..
-	if (not $iteminformation) {
-		$messages->{'BadBarcode'} = $barcode;
-		$dotransfer = 0;
-	}
-	# get branches of book...
-	my $hbr = $iteminformation->{'homebranch'};
-	my $fbr = $iteminformation->{'holdingbranch'};
-	# if is permanent...
-	if ($hbr && $branches->{$hbr}->{'PE'}) {
-		$messages->{'IsPermanent'} = $hbr;
-	}
-	# can't transfer book if is already there....
-	# FIXME - Why not? Shouldn't it trivially succeed?
-	if ($fbr eq $tbr) {
-		$messages->{'DestinationEqualsHolding'} = 1;
-		$dotransfer = 0;
-	}
-	# check if it is still issued to someone, return it...
-	my ($currentborrower) = currentborrower($iteminformation->{'itemnumber'});
-	if ($currentborrower) {
-		returnbook($barcode, $fbr);
-		$messages->{'WasReturned'} = $currentborrower;
-	}
-	# find reserves.....
-	# FIXME - Don't call &CheckReserves unless $ignoreRs is true.
-	# That'll save a database query.
-	my ($resfound, $resrec) = CheckReserves($iteminformation->{'itemnumber'});
-	if ($resfound and not $ignoreRs) {
-		$resrec->{'ResFound'} = $resfound;
-		$messages->{'ResFound'} = $resrec;
-		$dotransfer = 0;
-	}
-	#actually do the transfer....
-	if ($dotransfer) {
-		dotransfer($iteminformation->{'itemnumber'}, $fbr, $tbr,$user);
-		$messages->{'WasTransfered'} = 1;
-	}
-	return ($dotransfer, $messages, $iteminformation);
-}
-
-# Not exported
-
-sub dotransfer {
-## The book has arrived at this branch because it has been returned there
-## So we update the fact the book is in that branch not that we want to send the book to that branch
-
-	my ($itm, $fbr, $tbr,$user) = @_;
-	my $dbh = C4::Context->dbh;
-	
-	#new entry in branchtransfers....
-	my $sth=$dbh->prepare("INSERT INTO branchtransfers (itemnumber, frombranch, datearrived, tobranch,comments) VALUES (?, ?, now(), ?,?)");
-	$sth->execute($itm, $fbr,  $tbr,$user);
-	#update holdingbranch in items .....
-	&domarctransfer($dbh,$itm,$tbr);
-## Item seen taken out of this loop to optimize ZEBRA updates
-#	&itemseen($dbh,$itm);	
-	return;
-}
-
-sub domarctransfer{
-my ($dbh,$itemnumber,$holdingbranch) = @_; 
-$itemnumber=~s /\'//g;
-my $sth=$dbh->prepare("select biblionumber from items where itemnumber=$itemnumber");
-	$sth->execute();
-my ($biblionumber)=$sth->fetchrow; 
-XMLmoditemonefield($dbh,$biblionumber,$itemnumber,'holdingbranch',$holdingbranch,1);
-	$sth->finish;
-}
-
-=head2 canbookbeissued
-
-Check if a book can be issued.
-
-my ($issuingimpossible,$needsconfirmation) = canbookbeissued($env,$borrower,$barcode,$year,$month,$day);
-
-=over 4
-
-C<$env> Environment variable. Should be empty usually, but used by other subs. Next code cleaning could drop it.
-
-C<$borrower> hash with borrower informations (from getpatroninformation)
-
-C<$barcode> is the bar code of the book being issued.
-
-C<$year> C<$month> C<$day> contains the date of the return (in case it's forced by "stickyduedate".
-
-=back
-
-Returns :
-
-=over 4
-
-C<$issuingimpossible> a reference to a hash. It contains reasons why issuing is impossible.
-Possible values are :
-
-=head3 INVALID_DATE 
-
-sticky due date is invalid
-
-=head3 GNA
-
-borrower gone with no address
-
-=head3 CARD_LOST
- 
-borrower declared it's card lost
-
-=head3 DEBARRED
-
-borrower debarred
-
-=head3 UNKNOWN_BARCODE
-
-barcode unknown
-
-=head3 NOT_FOR_LOAN
-
-item is not for loan
-
-=head3 WTHDRAWN
-
-item withdrawn.
-
-=head3 RESTRICTED
-
-item is restricted (set by ??)
-
-=back
-
-C<$issuingimpossible> a reference to a hash. It contains reasons why issuing is impossible.
-Possible values are :
-
-=head3 DEBT
-
-borrower has debts.
-
-=head3 RENEW_ISSUE
-
-renewing, not issuing
-
-=head3 ISSUED_TO_ANOTHER
-
-issued to someone else.
-
-=head3 RESERVED
-
-reserved for someone else.
-
-=head3 INVALID_DATE
-
-sticky due date is invalid
-
-=head3 TOO_MANY
-
-if the borrower borrows to much things
-
-=cut
-
-# check if a book can be issued.
-# returns an array with errors if any
-
-
-
-
-
-
-
-
-
-
-
-sub TooMany ($$){
-	my $borrower = shift;
-	my $iteminformation = shift;
-	my $cat_borrower = $borrower->{'categorycode'};
-	my $branch_borrower = $borrower->{'branchcode'};
-	my $dbh = C4::Context->dbh;
-	my $type = $iteminformation->{'ctype'};
-my	$sth = $dbh->prepare('select * from issuingrules where categorycode = ? and itemtype = ? and branchcode = ?');
-	my $sth2 = $dbh->prepare("select COUNT(*) from issues i,  items it where i.borrowernumber = ? and i.returndate is null and i.itemnumber = it.itemnumber and it.ctype=? ");
-	my $sth3 = $dbh->prepare('select COUNT(*) from issues where borrowernumber = ? and returndate is null');
-	my $alreadyissued;
-
-	# check the 3 parameters
-	#print "content-type: text/plain \n\n";
-	#print "$cat_borrower, $type, $branch_borrower";
-	$sth->execute($cat_borrower, $type, $branch_borrower);
-	my $result = $sth->fetchrow_hashref;
-	if (defined($result->{maxissueqty})) {
-	#	print "content-type: text/plain \n\n";
-	#print "$cat_borrower, $type, $branch_borrower";
-		$sth2->execute($borrower->{'borrowernumber'}, $type);
-		my $alreadyissued = $sth2->fetchrow;	
-	#	print "***" . $alreadyissued;
-	#print "----". $result->{'maxissueqty'};
-	  if ($result->{'maxissueqty'} <= $alreadyissued) {
-			return ("$type  $alreadyissued / max:".($result->{'maxissueqty'}+0));
-	  }
-	}
-# check for itemtype=*
-	$sth->execute($cat_borrower, "*", $branch_borrower);
-	$result = $sth->fetchrow_hashref;
-        if (defined($result->{maxissueqty})) {
-		$sth3->execute($borrower->{'borrowernumber'});
-		my ($alreadyissued) = $sth3->fetchrow;
-	     if ($result->{'maxissueqty'} <= $alreadyissued){
-#		warn "HERE : $alreadyissued / ($result->{maxissueqty} for $borrower->{'borrowernumber'}";
-		return ("$type  $alreadyissued / max:".($result->{'maxissueqty'}+0));
-	     } else {
-		return;
-	     }
-	}
-	# check for branch=*
-	$sth->execute($cat_borrower, $type, "");
-	 $result = $sth->fetchrow_hashref;
-	if (defined($result->{maxissueqty})) {
-		$sth2->execute($borrower->{'borrowernumber'}, $type);
-		my $alreadyissued = $sth2->fetchrow;
-	  if ($result->{'maxissueqty'} <= $alreadyissued){
-		return ("$type  $alreadyissued / max:".($result->{'maxissueqty'}+0));
-	     } else {
-	        return;
-	     }
-	}
-
-	
-
-	#check for borrowertype=*
-	$sth->execute("*", $type, $branch_borrower);
-	$result = $sth->fetchrow_hashref;
-        if (defined($result->{maxissueqty})) {    
-		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
-		my $alreadyissued = $sth2->fetchrow;
-	    if ($result->{'maxissueqty'} <= $alreadyissued){	    
-		return ("$type  $alreadyissued / max:".($result->{'maxissueqty'}+0));
-	    } else {
-		return;
-	    }
-	}
-
-	#check for borrowertype=*;itemtype=*
-	$sth->execute("*", "*", $branch_borrower);
-	$result = $sth->fetchrow_hashref;
-        if (defined($result->{maxissueqty})) {    
-		$sth3->execute($borrower->{'borrowernumber'});
-		my $alreadyissued = $sth3->fetchrow;
-	    if ($result->{'maxissueqty'} <= $alreadyissued){
-		return ("$type  $alreadyissued / max:".($result->{'maxissueqty'}+0));
-	    } else {
-		return;
-	    }
-	}
-
-	$sth->execute("*", $type, "");
-	$result = $sth->fetchrow_hashref;
-	if (defined($result->{maxissueqty}) && $result->{maxissueqty}>=0) {
-		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
-		my $alreadyissued = $sth2->fetchrow;
-	     if ($result->{'maxissueqty'} <= $alreadyissued){
-		return ("$type  $alreadyissued / max:".($result->{'maxissueqty'}+0));
-	     } else {
-		return;
-	     }
-	}
-
-	$sth->execute($cat_borrower, "*", "");
-	$result = $sth->fetchrow_hashref;
-        if (defined($result->{maxissueqty})) {    
-		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
-		my $alreadyissued = $sth2->fetchrow;
-	     if ($result->{'maxissueqty'} <= $alreadyissued){
-		return ("$type  $alreadyissued / max:".($result->{'maxissueqty'}+0));
-	     } else {
-		return;
-	     }
-	}
-
-	$sth->execute("*", "*", "");
-	$result = $sth->fetchrow_hashref;
-        if (defined($result->{maxissueqty})) {    
-		$sth3->execute($borrower->{'borrowernumber'});
-		my $alreadyissued = $sth3->fetchrow;
-	     if ($result->{'maxissueqty'} <= $alreadyissued){
-		return ("$type  $alreadyissued / max:".($result->{'maxissueqty'}+0));
-	     } else {
-		return;
-	     }
-	}
-	return;
-}
-
-
-
-
-sub canbookbeissued {
-	my ($env,$borrower,$barcode,$year,$month,$day,$inprocess) = @_;
-	my %needsconfirmation; # filled with problems that needs confirmations
-	my %issuingimpossible; # filled with problems that causes the issue to be IMPOSSIBLE
-	my $iteminformation = getiteminformation($env, 0, $barcode);
-	my $dbh = C4::Context->dbh;
-#
-# DUE DATE is OK ?
-#
-	my ($duedate, $invalidduedate) = fixdate($year, $month, $day);
-	$issuingimpossible{INVALID_DATE} = 1 if ($invalidduedate);
-
-#
-# BORROWER STATUS
-#
-	if ($borrower->{flags}->{GNA}) {
-		$issuingimpossible{GNA} = 1;
-	}
-	if ($borrower->{flags}->{'LOST'}) {
-		$issuingimpossible{CARD_LOST} = 1;
-	}
-	if ($borrower->{flags}->{'DBARRED'}) {
-		$issuingimpossible{DEBARRED} = 1;
-	}
-	my $today=get_today();
-	if (DATE_diff($borrower->{expiry},$today)<0) {
-		$issuingimpossible{EXPIRED} = 1;
-	}
-#
-# BORROWER STATUS
-#
-
-# DEBTS
-	my $amount = C4::Accounts2::checkaccount($env,$borrower->{'borrowernumber'}, $dbh,$duedate);
-        if(C4::Context->preference("IssuingInProcess")){
-	    my $amountlimit = C4::Context->preference("noissuescharge");
-	    	if ($amount > $amountlimit && !$inprocess) {
-			$issuingimpossible{DEBT} = sprintf("%.2f",$amount);
-	    	} elsif ($amount <= $amountlimit && !$inprocess) {
-			$needsconfirmation{DEBT} = sprintf("%.2f",$amount);
-	    	}
-        } else {
-	   		 if ($amount >0) {
-			$needsconfirmation{DEBT} = $amount;
-	    	}
-		}
-
-
-#
-# JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS
-#
-	my $toomany = TooMany($borrower, $iteminformation);
-	$needsconfirmation{TOO_MANY} =  $toomany if $toomany;
-	$issuingimpossible{TOO_MANY} = $toomany if $toomany;
-#
-# ITEM CHECKING
-#
-	unless ($iteminformation->{barcode}) {
-		$issuingimpossible{UNKNOWN_BARCODE} = 1;
-	}
-	if ($iteminformation->{'notforloan'} > 0) {
-		$issuingimpossible{NOT_FOR_LOAN} = 1;
-	}
-	if ($iteminformation->{'ctype'} eq 'REF') {
-		$issuingimpossible{NOT_FOR_LOAN} = 1;
-	}
-	if ($iteminformation->{'wthdrawn'} == 1) {
-		$issuingimpossible{WTHDRAWN} = 1;
-	}
-	if ($iteminformation->{'restricted'} == 1) {
-		$issuingimpossible{RESTRICTED} = 1;
-	}
-	if ($iteminformation->{'shelf'} eq 'Res') {
-		$issuingimpossible{IN_RESERVE} = 1;
-	}
-if (C4::Context->preference("IndependantBranches")){
-		my $userenv = C4::Context->userenv;
-		if (($userenv)&&($userenv->{flags} != 1)){
-			$issuingimpossible{NOTSAMEBRANCH} = 1 if ($iteminformation->{'holdingbranch'} ne $userenv->{branch} ) ;
-		}
-	}
-
-#
-# CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER
-#
-	my ($currentborrower) = currentborrower($iteminformation->{'itemnumber'});
-	if ($currentborrower eq $borrower->{'borrowernumber'}) {
-# Already issued to current borrower. Ask whether the loan should
-# be renewed.
-		my ($renewstatus) = renewstatus($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
-		if ($renewstatus == 0) { # no more renewals allowed
-			$issuingimpossible{NO_MORE_RENEWALS} = 1;
-		} else {
-			if (C4::Context->preference("strictrenewals")){
-			###if this is set do not allow automatic renewals
-			##the new renew script will do same strict checks as issues and return error codes
-			$needsconfirmation{RENEW_ISSUE} = 1;
-			}	
-			
-		}
-	} elsif ($currentborrower) {
-# issued to someone else
-		my $currborinfo = C4::Members::getpatroninformation(0,$currentborrower);
-#		warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
-		$needsconfirmation{ISSUED_TO_ANOTHER} = "$currborinfo->{'reservedate'} : $currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
-	}
-	my $returningborrower=currentreturningborrower($iteminformation->{'itemnumber'});
-##Book cannot be reissued if returned within last 24 hrs
-	if ($returningborrower->{borrowernumber}==$borrower->{borrowernumber}){
-			$needsconfirmation{hr_LIMIT} = "$returningborrower->{'firstname'} $returningborrower->{'surname'} ($returningborrower->{'cardnumber'}) returned the book on: $returningborrower->{timestamp}";
-	}
-# See if the item is on RESERVE
-	my ($restype, $res) = CheckReserves($iteminformation->{'itemnumber'});
-	if ($restype) {
-		my $resbor = $res->{'borrowernumber'};
-		my ($resborrower, $flags)=C4::Members::getpatroninformation($env, $resbor,0);
-		my $branches = GetBranches();
-			my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
-		if ($resbor ne $borrower->{'borrowernumber'} && $restype eq "Waiting") {
-			# The item is on reserve and waiting, but has been
-			# reserved by some other patron.
-			
-			
-			$needsconfirmation{RESERVE_WAITING} = "$resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'}, $branchname)";
-		#	CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
-		} elsif ($restype eq "Reserved") {
-			# The item is on reserve for someone else.
-			
-			$needsconfirmation{RESERVED} = "$res->{'reservedate'} : $resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'})";
-		}
-	}
-        	if(C4::Context->preference("LibraryName") eq "Horowhenua Library Trust"){
-	   			 if ($borrower->{'categorycode'} eq 'W'){
-		        my %issuingimpossible;
-		        	return(\%issuingimpossible,\%needsconfirmation);
-	    		}
-	    	}
-	      
-	return(\%issuingimpossible,\%needsconfirmation);
-}
-
-=head2 issuebook
-
-Issue a book. Does no check, they are done in canbookbeissued. If we reach this sub, it means the user confirmed if needed.
-
-&issuebook($env,$borrower,$barcode,$date)
-
-=over 4
-
-C<$env> Environment variable. Should be empty usually, but used by other subs. Next code cleaning could drop it.
-
-C<$borrower> hash with borrower informations (from getpatroninformation)
-
-C<$barcode> is the bar code of the book being issued.
-
-C<$date> contains the max date of return. calculated if empty.
-
-=cut
-
-#
-# issuing book. We already have checked it can be issued, so, just issue it !
-#
-sub issuebook {
-### fix me STOP using koha hashes, change so that XML hash is used
-	my ($env,$borrower,$barcode,$date,$cancelreserve) = @_;
-	my $dbh = C4::Context->dbh;
-	my $itemrecord=XMLgetitemhash($dbh,"",$barcode);
-	my $iteminformation=XMLmarc2koha_onerecord($dbh,$itemrecord,"holdings");
-              $iteminformation->{'itemtype'}=MARCfind_itemtype($dbh,$iteminformation->{biblionumber});
-	my $bibliorecord=XMLgetbibliohash($dbh,$iteminformation->{biblionumber});
-	
-	my $error;
-#
-# check if we just renew the issue.
-#
-	my ($currentborrower) = currentborrower($iteminformation->{'itemnumber'});
-	if ($currentborrower eq $borrower->{'borrowernumber'}) {
-		my ($charge,$itemtype) = calc_charges($env, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'});
-		if ($charge > 0) {
-			createcharge($env, $dbh, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'}, $charge);
-			$iteminformation->{'charge'} = $charge;
-		}
-		&UpdateStats($env,$env->{'branchcode'},'renew',$charge,'',$iteminformation->{'itemnumber'},$iteminformation->{'ctype'},$borrower->{'borrowernumber'});
-			if (C4::Context->preference("strictrenewals")){
-		 	$error=renewstatus($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
-		 	renewbook($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'}) if ($error>1);
-		 	}else{
-		 renewbook($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
-			}
-	} else {
-#
-# NOT a renewal
-#
-		if ($currentborrower ne '') {
-			# This book is currently on loan, but not to the person
-			# who wants to borrow it now. mark it returned before issuing to the new borrower
-			returnbook($iteminformation->{'barcode'}, $env->{'branchcode'});
-#warn "return : ".$borrower->{borrowernumber}." / I : ".$iteminformation->{'itemnumber'};
-
-		}
-		# See if the item is on reserve.
-		my ($restype, $res) = CheckReserves($iteminformation->{'itemnumber'});
-#warn "$restype,$res";
-		if ($restype) {
-			my $resbor = $res->{'borrowernumber'};
-			my ($resborrower, $flags)=C4::Members::getpatroninformation($env, $resbor,0);
-				my $branches = GetBranches();
-				my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
-			if ($resbor eq $borrower->{'borrowernumber'}) {
-				# The item is on reserve to the current patron
-				FillReserve($res);
-#				warn "FillReserve";
-			} elsif ($restype eq "Waiting") {
-#				warn "Waiting";
-				# The item is on reserve and waiting, but has been
-				# reserved by some other patron.
-				
-                 			if ($cancelreserve){
-    				    CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
-                 			 } else {
-				    # set waiting reserve to first in reserve queue as book isn't waiting now
-				    UpdateReserve(1, $res->{'biblionumber'}, $res->{'borrowernumber'}, $res->{'branchcode'});
-				}
-			} elsif ($restype eq "Reserved") {
-#warn "Reserved";
-				# The item is on reserve for someone else.
-				
-				if ($cancelreserve) {
-					# cancel reserves on this item
-					CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
-					# also cancel reserve on biblio related to this item
-				#	my $st_Fbiblio = $dbh->prepare("select biblionumber from items where itemnumber=?");
-				#	$st_Fbiblio->execute($res->{'itemnumber'});
-				#	my $biblionumber = $st_Fbiblio->fetchrow;
-#					CancelReserve($iteminformation->{'biblionumber'},0,$res->{'borrowernumber'});
-#					warn "CancelReserve $res->{'itemnumber'}, $res->{'borrowernumber'}";
-				} else {
-					my $tobrcd = ReserveWaiting($res->{'itemnumber'}, $res->{'borrowernumber'});
-					transferbook($tobrcd,$barcode, 1);
-#					warn "transferbook";
-				}
-			}
-		}
-		
-		my $sth=$dbh->prepare("insert into issues (borrowernumber, itemnumber, date_due, branchcode,issue_date) values (?,?,?,?,NOW())");
-		my $loanlength = getLoanLength($borrower->{'categorycode'},$iteminformation->{'ctype'},$borrower->{'branchcode'});
-		my $dateduef=get_today();
-		my $calendar = C4::Calendar::Calendar->new(branchcode => $borrower->{'branchcode'});
-		my ($yeardue, $monthdue, $daydue) = split /-/, $dateduef;
-		($daydue, $monthdue, $yeardue) = $calendar->addDate($daydue, $monthdue, $yeardue, $loanlength);
-		$dateduef = "$yeardue-".sprintf ("%0.2d", $monthdue)."-". sprintf("%0.2d",$daydue);
-#warn $dateduef;
-		if ($date) {
-			$dateduef=$date;
-		}
-		# if ReturnBeforeExpiry ON the datedue can't be after borrower expirydate
-		if (C4::Context->preference('ReturnBeforeExpiry') && $dateduef gt $borrower->{expiry}) {
-			$dateduef=$borrower->{expiry};
-		}
-		$sth->execute($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'}, $dateduef, $env->{'branchcode'});
-		$sth->finish;
-		$iteminformation->{'issues'}++;
-##Record in MARC the new data ,date_due as due date,issue count and the borrowernumber
-		$itemrecord=XML_writeline($itemrecord, "issues", $iteminformation->{'issues'},"holdings");
-		$itemrecord=XML_writeline($itemrecord, "date_due", $dateduef,"holdings");
-		$itemrecord=XML_writeline($itemrecord, "borrowernumber", $borrower->{'borrowernumber'},"holdings");
-		$itemrecord=XML_writeline($itemrecord, "itemlost", "0","holdings");
-		$itemrecord=XML_writeline($itemrecord, "onloan", "1","holdings");
-##Update totalissues of bibliorecord if exist
-   my $totalissue=XML_readline_onerecord($bibliorecord,"totalissue","biblios");
-$totalissue=scalar($totalissue);
-	$totalissue++;
-my $extras=length($totalissue);
-	for (1..(6-$extras)){
-	$totalissue="0".$totalissue;
-	}
-
-	$bibliorecord=XML_writeline($bibliorecord,"totalissue",$totalissue,"biblios");
-	my $frameworkcode=MARCfind_frameworkcode($dbh,$iteminformation->{'biblionumber'});
-		 C4::Biblio::OLDmodbiblio($dbh,$bibliorecord,$iteminformation->{'biblionumber'},$frameworkcode);
-###
-		# find today's date as timestamp
-		my ($sec,$min,$hour,$mday,$mon,$year) = localtime();
-		$year += 1900;
-		$mon += 1;
-		my $timestamp = sprintf("%4d%02d%02d%02d%02d%02d.0",
-		$year,$mon,$mday,$hour,$min,$sec);
-		$itemrecord=XML_writeline($itemrecord, "datelastseen", $timestamp,"holdings");
-		##Now update the zebradb
-		NEWmoditem($dbh,$itemrecord,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'});
-		# If it costs to borrow this book, charge it to the patron's account.
-		my ($charge,$itemtype)=calc_charges($env, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'});
-		if ($charge > 0) {
-			createcharge($env, $dbh, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'}, $charge);
-			$iteminformation->{'charge'}=$charge;
-		}
-		# Record the fact that this book was issued in SQL
-		&UpdateStats($env,$env->{'branchcode'},'issue',$charge,'',$iteminformation->{'itemnumber'},$iteminformation->{'ctype'},$borrower->{'borrowernumber'});
-	}
-return($error);
-}
-
-=head2 getLoanLength
-
-Get loan length for an itemtype, a borrower type and a branch
-
-my $loanlength = &getLoanLength($borrowertype,$itemtype,branchcode)
-
-=cut
-
-sub getLoanLength {
-	my ($borrowertype,$itemtype,$branchcode) = @_;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("select issuelength from issuingrules where categorycode=? and itemtype=? and branchcode=?");
-	# try to find issuelength & return the 1st available.
-	# check with borrowertype, itemtype and branchcode, then without one of those parameters
-	$sth->execute($borrowertype,$itemtype,$branchcode);
-	my $loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
-	
-	$sth->execute($borrowertype,$itemtype,"");
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
-
-	$sth->execute($borrowertype,"*",$branchcode);
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
-
-	$sth->execute("*",$itemtype,$branchcode);
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
-
-	$sth->execute($borrowertype,"*","");
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
-
-	$sth->execute("*","*",$branchcode);
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
-
-	$sth->execute("*",$itemtype,"");
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
-
-	$sth->execute("*","*","");
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
-
-	# if no rule is set => 21 days (hardcoded)
-	return 21;
-}
-=head2 returnbook
-
-  ($doreturn, $messages, $iteminformation, $borrower) =
-	  &returnbook($barcode, $branch);
-
-Returns a book.
-
-C<$barcode> is the bar code of the book being returned. C<$branch> is
-the code of the branch where the book is being returned.
-
-C<&returnbook> returns a list of four items:
-
-C<$doreturn> is true iff the return succeeded.
-
-C<$messages> is a reference-to-hash giving the reason for failure:
-
-=over 4
-
-=item C<BadBarcode>
-
-No item with this barcode exists. The value is C<$barcode>.
-
-=item C<NotIssued>
-
-The book is not currently on loan. The value is C<$barcode>.
-
-=item C<IsPermanent>
-
-The book's home branch is a permanent collection. If you have borrowed
-this book, you are not allowed to return it. The value is the code for
-the book's home branch.
-
-=item C<wthdrawn>
-
-This book has been withdrawn/cancelled. The value should be ignored.
-
-=item C<ResFound>
-
-The item was reserved. The value is a reference-to-hash whose keys are
-fields from the reserves table of the Koha database, and
-C<biblioitemnumber>. It also has the key C<ResFound>, whose value is
-either C<Waiting>, C<Reserved>, or 0.
-
-=back
-
-C<$borrower> is a reference-to-hash, giving information about the
-patron who last borrowed the book.
-
-=cut
-
-# FIXME - This API is bogus. There's no need to return $borrower and
-# $iteminformation; the caller can ask about those separately, if it
-# cares (it'd be inefficient to make two database calls instead of
-# one, but &getpatroninformation and &getiteminformation can be
-# memoized if this is an issue).
-#
-# The ($doreturn, $messages) tuple is redundant: if the return
-# succeeded, that's all the caller needs to know. So &returnbook can
-# return 1 and 0 on success and failure, and set
-# $C4::Circulation::Circ2::errmsg to indicate the error. Or it can
-# return undef for success, and an error message on error (though this
-# is more C-ish than Perl-ish).
-
-sub returnbook {
-	my ($barcode, $branch) = @_;
-	my %env;
-	my $messages;
-	my $dbh = C4::Context->dbh;
-	my $doreturn = 1;
-	die '$branch not defined' unless defined $branch; # just in case (bug 170)
-	# get information on item
-	my $itemrecord=XMLgetitemhash($dbh,"",$barcode);
-	if (not $itemrecord) {
-		$messages->{'BadBarcode'} = $barcode;
-		$doreturn = 0;
-	return ($doreturn, $messages, undef, undef);
-	}
-	my $iteminformation=XMLmarc2koha_onerecord($dbh,$itemrecord,"holdings");
-              $iteminformation->{'itemtype'}=MARCfind_itemtype($dbh,$iteminformation->{biblionumber});
-	
-	# find the borrower
-	my ($currentborrower) = currentborrower($iteminformation->{'itemnumber'});
-	if ((not $currentborrower) && $doreturn) {
-		$messages->{'NotIssued'} = $barcode;
-		$doreturn = 0;
-	}
-	# check if the book is in a permanent collection....
-	my $hbr = $iteminformation->{'homebranch'};
-	my $branches = GetBranches();
-	if ($branches->{$hbr}->{'PE'}) {
-		$messages->{'IsPermanent'} = $hbr;
-	}
-	# check that the book has been cancelled
-	if ($iteminformation->{'wthdrawn'}) {
-		$messages->{'wthdrawn'} = 1;
-	#	$doreturn = 0;
-	}
-	# update issues, thereby returning book (should push this out into another subroutine
-	my ($borrower) = C4::Members::getpatroninformation(\%env, $currentborrower, 0);
-	if ($doreturn) {
-		my $sth = $dbh->prepare("update issues set returndate = now() where (itemnumber = ?) and (returndate is null)");
-		$sth->execute( $iteminformation->{'itemnumber'});
-		$messages->{'WasReturned'} = 1; # FIXME is the "= 1" right?
-	
-		$sth->finish;
-	}
-	$itemrecord=XML_writeline($itemrecord, "date_due", "","holdings");
-	$itemrecord=XML_writeline($itemrecord, "onloan", "0","holdings");
-	$itemrecord=XML_writeline($itemrecord, "borrowernumber", "","holdings");
-	
-	my ($transfered, $mess, $item) = transferbook($branch, $barcode, 1);
-	my ($sec,$min,$hour,$mday,$mon,$year) = localtime();
-		$year += 1900;
-		$mon += 1;
-		my $timestamp = sprintf("%4d%02d%02d%02d%02d%02d.0",
-		$year,$mon,$mday,$hour,$min,$sec);
-		$itemrecord=XML_writeline($itemrecord, "datelastseen", $timestamp,"holdings");
-		
-		
-	# transfer book to the current branch
-	
-	if ($transfered) {
-		$messages->{'WasTransfered'} = 1; # FIXME is the "= 1" right?
-	}
-	# fix up the accounts.....
-	if ($iteminformation->{'itemlost'}) {
-		fixaccountforlostandreturned($iteminformation, $borrower);
-		$messages->{'WasLost'} = 1; # FIXME is the "= 1" right?
-		$itemrecord=XML_writeline($itemrecord, "itemlost", "","holdings");
-	}
-####WARNING-- FIXME#########	
-### The following new script is commented out
-## 	I did not understand what it is supposed to do.
-## If a book is returned at one branch it is automatically recorded being in that branch by
-## transferbook script. This scrip tries to find out whether it was sent thre
-## Well whether sent or not it is physically there and transferbook records this fact in MARCrecord as well
-## If this script is trying to do something else it should be uncommented and also add support for updating MARC record --TG
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# 	check if we have a transfer for this document
-#	my $checktransfer = checktransferts($iteminformation->{'itemnumber'});
-# 	if we have a return, we update the line of transfers with the datearrived
-#	if ($checktransfer){
-#		my $sth = $dbh->prepare("update branchtransfers set datearrived = now() where itemnumber= ? AND datearrived IS NULL");
-#		$sth->execute($iteminformation->{'itemnumber'});
-#		$sth->finish;
-# 		now we check if there is a reservation with the validate of transfer if we have one, we can 		set it with the status 'W'
-#		my $updateWaiting = SetWaitingStatus($iteminformation->{'itemnumber'});
-#	}
-#	if we don't have a transfer on run, we check if the document is not in his homebranch and there is not a reservation, we transfer this one to his home branch directly if system preference Automaticreturn is turn on .
-#	else {
-#		my $checkreserves = CheckReserves($iteminformation->{'itemnumber'});
-#		if (($iteminformation->{'homebranch'} ne $iteminformation->{'holdingbranch'}) and (not $checkreserves) and (C4::Context->preference("AutomaticItemReturn") == 1)){
-#				my $automatictransfer = dotransfer($iteminformation->{'itemnumber'},$iteminformation->{'holdingbranch'},$iteminformation->{'homebranch'});
-#				$messages->{'WasTransfered'} = 1;
-#		}
-#	}
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
-	# fix up the overdues in accounts...
-	fixoverduesonreturn($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
-	$itemrecord=XML_writeline($itemrecord, "itemoverdue", "","holdings");
-	# find reserves.....
-	my ($resfound, $resrec) = CheckReserves($iteminformation->{'itemnumber'});
-	if ($resfound) {
-	#	my $tobrcd = ReserveWaiting($resrec->{'itemnumber'}, $resrec->{'borrowernumber'});
-		$resrec->{'ResFound'} = $resfound;
-		$messages->{'ResFound'} = $resrec;
-	}
-	##Now update the zebradb
-		NEWmoditem($dbh,$itemrecord,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'});
-	# update stats?
-	# Record the fact that this book was returned.
-	UpdateStats(\%env, $branch ,'return','0','',$iteminformation->{'itemnumber'},$iteminformation->{'ctype'},$borrower->{'borrowernumber'});
-	return ($doreturn, $messages, $iteminformation, $borrower);
-}
-
-=head2 fixaccountforlostandreturned
-
-	&fixaccountforlostandreturned($iteminfo,$borrower);
-
-Calculates the charge for a book lost and returned (Not exported & used only once)
-
-C<$iteminfo> is a hashref to iteminfo. Only {itemnumber} is used.
-
-C<$borrower> is a hashref to borrower. Only {borrowernumber is used.
-
-=cut
-
-sub fixaccountforlostandreturned {
-	my ($iteminfo, $borrower) = @_;
-	my %env;
-	my $dbh = C4::Context->dbh;
-	my $itm = $iteminfo->{'itemnumber'};
-	# check for charge made for lost book
-	my $sth = $dbh->prepare("select * from accountlines where (itemnumber = ?) and (accounttype='L' or accounttype='Rep') order by date desc");
-	$sth->execute($itm);
-	if (my $data = $sth->fetchrow_hashref) {
-	# writeoff this amount
-		my $offset;
-		my $amount = $data->{'amount'};
-		my $acctno = $data->{'accountno'};
-		my $amountleft;
-		if ($data->{'amountoutstanding'} == $amount) {
-		$offset = $data->{'amount'};
-		$amountleft = 0;
-		} else {
-		$offset = $amount - $data->{'amountoutstanding'};
-		$amountleft = $data->{'amountoutstanding'} - $amount;
-		}
-		my $usth = $dbh->prepare("update accountlines set accounttype = 'LR',amountoutstanding='0'
-			where (borrowernumber = ?)
-			and (itemnumber = ?) and (accountno = ?) ");
-		$usth->execute($data->{'borrowernumber'},$itm,$acctno);
-		$usth->finish;
-	#check if any credit is left if so writeoff other accounts
-		my $nextaccntno = getnextacctno(\%env,$data->{'borrowernumber'},$dbh);
-		if ($amountleft < 0){
-		$amountleft*=-1;
-		}
-		if ($amountleft > 0){
-		my $msth = $dbh->prepare("select * from accountlines where (borrowernumber = ?)
-							and (amountoutstanding >0) order by date");
-		$msth->execute($data->{'borrowernumber'});
-	# offset transactions
-		my $newamtos;
-		my $accdata;
-		while (($accdata=$msth->fetchrow_hashref) and ($amountleft>0)){
-			if ($accdata->{'amountoutstanding'} < $amountleft) {
-			$newamtos = 0;
-			$amountleft -= $accdata->{'amountoutstanding'};
-			}  else {
-			$newamtos = $accdata->{'amountoutstanding'} - $amountleft;
-			$amountleft = 0;
-			}
-			my $thisacct = $accdata->{'accountno'};
-			my $usth = $dbh->prepare("update accountlines set amountoutstanding= ?
-					where (borrowernumber = ?)
-					and (accountno=?)");
-			$usth->execute($newamtos,$data->{'borrowernumber'},'$thisacct');
-			$usth->finish;
-			$usth = $dbh->prepare("insert into accountoffsets
-				(borrowernumber, accountno, offsetaccount,  offsetamount)
-				values
-				(?,?,?,?)");
-			$usth->execute($data->{'borrowernumber'},$accdata->{'accountno'},$nextaccntno,$newamtos);
-			$usth->finish;
-		}
-		$msth->finish;
-		}
-		if ($amountleft > 0){
-			$amountleft*=-1;
-		}
-		my $desc="Book Returned ".$iteminfo->{'barcode'};
-		$usth = $dbh->prepare("insert into accountlines
-			(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
-			values (?,?,now(),?,?,'CR',?)");
-		$usth->execute($data->{'borrowernumber'},$nextaccntno,0-$amount,$desc,$amountleft);
-		$usth->finish;
-		$usth = $dbh->prepare("insert into accountoffsets
-			(borrowernumber, accountno, offsetaccount,  offsetamount)
-			values (?,?,?,?)");
-		$usth->execute($borrower->{'borrowernumber'},$data->{'accountno'},$nextaccntno,$offset);
-		$usth->finish;
-#		$usth = $dbh->prepare("update items set paidfor='' where itemnumber=?");
-#		$usth->execute($itm);
-#		$usth->finish;
-	}
-	$sth->finish;
-	return;
-}
-
-=head2 fixoverdueonreturn
-
-	&fixoverdueonreturn($brn,$itm);
-
-??
-
-C<$brn> borrowernumber
-
-C<$itm> itemnumber
-
-=cut
-
-sub fixoverduesonreturn {
-	my ($brn, $itm) = @_;
-	my $dbh = C4::Context->dbh;
-	# check for overdue fine
-	my $sth = $dbh->prepare("select * from accountlines where (borrowernumber = ?) and (itemnumber = ?) and (accounttype='FU' or accounttype='O')");
-	$sth->execute($brn,$itm);
-	# alter fine to show that the book has been returned
-	if (my $data = $sth->fetchrow_hashref) {
-		my $usth=$dbh->prepare("update accountlines set accounttype='F' where (borrowernumber = ?) and (itemnumber = ?) and (accountno = ?)");
-		$usth->execute($brn,$itm,$data->{'accountno'});
-		$usth->finish();
-	}
-	$sth->finish();
-	return;
-}
-
-
-
-
-
-# Not exported
-sub checkoverdues {
-# From Main.pm, modified to return a list of overdueitems, in addition to a count
-  #checks whether a borrower has overdue items
-	my ($env, $bornum, $dbh)=@_;
-	my $today=get_today();
-	my @overdueitems;
-	my $count = 0;
-	my $sth = $dbh->prepare("SELECT issues.* , i.biblionumber as biblionumber,b.* FROM issues, items i,biblio b
-			WHERE  i.itemnumber=issues.itemnumber
-				AND i.biblionumber=b.biblionumber
-				AND issues.borrowernumber  = ?
-				AND issues.returndate is NULL
-				AND issues.date_due < ?");
-	$sth->execute($bornum,$today);
-	while (my $data = $sth->fetchrow_hashref) {
-	
-	push (@overdueitems, $data);
-	$count++;
-	}
-	$sth->finish;
-	return ($count, \@overdueitems);
-}
-
-# Not exported
-sub currentborrower {
-# Original subroutine for Circ2.pm
-	my ($itemnumber) = @_;
-	my $dbh = C4::Context->dbh;
-	
-	my $sth=$dbh->prepare("select borrowers.borrowernumber from
-	issues,borrowers where issues.itemnumber=? and
-	issues.borrowernumber=borrowers.borrowernumber and issues.returndate is
-	NULL");
-	$sth->execute($itemnumber);
-	my ($borrower) = $sth->fetchrow;
-	return($borrower);
-}
-# Not exported
-sub currentreturningborrower {
-# Original subroutine for Circ2.pm
-	my ($itemnumber) = @_;
-	my $dbh = C4::Context->dbh;
-	
-	my $sth=$dbh->prepare("select * from
-	issues,borrowers where issues.itemnumber=? and
-	issues.borrowernumber=borrowers.borrowernumber and issues.returndate=CURRENT_DATE and ( HOUR(TIMEDIFF(CURRENT_TIMESTAMP,timestamp))<24)");
-	$sth->execute($itemnumber);
-	my ($borrower) = $sth->fetchrow_hashref;
-	return($borrower);
-}
-# FIXME - Not exported, but used in 'updateitem.pl' anyway.
-sub checkreserve_to_delete {
-# Check for reserves for biblio
-	my ($env,$dbh,$itemnum)=@_;
-	my $resbor = "";
-	my $sth = $dbh->prepare("select * from reserves,items
-	where (items.itemnumber = ?)
-	and (reserves.cancellationdate is NULL)
-	and (items.biblionumber = reserves.biblionumber)
-	and ((reserves.found = 'W')
-	or (reserves.found is null))
-	order by priority");
-	$sth->execute($itemnum);
-	my $resrec;
-	my $data=$sth->fetchrow_hashref;
-	while ($data && $resbor eq '') {
-	$resrec=$data;
-	my $const = $data->{'constrainttype'};
-	if ($const eq "a") {
-	$resbor = $data->{'borrowernumber'};
-	} else {
-	my $found = 0;
-	my $csth = $dbh->prepare("select * from reserveconstraints,items
-		where (borrowernumber=?)
-		and reservedate=?
-		and reserveconstraints.biblionumber=?
-		and (items.itemnumber=? )");
-	$csth->execute($data->{'borrowernumber'},$data->{'biblionumber'},$data->{'reservedate'},$itemnum);
-	if (my $cdata=$csth->fetchrow_hashref) {$found = 1;}
-	if ($const eq 'o') {
-		if ($found eq 1) {$resbor = $data->{'borrowernumber'};}
-	} else {
-		if ($found eq 0) {$resbor = $data->{'borrowernumber'};}
-	}
-	$csth->finish();
-	}
-	$data=$sth->fetchrow_hashref;
-	}
-	$sth->finish;
-	return ($resbor,$resrec);
-}
-
-=head2 currentissues
-
-  $issues = &currentissues($env, $borrower);
-
-Returns a list of books currently on loan to a patron.
-
-If C<$env-E<gt>{todaysissues}> is set and true, C<&currentissues> only
-returns information about books issued today. If
-C<$env-E<gt>{nottodaysissues}> is set and true, C<&currentissues> only
-returns information about books issued before today. If both are
-specified, C<$env-E<gt>{todaysissues}> is ignored. If neither is
-specified, C<&currentissues> returns all of the patron's issues.
-
-C<$borrower->{borrowernumber}> is the borrower number of the patron
-whose issues we want to list.
-
-C<&currentissues> returns a PHP-style array: C<$issues> is a
-reference-to-hash whose keys are integers in the range 1...I<n>, where
-I<n> is the number of items on issue (either today or before today).
-C<$issues-E<gt>{I<n>}> is a reference-to-hash whose keys are all of
-the fields of the biblio, biblioitems, items, and issues fields of the
-Koha database for that particular item.
-
-=cut
-
-#'
-sub currentissues {
-# New subroutine for Circ2.pm
-	my ($env, $borrower) = @_;
-	my $dbh = C4::Context->dbh;
-	my %currentissues;
-	my $counter=1;
-	my $borrowernumber = $borrower->{'borrowernumber'};
-	my $crit='';
-
-	# Figure out whether to get the books issued today, or earlier.
-	# FIXME - $env->{todaysissues} and $env->{nottodaysissues} can
-	# both be specified, but are mutually-exclusive. This is bogus.
-	# Make this a flag. Or better yet, return everything in (reverse)
-	# chronological order and let the caller figure out which books
-	# were issued today.
-	my $today=get_today();
-	if ($env->{'todaysissues'}) {
-		
-		$crit=" and issues.timestamp like '$today%' ";
-	}
-	if ($env->{'nottodaysissues'}) {
-		
-		$crit=" and !(issues.timestamp like '$today%') ";
-	}
-
-	# FIXME - Does the caller really need every single field from all
-	# four tables?
-	my $sth=$dbh->prepare("select * from issues,items where
-	borrowernumber=? and issues.itemnumber=items.itemnumber and
-	 returndate is null
-	$crit order by issues.date_due");
-	$sth->execute($borrowernumber);
-	while (my $data = $sth->fetchrow_hashref) {
-
-		
-		if ($data->{'date_due'} lt $today) {
-			$data->{'overdue'}=1;
-		}
-		my $itemnumber=$data->{'itemnumber'};
-		# FIXME - Consecutive integers as hash keys? You have GOT to
-		# be kidding me! Use an array, fercrissakes!
-		$currentissues{$counter}=$data;
-		$counter++;
-	}
-	$sth->finish;
-	return(\%currentissues);
-}
-
-=head2 getissues
-
-  $issues = &getissues($borrowernumber);
-
-Returns the set of books currently on loan to a patron.
-
-C<$borrowernumber> is the patron's borrower number.
-
-C<&getissues> returns a PHP-style array: C<$issues> is a
-reference-to-hash whose keys are integers in the range 0..I<n>-1,
-where I<n> is the number of books the patron currently has on loan.
-
-The values of C<$issues> are references-to-hash whose keys are
-selected fields from the issues, items, biblio, and biblioitems tables
-of the Koha database.
-
-=cut
-#'
-sub getissues {
-	my ($borrower) = @_;
-	my $dbh = C4::Context->dbh;
-	my $borrowernumber = $borrower->{'borrowernumber'};
-	my %currentissues;
-	my $bibliodata;
-	my @results;
-	my $todaysdate=get_today();
-	my $counter = 0;
-	my $select = "SELECT *
-			FROM issues,items,biblio
-			WHERE issues.borrowernumber  = ?
-			AND issues.itemnumber      = items.itemnumber
-			AND items.biblionumber      = biblio.biblionumber
-			AND issues.returndate      IS NULL
-			ORDER BY issues.date_due";
-	#    print $select;
-	my $sth=$dbh->prepare($select);
-	$sth->execute($borrowernumber);
-	while (my $data = $sth->fetchrow_hashref) { 	
-		if ($data->{'date_due'}  lt $todaysdate) {
-			$data->{'overdue'} = 1;
-		}
-		$currentissues{$counter} = $data;
-		$counter++;
-	}
-	$sth->finish;
-	
-	return(\%currentissues);
-}
-
-# Not exported
-sub checkwaiting {
-# check for reserves waiting
-	my ($env,$dbh,$bornum)=@_;
-	my @itemswaiting;
-	my $sth = $dbh->prepare("select * from reserves where (borrowernumber = ?) and (reserves.found='W') and cancellationdate is NULL");
-	$sth->execute($bornum);
-	my $cnt=0;
-	if (my $data=$sth->fetchrow_hashref) {
-		$itemswaiting[$cnt] =$data;
-		$cnt ++
-	}
-	$sth->finish;
-	return ($cnt,\@itemswaiting);
-}
-
-=head2 renewstatus
-
-  $ok = &renewstatus($env, $dbh, $borrowernumber, $itemnumber);
-
-Find out whether a borrowed item may be renewed.
-
-C<$env> is ignored.
-
-C<$dbh> is a DBI handle to the Koha database.
-
-C<$borrowernumber> is the borrower number of the patron who currently
-has the item on loan.
-
-C<$itemnumber> is the number of the item to renew.
-
-C<$renewstatus> returns a true value iff the item may be renewed. The
-item must currently be on loan to the specified borrower; renewals
-must be allowed for the item's type; and the borrower must not have
-already renewed the loan.
-
-=cut
-
-sub renewstatus {
-	# check renewal status
-	##If system preference "strictrenewals" is used This script will try to return $renewok=2 or $renewok=3 as error messages
-	## 
-	my ($env,$bornum,$itemnumber)=@_;
-	my $dbh=C4::Context->dbh;
-	my $renews = 1;
-	my $resfound;
-	my $resrec;
-	my $renewokay=0; ##
-	# Look in the issues table for this item, lent to this borrower,
-	# and not yet returned.
-my $borrower=C4::Members::getpatroninformation($dbh,$bornum,undef);
-	
-	# FIXME - I think this function could be redone to use only one SQL call.
-  my $data1=getiteminformation($dbh,$itemnumber);
-	if ($data1 ) {
-		# Found a matching item
-		##privileged get renewal whatever the case may be
-			if ($borrower->{'categorycode'} eq 'P'){
-			$renewokay = 1;
-			return $renewokay;
-			}
-		
-	##Find renewals of this item
-	my $rsth=$dbh->prepare("Select renewals from issues where itemnumber=? and borrowernumber=? and returndate is null");
-	$rsth->execute($data1->{itemnumber},$borrower->{borrowernumber});
-	$data1->{'renewals'}=$rsth->fetchrow;
-	$rsth->finish;
-		# See if this item may be renewed. 
-		my $sth2 = $dbh->prepare("select renewalsallowed from itemtypes	where itemtypes.itemtype=?");
-		$sth2->execute($data1->{ctype});
-		if (my $data2=$sth2->fetchrow_hashref) {
-		$renews = $data2->{'renewalsallowed'};
-		}
-		if ($renews > $data1->{'renewals'}) {
-			$renewokay= 1;
-		}else{
-			if (C4::Context->preference("strictrenewals")){
-			$renewokay=3 ;
-			}
-		}
-		$sth2->finish;
-		 ($resfound, $resrec) = CheckReserves($itemnumber);
-		if ($resfound) {
-			if (C4::Context->preference("strictrenewals")){
-			$renewokay=4;
-			}else{
-			       $renewokay = 0;
-         			 }
-		}
-		 ($resfound, $resrec) = CheckReserves($itemnumber);
-               		 if ($resfound) {
-              		 	 if (C4::Context->preference("strictrenewals")){
-						$renewokay=4;
-				}else{
-			   	   		 $renewokay = 0;
-          				  }
-			}
-     if (C4::Context->preference("strictrenewals")){
-	### A new system pref "allowRenewalsBefore" prevents the renewal before a set amount of days left before expiry
-	## Try to find whether book can be renewed at this date
-	my $loanlength;
-
-	my $allowRenewalsBefore = C4::Context->preference("allowRenewalsBefore");
-	my $today=get_today();
-
-	# Find the issues record for this book### 
-	my $sth=$dbh->prepare("select SUBDATE(date_due, $allowRenewalsBefore)  from issues where itemnumber=? and returndate is null");
-	$sth->execute($itemnumber);
-	my $startdate=$sth->fetchrow;
-	$sth->finish;
-	
-	my $difference = DATE_diff($today,$startdate);
-	if  ($difference < 0) {
-	$renewokay=2 ;
-	}
-     }##strictrenewals	
-	}##item found
-#	$sth1->finish;
-
-	return($renewokay);
-}
-
-=head2 renewbook
-
-  &renewbook($env, $borrowernumber, $itemnumber, $datedue);
-
-Renews a loan.
-
-C<$env-E<gt>{branchcode}> is the code of the branch where the
-renewal is taking place.
-
-C<$env-E<gt>{usercode}> is the value to log in C<statistics.usercode>
-in the Koha database.
-
-C<$borrowernumber> is the borrower number of the patron who currently
-has the item.
-
-C<$itemnumber> is the number of the item to renew.
-
-C<$datedue> can be used to set the due date. If C<$datedue> is the
-empty string, C<&renewbook> will calculate the due date automatically
-from the book's item type. If you wish to set the due date manually,
-C<$datedue> should be in the form YYYY-MM-DD.
-
-=cut
-
-sub renewbook {
-	my ($env,$bornum,$itemnumber,$datedue)=@_;
-	# mark book as renewed
-
-	my $loanlength;
-my $dbh=C4::Context->dbh;
-my $sth;
-my  $iteminformation = getiteminformation($env, $itemnumber,0);
-		
-
-
-if ($datedue eq "" ) {
-
-		my  $borrower = C4::Members::getpatroninformation($env,$bornum,0);
-		 $loanlength = getLoanLength($borrower->{'categorycode'},$iteminformation->{'ctype'},$borrower->{'branchcode'});
-	
-		my $datedue=get_today();
-		my $calendar = C4::Calendar::Calendar->new(branchcode => $borrower->{'branchcode'});
-		my ($yeardue, $monthdue, $daydue) = split /-/, $datedue;
-		($daydue, $monthdue, $yeardue) = $calendar->addDate($daydue, $monthdue, $yeardue, $loanlength);
-		$datedue = "$yeardue-".sprintf ("%0.2d", $monthdue)."-". sprintf("%0.2d",$daydue);
-		
-	# Update the issues record to have the new due date, and a new count
-	# of how many times it has been renewed.
-	
-	$sth=$dbh->prepare("update issues set date_due = ?, renewals = renewals+1
-		where borrowernumber=? and itemnumber=? and returndate is null");
-	$sth->execute($datedue,$bornum,$itemnumber);
-	$sth->finish;
-
-	## Update items and marc record with new date -T.G
-	&XMLmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'date_due',$datedue);
-		
-	# Log the renewal
-	UpdateStats($env,$env->{'branchcode'},'renew','','',$itemnumber,$iteminformation->{'ctype'},$bornum);
-
-	# Charge a new rental fee, if applicable?
-	my ($charge,$type)=calc_charges($env, $itemnumber, $bornum);
-	if ($charge > 0){
-		my $accountno=getnextacctno($env,$bornum,$dbh);
-		$sth=$dbh->prepare("Insert into accountlines (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
-							values (?,?,now(),?,?,?,?,?)");
-		$sth->execute($bornum,$accountno,$charge,"Renewal of Rental Item $iteminformation->{'title'} $iteminformation->{'barcode'}",'Rent',$charge,$itemnumber);
-		$sth->finish;
-	#     print $account;
-	}# end of rental charge
-		
-	return format_date($datedue);
-	}
-
- 
-	
-}
-
-
-
-
-
-
-
-
-=item find_reserves
-
-  ($status, $record) = &find_reserves($itemnumber);
-
-Looks up an item in the reserves.
-
-C<$itemnumber> is the itemnumber to look up.
-
-C<$status> is true iff the search was successful.
-
-C<$record> is a reference-to-hash describing the reserve. Its keys are
-the fields from the reserves table of the Koha database.
-
-=cut
-#'
-# FIXME - This API is bogus: just return the record, or undef if none
-# was found.
-
-sub find_reserves {
-    my ($itemnumber) = @_;
-    my $dbh = C4::Context->dbh;
-    my ($itemdata) = getiteminformation("", $itemnumber,0);
-    my $sth = $dbh->prepare("select * from reserves where ((found = 'W') or (found is null)) and biblionumber = ? and cancellationdate is NULL order by priority, reservedate");
-    $sth->execute($itemdata->{'biblionumber'});
-    my $resfound = 0;
-    my $resrec;
-    my $lastrec;
-
-    # FIXME - I'm not really sure what's going on here, but since we
-    # only want one result, wouldn't it be possible (and far more
-    # efficient) to do something clever in SQL that only returns one
-    # set of values?
-while ($resrec = $sth->fetchrow_hashref) {
-	$lastrec = $resrec;
-      if ($resrec->{'found'} eq "W") {
-	    if ($resrec->{'itemnumber'} eq $itemnumber) {
-		$resfound = 1;
-	    }
-        } else {
-	    # FIXME - Use 'elsif' to avoid unnecessary indentation.
-	    if ($resrec->{'constrainttype'} eq "a") {
-		$resfound = 1;	
-	    } else {
-			my $consth = $dbh->prepare("select * from reserveconstraints where borrowernumber = ? and reservedate = ? and biblionumber = ? ");
-			$consth->execute($resrec->{'borrowernumber'},$resrec->{'reservedate'},$resrec->{'biblionumber'});
-			if (my $conrec = $consth->fetchrow_hashref) {
-				if ($resrec->{'constrainttype'} eq "o") {
-				$resfound = 1;
-				
-				}
-			}
-		$consth->finish;
-		}
-	}
-	if ($resfound) {
-	    my $updsth = $dbh->prepare("update reserves set found = 'W', itemnumber = ? where borrowernumber = ? and reservedate = ? and biblionumber = ?");
-	    $updsth->execute($itemnumber,$resrec->{'borrowernumber'},$resrec->{'reservedate'},$resrec->{'biblionumber'});
-	    $updsth->finish;
-	    last;
-	}
-    }
-    $sth->finish;
-    return ($resfound,$lastrec);
-}
-
-sub fixdate {
-    my ($year, $month, $day) = @_;
-    my $invalidduedate;
-    my $date;
-    if (($year eq 0) && ($month eq 0) && ($year eq 0)) {
-#	$env{'datedue'}='';
-    } else {
-	if (($year eq 0) || ($month eq 0) || ($year eq 0)) {
-	    $invalidduedate=1;
-	} else {
-	    if (($day>30) && (($month==4) || ($month==6) || ($month==9) || ($month==11))) {
-		$invalidduedate = 1;
-	    } elsif (($day > 29) && ($month == 2)) {
-		$invalidduedate=1;
-	    } elsif (($month == 2) && ($day > 28) && (($year%4) && ((!($year%100) || ($year%400))))) {
-		$invalidduedate=1;
-	    } else {
-		$date="$year-$month-$day";
-	    }
-	}
-    }
-    return ($date, $invalidduedate);
-}
-
-sub get_current_return_date_of {
-    my (@itemnumbers) = @_;
-
-    my $query = '
-SELECT date_due,
-       itemnumber
-  FROM issues
-  WHERE itemnumber IN ('.join(',', @itemnumbers).') AND returndate IS NULL
-';
-    return get_infos_of($query, 'itemnumber', 'date_due');
-}
-
-sub get_transfert_infos {
-    my ($itemnumber) = @_;
-
-    my $dbh = C4::Context->dbh;
-
-    my $query = '
-SELECT datesent,
-       frombranch,
-       tobranch
-  FROM branchtransfers
-  WHERE itemnumber = ?
-    AND datearrived IS NULL
-';
-    my $sth = $dbh->prepare($query);
-    $sth->execute($itemnumber);
-
-    my @row = $sth->fetchrow_array();
-
-    $sth->finish;
-
-    return @row;
-}
-
-
-sub DeleteTransfer {
-	my($itemnumber) = @_;
-	my $dbh = C4::Context->dbh;
-    	my $sth=$dbh->prepare("DELETE FROM branchtransfers
-	where itemnumber=?
-	AND datearrived is null ");
-	$sth->execute($itemnumber);
-	$sth->finish;
-}
-
-sub GetTransfersFromBib {
-	my($frombranch,$tobranch) = @_;
-	my $dbh = C4::Context->dbh;
-    	my $sth=$dbh->prepare("SELECT itemnumber,datesent,frombranch FROM
-	 branchtransfers 
-	where frombranch=?
-	AND tobranch=? 
-	AND datearrived is null ");
-	$sth->execute($frombranch,$tobranch);
-	my @gettransfers;
-	my $i=0;
-	while (my $data=$sth->fetchrow_hashref){
-		$gettransfers[$i]=$data;
-		$i++;
-    	}
-    	$sth->finish;
-    	return(@gettransfers);	
-}
-
-sub GetReservesToBranch {
-	my($frombranch,$default) = @_;
-	my $dbh = C4::Context->dbh;
-    	my $sth=$dbh->prepare("SELECT borrowernumber,reservedate,itemnumber,timestamp FROM
-	 reserves 
-	where priority='0' AND cancellationdate is null  
-	AND branchcode=?
-	AND branchcode!=?
-	AND found is null ");
-	$sth->execute($frombranch,$default);
-	my @transreserv;
-	my $i=0;
-	while (my $data=$sth->fetchrow_hashref){
-		$transreserv[$i]=$data;
-		$i++;
-    	}
-    	$sth->finish;
-    	return(@transreserv);	
-}
-
-sub GetReservesForBranch {
-	my($frombranch) = @_;
-	my $dbh = C4::Context->dbh;
-    	my $sth=$dbh->prepare("SELECT borrowernumber,reservedate,itemnumber,waitingdate FROM
-	 reserves 
-	where priority='0' AND cancellationdate is null 
-	AND found='W' 
-	AND branchcode=? order by reservedate");
-	$sth->execute($frombranch);
-	my @transreserv;
-	my $i=0;
-	while (my $data=$sth->fetchrow_hashref){
-		$transreserv[$i]=$data;
-		$i++;
-    	}
-    	$sth->finish;
-    	return(@transreserv);	
-}
-
-sub checktransferts{
-	my($itemnumber) = @_;
-	my $dbh = C4::Context->dbh;
-    	my $sth=$dbh->prepare("SELECT datesent,frombranch,tobranch FROM branchtransfers
-        WHERE itemnumber = ? AND datearrived IS NULL");
-	$sth->execute($itemnumber);
-	my @tranferts = $sth->fetchrow_array;
-	$sth->finish;
-
-	return (@tranferts);
-}
-
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Circulation/Circ3.pm
===================================================================
RCS file: modules/C4/Circulation/Circ3.pm
diff -N modules/C4/Circulation/Circ3.pm
--- modules/C4/Circulation/Circ3.pm	10 Mar 2007 01:39:27 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,577 +0,0 @@
-# -*- tab-width: 8 -*-
-# Please use 8-character tabs for this file (indents are every 4 characters)
-
-package C4::Circulation::Circ3;
-
-# $Id: Circ3.pm,v 1.1.2.1 2007/03/10 01:39:27 tgarip1957 Exp $
-
-#package to deal with reserve section Returns
-#
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-# use warnings;
-require Exporter;
-
-use C4::Context;
-use C4::Stats;
-use C4::Reserves2;
-use C4::Koha;
-use C4::Accounts2;
-use C4::Date;
-use C4::Biblio;
-use C4::Search;
-use C4::Circulation::Circ2;
-use C4::Members;
-use C4::Circulation::Fines;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Circulation::Circ3 - Koha circulation module for NEU RESERVE section
-
-=head1 SYNOPSIS
-
-  use C4::Circulation::Circ3;
-
-=head1 DESCRIPTION
-
-The functions in this module deal with circulation, issues, and
-returns, as well as general information about the library.
-Also deals with stocktaking.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-	 &getissuesr  
-	&canbookbeissuedr &issuebookr &returnbookr 
-	);
-
-
-=head2 canbookbeissued
-
-Check if a book can be issued.
-
-my ($issuingimpossible,$needsconfirmation) = canbookbeissuedr($env,$borrower,$barcode,$year,$month,$day);
-
-=over 4
-
-C<$env> Environment variable. Should be empty usually, but used by other subs. Next code cleaning could drop it.
-
-C<$borrower> hash with borrower informations (from getpatroninformation)
-
-C<$barcode> is the bar code of the book being issued.
-
-C<$year> C<$month> C<$day> contains the date of the return (in case it's forced by "stickyduedate".
-
-=back
-
-Returns :
-
-=over 4
-
-C<$issuingimpossible> a reference to a hash. It contains reasons why issuing is impossible.
-Possible values are :
-
-=head3 INVALID_DATE 
-
-sticky due date is invalid
-
-=head3 GNA
-
-borrower gone with no address
-
-=head3 CARD_LOST
- 
-borrower declared it's card lost
-
-=head3 DEBARRED
-
-borrower debarred
-
-=head3 UNKNOWN_BARCODE
-
-barcode unknown
-
-=head3 NOT_FOR_LOAN
-
-item is not for loan
-
-=head3 WTHDRAWN
-
-item withdrawn.
-
-=head3 RESTRICTED
-
-item is restricted (set by ??)
-
-=back
-
-C<$issuingimpossible> a reference to a hash. It contains reasons why issuing is impossible.
-Possible values are :
-
-=head3 DEBT
-
-borrower has debts.
-
-=head3 RENEW_ISSUE
-
-renewing, not issuing
-
-=head3 ISSUED_TO_ANOTHER
-
-issued to someone else.
-
-=head3 RESERVED
-
-reserved for someone else.
-
-=head3 INVALID_DATE
-
-sticky due date is invalid
-
-=head3 TOO_MANY
-
-if the borrower borrows to much things
-
-=cut
-
-# check if a book can be issued.
-# returns an array with errors if any
-
-
-
-sub canbookbeissuedr {
-	my ($env,$borrower,$barcode,$year,$month,$day,$renew) = @_;
-	my %needsconfirmation; # filled with problems that needs confirmations
-	my %issuingimpossible; # filled with problems that causes the issue to be IMPOSSIBLE
-	my $iteminformation = C4::Circulation::Circ2::getiteminformation($env, 0, $barcode);
-	my $dbh = C4::Context->dbh;
-#
-# DUE DATE is OK ?
-#
-#	my ($duedate, $invalidduedate) = fixdate($year, $month, $day);
-#	$issuingimpossible{INVALID_DATE} = 1 if ($invalidduedate);
-my $duedate;
-#
-# BORROWER STATUS
-#
-	if ($borrower->{flags}->{GNA}) {
-		$issuingimpossible{GNA} = 1;
-	}
-	if ($borrower->{flags}->{'LOST'}) {
-		$issuingimpossible{CARD_LOST} = 1;
-	}
-	if ($borrower->{flags}->{'DBARRED'}) {
-		$issuingimpossible{DEBARRED} = 1;
-	}
-	my $today=get_today();
-	if (DATE_diff($borrower->{expiry},$today)<0) {
-		$issuingimpossible{EXPIRED} = 1;
-	}
-#
-# BORROWER STATUS
-#
-
-# DEBTS
-	my $amount = C4::Accounts2::checkaccount($env,$borrower->{'borrowernumber'}, $dbh,$duedate);
-	if ($amount >0) {
-		$needsconfirmation{DEBT} = $amount;
-	}
-
-
-#
-# JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS
-#
-	my $sth2 = $dbh->prepare("select COUNT(*) from reserveissue i where i.borrowernumber = ? and i.rettime is null ");
-	$sth2->execute($borrower->{'borrowernumber'});
-	my $toomany=$sth2->fetchrow;
-	$needsconfirmation{TOO_MANY} =  $toomany if $toomany;
-
-#
-# ITEM CHECKING
-#
-	unless ($iteminformation->{barcode}) {
-		$issuingimpossible{UNKNOWN_BARCODE} = 1;
-	}
-	if (uc($iteminformation->{'shelf'}) ne 'RES') {
-		$issuingimpossible{NOT_INRESERVE} = 1;
-	}
-	if ($iteminformation->{'ctype'} eq 'REF') {
-		$issuingimpossible{NOT_FOR_LOAN} = 1;
-	}
-	if ($iteminformation->{'wthdrawn'} == 1) {
-		$issuingimpossible{WTHDRAWN} = 1;
-	}
-	if ($iteminformation->{'restricted'} == 1) {
-		$issuingimpossible{RESTRICTED} = 1;
-	}
-
-
-
-#
-# CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER
-#
-	my ($currentborrower) = currentresborrower($iteminformation->{'itemnumber'});
-	if ($currentborrower eq $borrower->{'borrowernumber'}) {
-# Already issued to current borrower. Ask whether the loan should
-# be renewed.
-#		my ($renewstatus) = renewstatus($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
-#		if ($renewstatus == 0) { # no more renewals allowed
-			$issuingimpossible{NO_MORE_RENEWALS} = 1;
-#		} else {
-#warn "renew:$renew";
-#		if (!$renew){	$needsconfirmation{RENEW_ISSUE} = 1;
-#				}
-			
-#		}
-	} elsif ($currentborrower) {
-# issued to someone else
-		my $currborinfo = C4::Members::getpatroninformation(0,$currentborrower);
-#		warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
-		$needsconfirmation{ISSUED_TO_ANOTHER} = "$currborinfo->{'reservedate'} : $currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
-	}
-
-	return(\%issuingimpossible,\%needsconfirmation);
-}
-
-=head2 issuebook
-
-Issue a book. Does no check, they are done in canbookbeissued. If we reach this sub, it means the user confirmed if needed.
-
-&issuebookr($env,$borrower,$barcode,$date)
-
-=over 4
-
-C<$env> Environment variable. Should be empty usually, but used by other subs. Next code cleaning could drop it.
-
-C<$borrower> hash with borrower informations (from getpatroninformation)
-
-C<$barcode> is the bar code of the book being issued.
-
-C<$date> contains the max date of return. calculated if empty.
-
-=cut
-
-#
-# issuing book. We already have checked it can be issued, so, just issue it !
-#
-sub issuebookr {
-	my ($env,$borrower,$barcode,$cancelreserve) = @_;
-	my $dbh = C4::Context->dbh;
-
-
-	my $iteminformation = getiteminformation($env, 0, $barcode);
-	my $bibliorecord=XMLgetbibliohash($dbh,$iteminformation->{biblionumber});
-	
-#
-# check if we just renew the issue.
-#
-	my ($currentborrower) = currentresborrower($iteminformation->{'itemnumber'});
-	if ($currentborrower eq $borrower->{'borrowernumber'}) {
-		my ($charge,$itemtype) = calc_charges($env, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'});
-		if ($charge > 0) {
-			createcharge($env, $dbh, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'}, $charge);
-			$iteminformation->{'charge'} = $charge;
-		}
-		&UpdateStats($env,$env->{'branchcode'},'renew',$charge,'',$iteminformation->{'itemnumber'},$iteminformation->{'ctype'},$borrower->{'borrowernumber'});
-		renewbook($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
-	} else {
-#
-# NOT a renewal
-#
-		if ($currentborrower ne '') {
-			# This book is currently on loan, but not to the person
-			# who wants to borrow it now. mark it returned before issuing to the new borrower
-			returnbookr($iteminformation->{'barcode'}, $env->{'branchcode'});
-		}
-
-		# Record in the database the fact that the book was issued.
-		my $sth=$dbh->prepare("insert into reserveissue (borrowernumber, itemnumber, duetime,restime) values (?,?,?,now())");
-		my $loanlength = C4::Context->preference('Reserveperiod');
-		my $datedue=time+($loanlength)*3600+900;
-		my @datearr = localtime($datedue);
-		my $dateduef = (1900+$datearr[5])."-".sprintf ("%0.2d",$datearr[4]+1)."-".sprintf ("%0.2d",$datearr[3])." ".sprintf ("%0.2d",$datearr[2]).":".sprintf ("%0.2d",$datearr[1]).":".sprintf ("%0.2d",$datearr[0]);
-#		if ($date) {
-#			$dateduef=$date;
-#		}
-		$sth->execute($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'}, $dateduef);
-		$sth->finish;
-##Update totalissues of bibliorecord if exist
-   my $totalissue=XML_readline_onerecord($bibliorecord,"totalissue","biblios");
-$totalissue=scalar($totalissue);
-	$totalissue++;
-my $extras=length($totalissue);
-	for (1..(6-$extras)){
-	$totalissue="0".$totalissue;
-	}
-	$bibliorecord=XML_writeline($bibliorecord,"totalissue",$totalissue,"biblios");
-	my $frameworkcode=MARCfind_frameworkcode($dbh,$iteminformation->{'biblionumber'});
-		 C4::Biblio::OLDmodbiblio($dbh,$bibliorecord,$iteminformation->{'biblionumber'},$frameworkcode);
-###
-
-		$iteminformation->{'issues'}++;
-		&XMLmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'date_due',$dateduef,1);
-		&XMLmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'issues',$iteminformation->{'issues'},1);
-		&XMLmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'onloan','1',1);
-
-		&itemseen($dbh,$iteminformation->{'itemnumber'});
-		# If it costs to borrow this book, charge it to the patron's account.
-		my ($charge,$itemtype)=calc_charges($env, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'});
-		if ($charge > 0) {
-			createcharge($env, $dbh, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'}, $charge);
-			$iteminformation->{'charge'}=$charge;
-		}
-		# Record the fact that this book was issued.
-		&UpdateStats($env,$env->{'branchcode'},'issue',$charge,'',$iteminformation->{'itemnumber'},$iteminformation->{'ctype'},$borrower->{'borrowernumber'});
-	}
-}
-
-=head2 getLoanLength
-
-Get loan length for an itemtype, a borrower type and a branch
-
-my $loanlength = &getLoanLength($borrowertype,$itemtype,branchcode)
-
-=cut
-
-=head2 returnbook
-
-  ($doreturn, $messages, $iteminformation, $borrower) =
-	  &returnbookr($barcode, $branch);
-
-Returns a book.
-
-C<$barcode> is the bar code of the book being returned. C<$branch> is
-the code of the branch where the book is being returned.
-
-C<&returnbook> returns a list of four items:
-
-C<$doreturn> is true iff the return succeeded.
-
-C<$messages> is a reference-to-hash giving the reason for failure:
-
-=over 4
-
-=item C<BadBarcode>
-
-No item with this barcode exists. The value is C<$barcode>.
-
-=item C<NotIssued>
-
-The book is not currently on loan. The value is C<$barcode>.
-
-=item C<IsPermanent>
-
-The book's home branch is a permanent collection. If you have borrowed
-this book, you are not allowed to return it. The value is the code for
-the book's home branch.
-
-=item C<wthdrawn>
-
-This book has been withdrawn/cancelled. The value should be ignored.
-
-=item C<ResFound>
-
-The item was reserved. The value is a reference-to-hash whose keys are
-fields from the reserves table of the Koha database, and
-C<biblioitemnumber>. It also has the key C<ResFound>, whose value is
-either C<Waiting>, C<Reserved>, or 0.
-
-=back
-
-C<$borrower> is a reference-to-hash, giving information about the
-patron who last borrowed the book.
-
-=cut
-
-# FIXME - This API is bogus. There's no need to return $borrower and
-# $iteminformation; the caller can ask about those separately, if it
-# cares (it'd be inefficient to make two database calls instead of
-# one, but &getpatroninformation and &getiteminformation can be
-# memoized if this is an issue).
-#
-# The ($doreturn, $messages) tuple is redundant: if the return
-# succeeded, that's all the caller needs to know. So &returnbook can
-# return 1 and 0 on success and failure, and set
-# $C4::Circulation::Circ2::errmsg to indicate the error. Or it can
-# return undef for success, and an error message on error (though this
-# is more C-ish than Perl-ish).
-
-sub returnbookr {
-	my ($barcode, $branch) = @_;
-	my %env;
-	my $messages;
-	my $dbh = C4::Context->dbh;
-	my $doreturn = 1;
-	die '$branch not defined' unless defined $branch; # just in case (bug 170)
-	# get information on item
-	my ($iteminformation) = getiteminformation(\%env, 0, $barcode);
-	if (not $iteminformation) {
-		$messages->{'BadBarcode'} = $barcode;
-		$doreturn = 0;
-	}
-	# find the borrower
-	my ($currentborrower) = currentresborrower($iteminformation->{'itemnumber'});
-
-	if ((not $currentborrower) && $doreturn) {
-		$messages->{'NotIssued'} = $barcode;
-		$doreturn = 0;
-	}
-my ($od,$issue,$fines,$resfine)=borrdata3(\%env,$currentborrower);
-if ($resfine>0){
- UpdateFine($iteminformation->{'itemnumber'},$currentborrower,$resfine,'RES',$iteminformation->{'duetime'});
-}
-	# check if the book is in a permanent collection....
-	my $hbr = $iteminformation->{'homebranch'};
-	my $branches = GetBranches();
-	if ($branches->{$hbr}->{'PE'}) {
-		$messages->{'IsPermanent'} = $hbr;
-	}
-	# check that the book has been cancelled
-	if ($iteminformation->{'wthdrawn'}) {
-		$messages->{'wthdrawn'} = 1;
-		$doreturn = 0;
-	}
-	# update issues, thereby returning book (should push this out into another subroutine
-	my ($borrower) = C4::Members::getpatroninformation(\%env, $currentborrower, 0);
-	if ($doreturn) {
-		my $sth = $dbh->prepare("update reserveissue set rettime = now() where (borrowernumber = ?) and (itemnumber = ?) and (rettime is null)");
-		$sth->execute( $currentborrower, $iteminformation->{'itemnumber'});
-		$messages->{'WasReturned'} = 1; # FIXME is the "= 1" right?
-	
-	&XMLmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'date_due','',1);
-	&XMLmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'onloan','0',1);
-	}
-	my ($transfered, $mess, $item) = transferbook($branch, $barcode, 1);
-	itemseen($dbh,$iteminformation->{'itemnumber'});
-#	($borrower) = getpatroninformation(\%env, $currentborrower, 0);
-	# transfer book to the current branch
-	
-	if ($transfered) {
-		$messages->{'WasTransfered'} = 1; # FIXME is the "= 1" right?
-	}
-	# fix up the accounts.....
-	if ($iteminformation->{'itemlost'}) {
-#		fixaccountforlostandreturned($iteminformation, $currentborrower);
-		$messages->{'WasLost'} = 1; # FIXME is the "= 1" right?
-	}
-	# fix up the overdues in accounts...
-	fixoverduesonreturnres($currentborrower, $iteminformation->{'itemnumber'});
-	# find reserves.....
-	# update stats?
-	# Record the fact that this book was returned.
-	UpdateStats(\%env, $branch ,'return','0','',$iteminformation->{'itemnumber'},$iteminformation->{'ctype'},$borrower->{'borrowernumber'});
-	return ($doreturn, $messages, $iteminformation, $borrower);
-}
-sub fixoverduesonreturnres {
-	my ($brn, $itm) = @_;
-	my $dbh = C4::Context->dbh;
-	# check for overdue fine
-	my $sth = $dbh->prepare("select * from accountlines where (borrowernumber = ?) and (itemnumber = ?) and (accounttype='FU' or accounttype='O')");
-	$sth->execute($brn,$itm);
-	# alter fine to show that the book has been returned
-	if (my $data = $sth->fetchrow_hashref) {
-		my $usth=$dbh->prepare("update accountlines set accounttype='F' where (borrowernumber = ?) and (itemnumber = ?) and (accountno = ?)");
-		$usth->execute($brn,$itm,$data->{'accountno'});
-		$usth->finish();
-	}
-	$sth->finish();
-	return;
-}
-# Not exported
-sub currentresborrower {
-
-	my ($itemnumber) = @_;
-
-	my $dbh = C4::Context->dbh;
-	my $sth=$dbh->prepare("select borrowernumber from reserveissue where itemnumber=? and rettime is NULL");
-	$sth->execute($itemnumber);
-	my ($borrower) = $sth->fetchrow;
-	return($borrower);
-}
-=head2 getissues
-
-  $issues = &getissuesr($borrowernumber);
-
-Returns the set of books currently on loan to a patron.
-
-C<$borrowernumber> is the patron's borrower number.
-
-C<&getissues> returns a PHP-style array: C<$issues> is a
-reference-to-hash whose keys are integers in the range 0..I<n>-1,
-where I<n> is the number of books the patron currently has on loan.
-
-The values of C<$issues> are references-to-hash whose keys are
-selected fields from the issues, items, biblio, and biblioitems tables
-of the Koha database.
-
-=cut
-#'
-sub getissuesr {
-# New subroutine for Circ3.pm
-	my ($borrower) = @_;
-	my $dbh = C4::Context->dbh;
-	my $borrowernumber = $borrower->{'borrowernumber'};
-	my %currentissues;
-	my $select = "SELECT *,
-				timediff(now(),  reserveissue.duetime  ) as elapsed
-			
-			FROM reserveissue,items,biblio
-			WHERE reserveissue.borrowernumber  = ?
-			AND items.biblionumber=biblio.biblionumber
-			AND reserveissue.itemnumber      = items.itemnumber
-			AND reserveissue.rettime      IS NULL
-			";
-	#    print $select;
-	my $sth=$dbh->prepare($select);
-	$sth->execute($borrowernumber);
-	my $counter = 0;
-	while (my $data = $sth->fetchrow_hashref) {
-		if ($data->{'elapsed'}>0) {
-			$data->{'overdue'} = 1;
-		}
-		$currentissues{$counter} = $data;
-		$counter++;
-	}
-	$sth->finish;
-	return(\%currentissues);
-}
-
-
-
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Circulation/Fines.pm
===================================================================
RCS file: modules/C4/Circulation/Fines.pm
diff -N modules/C4/Circulation/Fines.pm
--- modules/C4/Circulation/Fines.pm	10 Mar 2007 01:39:27 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,304 +0,0 @@
-package C4::Circulation::Fines;
-
-# $Id: Fines.pm,v 1.1.2.1 2007/03/10 01:39:27 tgarip1957 Exp $
-
-# Copyright 2000-2002 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-
-use C4::Context;
-use C4::Biblio;
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Circulation::Fines - Koha module dealing with fines
-
-=head1 SYNOPSIS
-
-  use C4::Circulation::Fines;
-
-=head1 DESCRIPTION
-
-This module contains several functions for dealing with fines for
-overdue items. It is primarily used by the 'misc/fines2.pl' script.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(&Getoverdues &CalcFine &BorType &UpdateFine &ReplacementCost);
-
-=item Getoverdues
-
-  ($count, $overdues) = &Getoverdues();
-
-Returns the list of all overdue books.
-
-C<$count> is the number of elements in C<@{$overdues}>.
-
-C<$overdues> is a reference-to-array. Each element is a
-reference-to-hash whose keys are the fields of the issues table in the
-Koha database.
-
-=cut
-#'
-sub Getoverdues{
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("Select * from issues where date_due < now() and returndate is  NULL order by borrowernumber");
-  $sth->execute;
-  # FIXME - Use push @results
-  my $i=0;
-  my @results;
-  while (my $data=$sth->fetchrow_hashref){
-  push  @results,$data;
-    $i++;
-  }
-  $sth->finish;
-  return($i,\@results);
-}
-
-=item CalcFine
-
-  ($amount, $chargename, $message) =
-	&CalcFine($itemnumber, $borrowercode, $days_overdue);
-
-Calculates the fine for a book.
-
-The issuingrules table in the Koha database is a fine matrix, listing
-the penalties for each type of patron for each type of item and each branch (e.g., the
-standard fine for books might be $0.50, but $1.50 for DVDs, or staff
-members might get a longer grace period between the first and second
-reminders that a book is overdue).
-
-
-
-C<$itemnumber> is the book's item number.
-
-C<$borrowercode> is the borrower code of the patron who currently has
-the book.
-
-C<$days_overdue> is the number of days elapsed since the book's due
-date.
-
-C<&CalcFine> returns a list of three values:
-
-C<$amount> is the fine owed by the patron (see above).
-
-C<$chargename> is the chargename field from the applicable record in
-the issuingrules table, whatever that is.
-
-C<$message> is a text message, either "First Notice", "Second Notice",
-or "Final Notice".
-
-=cut
-#'
-sub CalcFine {
-  my ($itemnumber,$bortype,$difference)=@_;
-  my $dbh = C4::Context->dbh;
-  # Look up the issuingrules record for this book's item type and the
-  # given borrwer type.
- 
-
-  my $sth=$dbh->prepare("Select * from items,itemtypes,issuingrules where items.itemnumber=?
- and  items.ctype=itemtypes.itemtype and
-  issuingrules.itemtype=itemtypes.itemtype and
-  issuingrules.categorycode=? ");
-#  print $query;
-  $sth->execute($itemnumber,$bortype);
-  my $data=$sth->fetchrow_hashref;
-	# FIXME - Error-checking: the item might be lost, or there
-	# might not be an entry in 'issuingrules' for this item type
-	# or borrower type.
-  $sth->finish;
-  my $amount=0;
-  my $printout;
-
-  if ($difference > $data->{'firstremind'}){
-    # Yes. Set the fine as listed.
-$amount=$data->{'fine'}* $difference;
-
-    $printout="First Notice";
-  }
-
-  # Is it time to send out a second reminder?
-  my $second=$data->{'firstremind'}+$data->{chargeperiod};
-  if ($difference == $second){
-$amount=$data->{'fine'}* $difference;
-
-    $printout="Second Notice";
-  }
-
-  # Is it time to send the account to a collection agency?
-  # FIXME -This $data->{'accountsent'} is not seemed to be set in the DB
-  if ($difference == $data->{'accountsent'}){
-     $amount=$data->{'fine'}* $difference;
-
-    $printout="Final Notice";
-  }
-  return($amount,$data->{'chargename'},$printout);
-}
-
-=item UpdateFine
-
-  &UpdateFine($itemnumber, $borrowernumber, $amount, $type, $description);
-
-(Note: the following is mostly conjecture and guesswork.)
-
-Updates the fine owed on an overdue book.
-
-C<$itemnumber> is the book's item number.
-
-C<$borrowernumber> is the borrower number of the patron who currently
-has the book on loan.
-
-C<$amount> is the current amount owed by the patron.
-
-C<$type> will be used in the description of the fine.
-
-C<$description> is a string that must be present in the description of
-the fine. I think this is expected to be a date in DD/MM/YYYY format.
-
-C<&UpdateFine> looks up the amount currently owed on the given item
-and sets it to C<$amount>, creating, if necessary, a new entry in the
-accountlines table of the Koha database.
-
-=cut
-#'
-# FIXME - This API doesn't look right: why should the caller have to
-# specify both the item number and the borrower number? A book can't
-# be on loan to two different people, so the item number should be
-# sufficient.
-sub UpdateFine {
-  my ($itemnum,$bornum,$amount,$type,$due)=@_;
-  my $dbh = C4::Context->dbh;
-  # FIXME - What exactly is this query supposed to do? It looks up an
-  # entry in accountlines that matches the given item and borrower
-  # numbers, where the description contains $due, and where the
-  # account type has one of several values, but what does this _mean_?
-  # Does it look up existing fines for this item?
-  # FIXME - What are these various account types? ("FU", "O", "F", "M")
-
-  my $sth=$dbh->prepare("Select * from accountlines where itemnumber=? and
-  borrowernumber=? and (accounttype='FU' or accounttype='O' or
-  accounttype='F' or accounttype='M') ");
-  $sth->execute($itemnum,$bornum);
-
-  if (my $data=$sth->fetchrow_hashref){
-    # I think this if-clause deals with the case where we're updating
-    # an existing fine.
-#    print "in accounts ...";
-    if ($data->{'amount'} != $amount){
-
-#     print "updating";
-      my $diff=$amount - $data->{'amount'};
-      my $out=$data->{'amountoutstanding'}+$diff;
-      my $sth2=$dbh->prepare("update accountlines set date=now(), amount=?,
-      amountoutstanding=?,accounttype='FU' where
-      accountid=?");
-      $sth2->execute($amount,$out,$data->{'accountid'});
-      $sth2->finish;
-   } else {
- #     print "no update needed $data->{'amount'} \n";
-    }
-  } else {
-    # I think this else-clause deals with the case where we're adding
-    # a new fine.
-    my $sth4=$dbh->prepare("select title from biblio ,items where items.itemnumber=?
-    and biblio.biblionumber=items.biblionumber");
-    $sth4->execute($itemnum);
-    my $title=$sth4->fetchrow;
-    $sth4->finish;
- #   print "not in account";
-    my $sth3=$dbh->prepare("Select max(accountno) from accountlines");
-    $sth3->execute;
-    # FIXME - Make $accountno a scalar.
-    my $accountno=$sth3->fetchrow;
-    $sth3->finish;
-    $accountno++;
-    my $sth2=$dbh->prepare("Insert into accountlines
-    (borrowernumber,itemnumber,date,amount,
-    description,accounttype,amountoutstanding,accountno) values
-    (?,?,now(),?,?,'FU',?,?)");
-    $sth2->execute($bornum,$itemnum,$amount,"$type $title $due",$amount,$accountno);
-    $sth2->finish;
-  }
-  $sth->finish;
-}
-
-
-
-=item BorType
-
-  $borrower = &BorType($borrowernumber);
-
-Looks up a patron by borrower number.
-
-C<$borrower> is a reference-to-hash whose keys are all of the fields
-from the borrowers and categories tables of the Koha database. Thus,
-C<$borrower> contains all information about both the borrower and
-category he or she belongs to.
-
-=cut
-#'
-sub BorType {
-  my ($borrowernumber)=@_;
-  my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("Select * from borrowers,categories where
-  borrowernumber=? and
-borrowers.categorycode=categories.categorycode");
-  $sth->execute($borrowernumber);
-  my $data=$sth->fetchrow_hashref;
-  $sth->finish;
-  return($data);
-}
-
-=item ReplacementCost
-
-  $cost = &ReplacementCost($itemnumber);
-
-Returns the replacement cost of the item with the given item number.
-
-=cut
-#'
-sub ReplacementCost{
-  my ($itemnumber)=@_;
-  my $dbh = C4::Context->dbh;
-  my ($itemrecord)=XMLgetitem($dbh,$itemnumber);
-$itemrecord=XML_xml2hash_onerecord($itemrecord);
- my $replacementprice=XML_readline_onerecord($itemrecord,"replacementprice","holdings"); 
-  return($replacementprice);
-}
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Circulation/PrinterConfig.pm
===================================================================
RCS file: modules/C4/Circulation/PrinterConfig.pm
diff -N modules/C4/Circulation/PrinterConfig.pm
--- modules/C4/Circulation/PrinterConfig.pm	10 Mar 2007 01:39:27 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,111 +0,0 @@
-package C4::Barcodes::PrinterConfig;
-
-# This package is used to deal with labels in a pdf file. Giving some parameters,
-# this package takes care of every label considering the environment of the pdf
-# file.
-
-use strict;
-require Exporter;
-use vars qw(@EXPORT);
- at EXPORT = qw(&labelsPage &getLabelPosition setPositionsForX setPositionsForY);
-
-use PDF::API2;
-use PDF::API2::Page;
-
-
-my @positionsForX; # Take all the X positions of the pdf file.
-my @positionsForY; # Take all the Y positions of the pdf file.
-my $firstLabel = 1; # Test if the label passed as a parameter is the first label to be printed into the pdf file.
-
-# ***************************** ROUTINES DEFINITIONS ********************************** #
-
-# Calculate and stores all tha X positions across the pdf page.
-sub setPositionsForX {
-	my ($marginLeft, $labelWidth, $columns, $pageType) = @_;
-	my $defaultDpi = 72/25.4; # By default we know 25.4 mm -> 1 inch -> 72 dots per inch
-	my $whereToStart = ($marginLeft + ($labelWidth/2));
-	my $firstLabel = $whereToStart*$defaultDpi;
-	my $spaceBetweenLabels = $labelWidth*$defaultDpi;
-	my @positions;
-	for (my $i = 0; $i < $columns ; $i++) {
-		push @positions, ($firstLabel+($spaceBetweenLabels*$i));
-	}
-	@positionsForX = @positions;
-}
-
-# Calculate and stores all tha Y positions across the pdf page.
-sub setPositionsForY {
-	my ($marginBottom, $labelHeigth, $rows, $pageType) = @_;
-	my $defaultDpi = 72/25.4; # By default we know 25.4 mm -> 1 inch -> 72 dots per inch
-	my $whereToStart = ($marginBottom + ($labelHeigth/2));
-	my $firstLabel = $whereToStart*$defaultDpi;
-	my $spaceBetweenLabels = $labelHeigth*$defaultDpi;
-	my @positions;
-	for (my $i = 0; $i < $rows; $i++) {
-		unshift @positions, ($firstLabel+($spaceBetweenLabels*$i));
-	}
-	@positionsForY = @positions;
-}
-
-# Return the (x,y) position of the label that you are going to print considering the environment.
-sub getLabelPosition {
-	my ($labelNum, $pdf, $page, $gfxObject, $textObject, $fontObject, $pageType) = @_;
-	my $indexX = $labelNum % @positionsForX;
-	my $indexY = int($labelNum / @positionsForX);
-	# Calculates the next label position and return that label number
-	my $nextIndexX = $labelNum % @positionsForX;
-	my $nextIndexY = $labelNum % @positionsForY;
-	if ($firstLabel) {
-          $page = $pdf->page;
-          $page->mediabox($pageType);
-          $gfxObject = $page->gfx;
-          $textObject = $page->text;
-          $textObject->font($fontObject, 7);
-		  $firstLabel = 0;
-	} elsif (($nextIndexX == 0) && ($nextIndexY == 0)) {
-          $page = $pdf->page;
-          $page->mediabox($pageType);
-          $gfxObject = $page->gfx;
-          $textObject = $page->text;
-          $textObject->font($fontObject, 7);
-	}
-	$labelNum = $labelNum + 1;	
-	if ($labelNum == (@positionsForX*@positionsForY)) {
-		$labelNum = 0;
-	}
-	return ($positionsForX[$indexX], $positionsForY[$indexY], $pdf, $page, $gfxObject, $textObject, $fontObject, $labelNum);
-}
-
-# This function will help you to build the labels panel, where you can choose
-# wich label position do you want to start the printer process.
-sub labelsPage{
-	my ($rows, $columns) = @_;
-	my @pageType;
-	my $tagname = 0;
-	my $labelname = 1;
-	my $check;
-	for (my $i = 1; $i <= $rows; $i++) {
-		my @column;
-		for (my $j = 1; $j <= $columns; $j++) {
-			my %cell;
-			if ($tagname == 0) {
-				$check = 'checked';
-			} else {
-				$check = '';
-			}		
-			%cell = (check => $check,
-					 tagname => $tagname,
-			         labelname => $labelname);
-			$tagname = $tagname + 1;	
-			$labelname = $labelname + 1;	
-			push @column, \%cell;
-		}
-		my %columns = (columns => \@column);
-		push @pageType, \%columns;
-	}
-	return @pageType;
-}
-
-
-1;
-__END__
\ No newline at end of file

Index: modules/C4/Interface/CGI/Output.pm
===================================================================
RCS file: modules/C4/Interface/CGI/Output.pm
diff -N modules/C4/Interface/CGI/Output.pm
--- modules/C4/Interface/CGI/Output.pm	11 Mar 2007 20:34:55 -0000	1.1.2.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,97 +0,0 @@
-package C4::Interface::CGI::Output;
-
-# $Id: Output.pm,v 1.1.2.2 2007/03/11 20:34:55 tgarip1957 Exp $
-
-#package to work around problems in HTTP headers
-# Note: This is just a utility module; it should not be instantiated.
-
-
-# Copyright 2003 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-use open ':utf8';
-use Encode;
-use vars qw($VERSION @ISA @EXPORT);
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::CGI::Output - Convenience functions for handling outputting HTML pages
-
-=head1 SYNOPSIS
-
-  use C4::Interface::CGI::Output;
-
-  print $query->header(-type => "text/html"), $output;
-
-=head1 DESCRIPTION
-
-The functions in this module peek into a piece of HTML and return strings
-related to the (guessed) charset.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(	&output_html_with_http_headers
-		);
-
-
-
-
-
-=item output_html_with_http_headers
-
-   &output_html_with_http_headers($query, $cookie, $html)
-
-Outputs the HTML page $html with the appropriate HTTP headers,
-with the authentication cookie $cookie and a Content-Type that
-corresponds to the HTML page $html.
-
-=cut
-
-sub output_html_with_http_headers  {
-
-    my($query, $cookie, $html) = @_;
-$html=~s/()//g;##Remove Windows BOM
-$html=Encode::encode_utf8($html) if $ENV{MOD_PERL}; ### Stop "Wide character in print" warnings from HTML::Template
-    print $query->header(
-	-type   => "text/html",
-	-charset=>"UTF-8",
-	-cookie => $cookie,
-  ), $html;
-
-}
-
-#---------------------------------
-
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut

Index: modules/C4/Interface/CGI/Template.pm
===================================================================
RCS file: modules/C4/Interface/CGI/Template.pm
diff -N modules/C4/Interface/CGI/Template.pm
--- modules/C4/Interface/CGI/Template.pm	10 Mar 2007 01:40:35 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,89 +0,0 @@
-package C4::Interface::CGI::Template;
-
-# $Id: Template.pm,v 1.1.2.1 2007/03/10 01:40:35 tgarip1957 Exp $
-
-# convenience package for HTML templating
-# Note: This is just a utility module; it should not be instantiated.
-
-
-# Copyright 2003 Katipo Communications
-#
-# 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 strict;
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = 0.01;
-
-=head1 NAME
-
-C4::Members - Convenience functions for using HTML::Template
-
-=head1 SYNOPSIS
-
-  use C4::Interface::HTML::Template;
-
-=head1 DESCRIPTION
-
-The functions in this module peek into a piece of HTML and return strings
-related to the (guessed) charset.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
- at ISA = qw(Exporter);
- at EXPORT = qw(
-		&expand_sex_into_predicate
-	     );
-
-=item expand_sex_into_predicate
-
-  $data{&expand_sex_into_predicate($data{sex})} = 1;
-
-Converts a single 'M' or 'F' into 'sex_M_p' or 'sex_F_p'
-respectively.
-
-In some languages, 'M' and 'F' are not appropriate. However,
-with HTML::Template, there is no way to localize 'M' or 'F'
-unless these are converted into variables that TMPL_IF can
-understand. This function provides this conversion.
-
-=cut
-
-sub expand_sex_into_predicate ($) {
-   my($sex) = @_;
-   return "sex_${sex}_p";
-} # expand_sex_into_predicate
-
-#---------------------------------
-
-
-1;
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info at koha.org>
-
-=cut





More information about the Koha-cvs mailing list