From srdjan at catalyst.net.nz Tue Nov 1 08:28:40 2011 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Tue, 1 Nov 2011 20:28:40 +1300 Subject: [Koha-patches] [PATCH] bug_3966: Update items on receive In-Reply-To: References: Message-ID: <1320132520-28608-1-git-send-email-srdjan@catalyst.net.nz> Changed AddItem() and ModItem() interface so now they return item record. AddItemFromMarc() looks for itemnumber, and calls ModItem() if one is found. --- C4/Acquisition.pm | 50 +++------ C4/Biblio.pm | 6 +- C4/ImportBatch.pm | 4 +- C4/Items.pm | 19 ++- acqui/addorder.pl | 5 +- acqui/addorderiso2709.pl | 4 +- acqui/booksellers.pl | 7 +- acqui/finishreceive.pl | 125 ++++++++++---------- acqui/orderreceive.pl | 63 +++++------ cataloguing/additem.pl | 8 +- .../prog/en/modules/acqui/orderreceive.tt | 36 +++--- t/db_dependent/lib/KohaTest.pm | 16 +-- .../lib/KohaTest/Acquisition/GetParcel.pm | 17 +-- .../lib/KohaTest/Acquisition/GetParcels.pm | 18 +-- t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm | 6 +- 15 files changed, 173 insertions(+), 211 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 19c4f08..c9525c1 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1048,16 +1048,14 @@ sub ModOrderBiblioitemNumber { =head3 ModReceiveOrder - &ModReceiveOrder($biblionumber, $ordernumber, $quantityreceived, $user, - $unitprice, $booksellerinvoicenumber, $biblioitemnumber, - $freight, $bookfund, $rrp); + &ModReceiveOrder($biblionumber, $ordernumber, $quantityreceived, $receiveditems); Updates an order, to reflect the fact that it was received, at least -in part. All arguments not mentioned below update the fields with the -same name in the aqorders table of the Koha database. +in part. If a partial order is received, splits the order into two. The received -portion must have a booksellerinvoicenumber. +portion must have a booksellerinvoicenumber. If $receiveditems are supplied, +the rest of the items will be moved to the new order. Updates the order with bibilionumber C<$biblionumber> and ordernumber C<$ordernumber>. @@ -1066,16 +1064,11 @@ C<$ordernumber>. sub ModReceiveOrder { - my ( - $biblionumber, $ordernumber, $quantrec, $user, $cost, - $invoiceno, $freight, $rrp, $budget_id, $datereceived - ) - = @_; + my ( $biblionumber, $ordernumber, $quantrec, $receiveditems ) = @_; my $dbh = C4::Context->dbh; # warn "DATE BEFORE : $daterecieved"; # $daterecieved=POSIX::strftime("%Y-%m-%d",CORE::localtime) unless $daterecieved; # warn "DATE REC : $daterecieved"; - $datereceived = C4::Dates->output('iso') unless $datereceived; my $suggestionid = GetSuggestionFromBiblionumber( $dbh, $biblionumber ); if ($suggestionid) { ModSuggestion( {suggestionid=>$suggestionid, @@ -1093,36 +1086,23 @@ sub ModReceiveOrder { $sth->finish(); if ( $order->{quantity} > $quantrec ) { - $sth=$dbh->prepare(" - UPDATE aqorders - SET quantityreceived=? - , datereceived=? - , booksellerinvoicenumber=? - , unitprice=? - , freight=? - , rrp=? - , quantity=? - WHERE biblionumber=? AND ordernumber=?"); - - $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber); - $sth->finish; - # create a new order for the remaining items, and set its bookfund. foreach my $orderkey ( "linenumber", "allocation" ) { delete($order->{'$orderkey'}); } $order->{'quantity'} -= $quantrec; $order->{'quantityreceived'} = 0; - my $newOrder = NewOrder($order); -} else { - $sth=$dbh->prepare("update aqorders - set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?, - unitprice=?,freight=?,rrp=? - where biblionumber=? and ordernumber=?"); - $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber); - $sth->finish; + my (undef, $newOrder) = NewOrder($order); + + if ($receiveditems && @$receiveditems) { + my $sql = " + UPDATE aqorders_items + SET ordernumber = ? + WHERE ordernumber = ? + AND itemnumber NOT IN (".join(",", map "?", @$receiveditems).")"; + $dbh->do($sql, undef, $newOrder, $ordernumber, @$receiveditems); + } } - return $datereceived; } #------------------------------------------------------------# diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 4a9735f..9f1d275 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2471,7 +2471,7 @@ sub TransformMarcToKohaOneField { =head2 PrepareItemrecordDisplay - PrepareItemrecordDisplay($itemrecord,$bibnum,$itemumber,$frameworkcode); + PrepareItemrecordDisplay($bibnum,$itemumber,$defaultvalues,$frameworkcode); Returns a hash with all the fields for Display a given item data in a template @@ -2650,14 +2650,14 @@ sub PrepareItemrecordDisplay { $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? my $index_subfield = int(rand(1000000)); $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; - $subfield_data{marc_value} = qq[ ... $javascript]; } else { warn "Plugin Failed: $plugin"; - $subfield_data{marc_value} = qq(); # supply default input form + $subfield_data{marc_value} = qq(); # supply default input form } } elsif ( $tag eq '' ) { # it's an hidden field diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index b6db406..a121d08 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -547,10 +547,10 @@ sub BatchCommitItems { $updsth->execute(); $num_items_errored++; } else { - my ($item_biblionumber, $biblioitemnumber, $itemnumber) = AddItemFromMarc($item_marc, $biblionumber); + my $item = AddItemFromMarc($item_marc, $biblionumber); my $updsth = $dbh->prepare("UPDATE import_items SET status = ?, itemnumber = ? WHERE import_items_id = ?"); $updsth->bind_param(1, 'imported'); - $updsth->bind_param(2, $itemnumber); + $updsth->bind_param(2, $item->{itemnumber}); $updsth->bind_param(3, $row->{'import_items_id'}); $updsth->execute(); $updsth->finish(); diff --git a/C4/Items.pm b/C4/Items.pm index 4915884..8ff79ec 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -194,11 +194,11 @@ sub CartToShelf { =head2 AddItemFromMarc - my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItemFromMarc($source_item_marc, $biblionumber); + my $item = AddItemFromMarc($source_item_marc, $biblionumber); Given a MARC::Record object containing an embedded item -record and a biblionumber, create a new item record. +record and a biblionumber, create a new item record or update +existing one. =cut @@ -214,13 +214,15 @@ sub AddItemFromMarc { $localitemmarc->append_fields($source_item_marc->field($itemtag)); my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode ,'items'); my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode); + if (my $itemnumber = $item->{itemnumber}) { + return ModItem($item, $biblionumber, $itemnumber, $dbh, $frameworkcode, $unlinked_item_subfields); + } return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields); } =head2 AddItem - my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]); + my $item = AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]); Given a hash containing item column names as keys, create a new Koha item record. @@ -272,7 +274,7 @@ sub AddItem { logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); - return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber); + return $item; } =head2 AddItemBatchFromMarc @@ -451,6 +453,7 @@ sub ModItemFromMarc { $item->{$item_field} = $default_values_for_mod_from_marc{$item_field} unless (exists $item->{$item_field}); } my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); + $itemnumber ||= $item->{itemnumber}; ModItem($item, $biblionumber, $itemnumber, $dbh, $frameworkcode, $unlinked_item_subfields); return $item; @@ -458,7 +461,7 @@ sub ModItemFromMarc { =head2 ModItem - ModItem({ column => $newvalue }, $biblionumber, + my $item = ModItem({ column => $newvalue }, $biblionumber, $itemnumber[, $original_item_marc]); Change one or more columns in an item record and update @@ -522,6 +525,8 @@ sub ModItem { ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef ); logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog"); + + return $item; } =head2 ModItemTransfer diff --git a/acqui/addorder.pl b/acqui/addorder.pl index d7f7e96..8a14562 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -261,9 +261,8 @@ if ( $orderinfo->{quantity} ne '0' ) { $itemhash{$item}->{'indicator'}, 'ITEM'); my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); - my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$$orderinfo{biblionumber}); - NewOrderItem($itemnumber, $$orderinfo{ordernumber}); - + my $item = AddItemFromMarc($record,$$orderinfo{biblionumber}); + NewOrderItem($item->{itemnumber}, $$orderinfo{ordernumber}); } } diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index bbfd3b7..3bc82f2 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -260,8 +260,8 @@ if ($op eq ""){ my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator ); my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); for (my $qtyloop=1;$qtyloop <=$quantity;$qtyloop++) { - my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); - NewOrderItem( $itemnumber, $ordernumber ); + my $item = AddItemFromMarc( $record, $biblionumber ); + NewOrderItem( $item->{itemnumber}, $ordernumber ); } } else { SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index 2b16fe4..875a240 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -111,13 +111,14 @@ for my $vendor (@suppliers) { for my $basket ( @{$baskets} ) { my $authorisedby = $basket->{authorisedby}; - my $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode}; + my $basketbranch = ''; + $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode} if $authorisedby; if ($userenv->{'flags'} & 1 || #user is superlibrarian (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and ($viewbaskets eq 'all' || #user is allowed to see all baskets - ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq $basketbranch) || #basket belongs to user's branch - ($basket->{authorisedby} && $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket + ($viewbaskets eq 'branch' && $userbranch eq $basketbranch) || #basket belongs to user's branch + ($basket->{authorisedby} && $viewbaskets == 'user' && $authorisedby eq $loggedinuser) #user created this basket ) ) ) { diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 71b13d6..9c9a808 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -26,10 +26,10 @@ use CGI; use C4::Auth; use C4::Output; use C4::Context; +use C4::Dates; use C4::Acquisition; use C4::Biblio; use C4::Items; -use C4::Search; use List::MoreUtils qw/any/; my $input=new CGI; @@ -42,76 +42,77 @@ my $ordernumber=$input->param('ordernumber'); my $origquantityrec=$input->param('origquantityrec'); my $quantityrec=$input->param('quantityrec'); my $quantity=$input->param('quantity'); -my $unitprice=$input->param('cost'); my $invoiceno=$input->param('invoice'); -my $datereceived=$input->param('datereceived'); -my $replacement=$input->param('rrp'); +my $datereceived=$input->param('datereceived') || C4::Dates->output('iso'); my $gst=$input->param('gst'); my $freight=$input->param('freight'); my $supplierid = $input->param('supplierid'); my $cnt=0; -my $error_url_str; -my $ecost = $input->param('ecost'); -my $note = $input->param("note"); +my $error_url_str = ''; -my %tplorder = ( 'quantity' => $input->param('quantity') || '', - 'quantityreceived' => $input->param('quantityrec') || '', - 'notes' => $input->param("note") || '', - 'rrp' => $input->param('rrp') || '', - 'ecost' => $input->param('ecost') || '', - 'unitprice' => $input->param('cost') || '', - ); my $order = GetOrder($ordernumber); -if ( any { $order->{$_} ne $tplorder{$_} } qw(quantity quantityreceived notes rrp ecost unitprice) ) { - $order->{quantity} = $tplorder{quantity} if $tplorder{quantity}; - $order->{quantityreceived} = $tplorder{quantityreceived} if $tplorder{quantityreceived}; - $order->{notes} = $tplorder{notes} if $tplorder{notes}; - $order->{rrp} = $tplorder{rrp} if $tplorder{rrp}; - $order->{ecost} = $tplorder{ecost} if $tplorder{ecost}; - $order->{unitprice} = $tplorder{unitprice} if $tplorder{unitprice}; - ModOrder($order); -} +$order->{booksellerinvoicenumber} = $invoiceno; +$order->{datereceived} = $datereceived; +$order->{freight} = $freight; +$order->{quantity} = $quantity; +$order->{quantityreceived} = $quantityrec; +$order->{notes} = $input->param("note"); +$order->{rrp} = $input->param('rrp'); +$order->{ecost} = $input->param('ecost'); +$order->{unitprice} = $input->param('cost'); +ModOrder($order); #need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME -if ($quantityrec > $origquantityrec ) { - # now, add items if applicable - if (C4::Context->preference('AcqCreateItem') eq 'receiving') { - my @tags = $input->param('tag'); - my @subfields = $input->param('subfield'); - my @field_values = $input->param('field_value'); - my @serials = $input->param('serial'); - my @itemid = $input->param('itemid'); - my @ind_tag = $input->param('ind_tag'); - my @indicator = $input->param('indicator'); - #Rebuilding ALL the data for items into a hash - # parting them on $itemid. - my %itemhash; - my $countdistinct; - my $range=scalar(@itemid); - for (my $i=0; $i<$range; $i++){ - unless ($itemhash{$itemid[$i]}){ - $countdistinct++; - } - push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i]; - push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i]; - push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i]; - push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i]; - push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; - } - foreach my $item (keys %itemhash){ - my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'}, - $itemhash{$item}->{'subfields'}, - $itemhash{$item}->{'field_values'}, - $itemhash{$item}->{'ind_tag'}, - $itemhash{$item}->{'indicator'},'ITEM'); - my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); - my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$biblionumber); - } + +# now, add or update items if applicable +my @tags = $input->param('tag'); +my @subfields = $input->param('subfield'); +my @field_values = $input->param('field_value'); +my @serials = $input->param('serial'); +my @itemid = $input->param('itemid'); +my @ind_tag = $input->param('ind_tag'); +my @indicator = $input->param('indicator'); +#Rebuilding ALL the data for items into a hash +# parting them on $itemid. +my %itemhash; +my $countdistinct; +my $range=scalar(@itemid); +for (my $i=0; $i<$range; $i++){ + unless ($itemhash{$itemid[$i]}){ + $countdistinct++; + } + push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i]; + push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i]; + push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i]; + push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i]; + push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; +} +my $error; +my %itemnumbers = map { $_ => 1 } GetItemnumbersFromOrder($ordernumber); +my @received; +foreach my $id (keys %itemhash){ + my $xml = TransformHtmlToXml( $itemhash{$id}->{'tags'}, + $itemhash{$id}->{'subfields'}, + $itemhash{$id}->{'field_values'}, + $itemhash{$id}->{'ind_tag'}, + $itemhash{$id}->{'indicator'},'ITEM'); + my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); + my $item = AddItemFromMarc($record,$biblionumber); + my $itemnumber = $item ? $item->{itemnumber} : undef; + if ($itemnumber) { + push @received, $itemnumber; + NewOrderItem($itemnumber, $ordernumber) unless $itemnumbers{$itemnumber}; + } else { + $error++; } - +} + +if ($error) { + $error_url_str = "&error=Datbase+write+error"; +} +elsif ($quantityrec != $origquantityrec ) { # save the quantity received. - if( $quantityrec > 0 ) { - $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoiceno,$freight,$replacement,undef,$datereceived); - } + ModReceiveOrder($biblionumber,$ordernumber, $quantityrec, \@received); } - print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str"); + +print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str"); diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 98ba544..26ca81f 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -85,21 +85,13 @@ my $search = $input->param('receive'); my $invoice = $input->param('invoice'); my $freight = $input->param('freight'); my $datereceived = $input->param('datereceived'); - - $datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new(); my $bookseller = GetBookSellerFromId($supplierid); my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; my $results = SearchOrder($ordernumber,$search); - - my $count = scalar @$results; -my $order = GetOrder($ordernumber); - - -my $date = @$results[0]->{'entrydate'}; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -114,47 +106,50 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( # prepare the form for receiving if ( $count == 1 ) { - if (C4::Context->preference('AcqCreateItem') eq 'receiving') { + my $order = GetOrder($results->[0]->{ordernumber}); + my $biblionumber = $order->{biblionumber}; + + my @itemloop; + if ( my @itemnumbers = GetItemnumbersFromOrder($ordernumber) ) { + @itemloop = map PrepareItemrecordDisplay($biblionumber,$_), @itemnumbers; + } + elsif (C4::Context->preference('AcqCreateItem') eq 'receiving') { # prepare empty item form my $cell = PrepareItemrecordDisplay('','','','ACQ'); unless ($cell) { $cell = PrepareItemrecordDisplay('','','',''); $template->param('NoACQframework' => 1); } - my @itemloop; push @itemloop,$cell; - - $template->param(items => \@itemloop); } + + $template->param(items => \@itemloop) if @itemloop; - if ( @$results[0]->{'quantityreceived'} == 0 ) { - @$results[0]->{'quantityreceived'} = ''; - } - if ( @$results[0]->{'unitprice'} == 0 ) { - @$results[0]->{'unitprice'} = ''; + if ( $order->{'unitprice'} == 0 ) { + $order->{'unitprice'} = ''; } $template->param( count => 1, - biblionumber => @$results[0]->{'biblionumber'}, - ordernumber => @$results[0]->{'ordernumber'}, - biblioitemnumber => @$results[0]->{'biblioitemnumber'}, - supplierid => @$results[0]->{'booksellerid'}, + biblionumber => $biblionumber, + ordernumber => $order->{'ordernumber'}, + biblioitemnumber => $order->{'biblioitemnumber'}, + supplierid => $supplierid, freight => $freight, gst => $gst, name => $bookseller->{'name'}, - date => format_date($date), - title => @$results[0]->{'title'}, - author => @$results[0]->{'author'}, - copyrightdate => @$results[0]->{'copyrightdate'}, - isbn => @$results[0]->{'isbn'}, - seriestitle => @$results[0]->{'seriestitle'}, - bookfund => @$results[0]->{'bookfundid'}, - quantity => @$results[0]->{'quantity'}, - quantityreceivedplus1 => @$results[0]->{'quantityreceived'} + 1, - quantityreceived => @$results[0]->{'quantityreceived'}, - rrp => @$results[0]->{'rrp'}, - ecost => @$results[0]->{'ecost'}, - unitprice => @$results[0]->{'unitprice'}, + date => format_date($order->{'entrydate'}), + title => $order->{'title'}, + author => $order->{'author'}, + copyrightdate => $order->{'copyrightdate'}, + isbn => $order->{'isbn'}, + seriestitle => $order->{'seriestitle'}, + bookfund => $order->{'bookfundid'}, + quantity => $order->{'quantity'}, + quantityreceived => scalar(@itemloop) || 1, + origquantityrec => $order->{'quantityreceived'}, + rrp => $order->{'rrp'}, + ecost => $order->{'ecost'}, + unitprice => $order->{'unitprice'}, invoice => $invoice, datereceived => $datereceived->output(), datereceived_iso => $datereceived->output('iso'), diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 4442ed3..bbf2c74 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -347,8 +347,8 @@ if ($op eq "additem") { push @errors,"barcode_not_unique" if($exist_itemnumber); # if barcode exists, don't create, but report The problem. unless ($exist_itemnumber) { - my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); - set_item_default_location($oldbibitemnum); + my $item = AddItemFromMarc($record,$biblionumber); + set_item_default_location($item->{biblioitemnumber}); } $nextop = "additem"; if ($exist_itemnumber) { @@ -414,8 +414,8 @@ if ($op eq "additem") { # Adding the item if (!$exist_itemnumber) { - my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); - set_item_default_location($oldbibitemnum); + my $item = AddItemFromMarc($record,$biblionumber); + set_item_default_location($item->{biblioitemnumber}); # We count the item only if it was really added # That way, all items are added, even if there was some already existing barcodes diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 7147b19..fff26bd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -42,15 +42,15 @@

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

[% END %] + [% itemid = 1 %] [% FOREACH item IN items %] -
-
+
    [% FOREACH iteminformatio IN item.iteminformation %]
  1. [% iteminformatio.marc_value %] - + @@ -62,18 +62,18 @@
  2. [% END %]
- + - - + +  + - + + + + + + + +
-
- - - - - - - - + [% itemid = itemid + 1 %] [% END %] [% END %] @@ -101,14 +101,12 @@ [% IF ( quantityreceived ) %] [% IF ( edit ) %] - [% ELSE %] [% IF ( items ) %] - + [% ELSE %] - + [% END %] - [% END %] [% ELSE %] [% IF ( items ) %] @@ -116,8 +114,8 @@ [% ELSE %] [% END %] - [% END %] +
  • diff --git a/t/db_dependent/lib/KohaTest.pm b/t/db_dependent/lib/KohaTest.pm index 70c963d..77e91d1 100644 --- a/t/db_dependent/lib/KohaTest.pm +++ b/t/db_dependent/lib/KohaTest.pm @@ -572,16 +572,12 @@ sub add_biblios { ok( $biblionumber, "the biblionumber is $biblionumber" ); ok( $biblioitemnumber, "the biblioitemnumber is $biblioitemnumber" ); if ( $param{'add_items'} ) { - # my @iteminfo = AddItem( {}, $biblionumber ); - my @iteminfo = AddItemFromMarc( $marcrecord, $biblionumber ); - is( $iteminfo[0], $biblionumber, "biblionumber is $biblionumber" ); - is( $iteminfo[1], $biblioitemnumber, "biblioitemnumber is $biblioitemnumber" ); - ok( $iteminfo[2], "itemnumber is $iteminfo[2]" ); - push @{ $self->{'items'} }, - { biblionumber => $iteminfo[0], - biblioitemnumber => $iteminfo[1], - itemnumber => $iteminfo[2], - }; + # my $item = AddItem( {}, $biblionumber ); + my $item = AddItemFromMarc( $marcrecord, $biblionumber ); + is( $item->{biblionumber}, "biblionumber is $biblionumber" ); + is( $item->{biblioitemnumber}, "biblioitemnumber is $biblioitemnumber" ); + ok( $item->{itemnumber}, "itemnumber is $item->{itemnumber}" ); + push @{ $self->{'items'} }, $item; } push @{$self->{'biblios'}}, $biblionumber; } diff --git a/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm b/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm index c26e5f2..b42ea9c 100644 --- a/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm +++ b/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm @@ -43,18 +43,11 @@ sub one_parcel : Test( 17 ) { ok( $basketno, "my basket number is $basketno" ); ok( $ordernumber, "my order number is $ordernumber" ); - my $datereceived = ModReceiveOrder( $self->{'biblios'}[0], # biblionumber - $ordernumber, # $ordernumber, - undef, # $quantrec, - undef, # $user, - undef, # $cost, - $invoice, # $invoiceno, - undef, # $freight, - undef, # $rrp, - $self->{'bookfundid'}, # $bookfund, - $today, # $datereceived - ); - is( $datereceived, $today, "the parcel was received on $datereceived" ); + ModReceiveOrder( $self->{'biblios'}[0], # biblionumber + $ordernumber, # $ordernumber, + 1, # $quantrec, + ); + pass( "the parcel was received" ); my @parcel = GetParcel( $self->{'booksellerid'}, $invoice, $today ); is( scalar @parcel, 1, 'we found one (1) parcel.' ) diff --git a/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm b/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm index fd3ad0f..b14095f 100644 --- a/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm +++ b/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm @@ -271,18 +271,12 @@ sub create_order { my ( $basketno, $ordernumber ) = $self->create_new_basket( %param ); - my $datereceived = ModReceiveOrder( $self->{'biblios'}[0], # biblionumber - $ordernumber, # $ordernumber, - undef, # $quantrec, - undef, # $user, - undef, # $cost, - $param{'invoice'}, # $invoiceno, - undef, # $freight, - undef, # $rrp, - $self->{'bookfundid'}, # $bookfund, - $param{'date'}, # $datereceived - ); - is( $datereceived, $param{'date'}, "the parcel was received on $datereceived" ); + ModReceiveOrder( $self->{'biblios'}[0], # biblionumber + $ordernumber, # $ordernumber, + 1, # $quantrec, + ); + # XXX Needs proper tests for partial receiving + pass( "the parcel was received" ); } diff --git a/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm b/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm index 5b29ea8..8a83268 100644 --- a/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm +++ b/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm @@ -31,10 +31,10 @@ sub add_bib_to_modify : Test( startup => 3 ) { $self->{'bib_to_modify'} = $bibnum; # add an item - my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); + my $item = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); - cmp_ok($item_bibnum, '==', $bibnum, "new item is linked to correct biblionumber"); - cmp_ok($item_bibitemnum, '==', $bibitemnum, "new item is linked to correct biblioitemnumber"); + cmp_ok($item->{biblionumber}, '==', $bibnum, "new item is linked to correct biblionumber"); + cmp_ok($item->{biblioitemnumber}, '==', $bibitemnum, "new item is linked to correct biblioitemnumber"); $self->reindex_marc(); -- 1.6.5 From chrisc at catalyst.net.nz Wed Nov 2 03:00:59 2011 From: chrisc at catalyst.net.nz (Chris Cormack) Date: Wed, 2 Nov 2011 15:00:59 +1300 Subject: [Koha-patches] [PATCH] Bug 7139 : Log addition and deletion of circulation messages Message-ID: <1320199259-20657-1-git-send-email-chrisc@catalyst.net.nz> --- C4/Members.pm | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 56718f0..09cf47b 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -2146,7 +2146,7 @@ sub AddMessage { my $query = "INSERT INTO messages ( borrowernumber, branchcode, message_type, message ) VALUES ( ?, ?, ?, ? )"; my $sth = $dbh->prepare($query); $sth->execute( $borrowernumber, $branchcode, $message_type, $message ); - + logaction("MEMBERS", "Add Circulation Message", $borrowernumber, $message) if C4::Context->preference("BorrowersLog"); return 1; } @@ -2236,11 +2236,15 @@ sub DeleteMessage { my ( $message_id ) = @_; my $dbh = C4::Context->dbh; - - my $query = "DELETE FROM messages WHERE message_id = ?"; + my $query = "SELECT * FROM messages WHERE message_id = ?"; my $sth = $dbh->prepare($query); $sth->execute( $message_id ); + my $message = $sth->fetchrow_hashref(); + $query = "DELETE FROM messages WHERE message_id = ?"; + $sth = $dbh->prepare($query); + $sth->execute( $message_id ); + logaction("MEMBERS", "Remove Circulation Message", $message->{'borrowernumber'}, $message->{'message'}) if C4::Context->preference("BorrowersLog"); } END { } # module clean-up code here (global destructor) -- 1.7.5.4 From srdjan at catalyst.net.nz Wed Nov 2 07:48:47 2011 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Wed, 2 Nov 2011 19:48:47 +1300 Subject: [Koha-patches] [PATCH] bug_7140: Added item description to complement icon to search result and biblio detail pages In-Reply-To: References: Message-ID: <1320216527-30163-1-git-send-email-srdjan@catalyst.net.nz> --- C4/Search.pm | 5 +- .../prog/en/modules/catalogue/detail.tt | 14 ++--- .../prog/en/modules/catalogue/results.tt | 70 +++++++++++++------- 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 98db887..2aba42e 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1622,6 +1622,7 @@ sub searchResults { foreach my $code ( keys %subfieldstosearch ) { $item->{$code} = $field->subfield( $subfieldstosearch{$code} ); } + $item->{description} = $itemtypes{ $item->{itype} }{description}; # Hidden items my @items = ($item); @@ -1650,6 +1651,7 @@ sub searchResults { $onloan_items->{$key}->{branchname} = $item->{branchname}; $onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} }; $onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; + $onloan_items->{$key}->{description} = $item->{description}; $onloan_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); # if something's checked out and lost, mark it as 'long overdue' if ( $item->{itemlost} ) { @@ -1733,6 +1735,7 @@ sub searchResults { $other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value; $other_items->{$key}->{count}++ if $item->{$hbranch}; $other_items->{$key}->{location} = $shelflocations->{ $item->{location} }; + $other_items->{$key}->{description} = $item->{description}; $other_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); } # item is available @@ -1740,7 +1743,7 @@ sub searchResults { $can_place_holds = 1; $available_count++; $available_items->{$prefix}->{count}++ if $item->{$hbranch}; - foreach (qw(branchname itemcallnumber hideatopac)) { + foreach (qw(branchname itemcallnumber hideatopac description)) { $available_items->{$prefix}->{$_} = $item->{$_}; } $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index b1e225f..53aa03d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -255,16 +255,12 @@ function verify_images() { [% FOREACH itemloo IN itemloop %] [% IF ( item_level_itypes ) %] - - [% IF ( noItemTypeImages ) %] - [% itemloo.description %] - [% ELSE %] - [% IF ( itemloo.imageurl ) %] + + [% IF !noItemTypeImages && itemloo.imageurl %] [% itemloo.description %] - [% ELSE %] - [% itemloo.description %] - [% END %] - [% END %] + [% END %] + [% itemloo.description %] + [% END %] [% UNLESS ( singlebranchmode ) %][% itemloo.branchname %] [% END %] [% itemloo.homebranch %][% itemloo.location %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 2bed51c..cf283dc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -470,17 +470,19 @@ YAHOO.util.Event.onContentReady("searchheader", function () { [% END %]

    [% UNLESS ( item_level_itypes ) %] - [% UNLESS ( noItemTypeImages ) %][% IF ( SEARCH_RESULT.imageurl ) %] - - [% END %][% END %] + [% IF !noItemTypeImages && SEARCH_RESULT.imageurl %] + [% SEARCH_RESULT.description %] + [% END %] + [% SEARCH_RESULT.description %] [% END %] [% SEARCH_RESULT.summary %]

    [% ELSE %]

    [% UNLESS ( item_level_itypes ) %] - [% UNLESS ( noItemTypeImages ) %][% IF ( SEARCH_RESULT.imageurl ) %] + [% IF !noItemTypeImages && SEARCH_RESULT.imageurl %] - [% END %][% END %] + [% END %] + [% SEARCH_RESULT.description %] [% END %] [% IF ( SEARCH_RESULT.author ) %] @@ -532,41 +534,56 @@ YAHOO.util.Event.onContentReady("searchheader", function () {

      [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %] - [% IF ( noItemTypeImages ) %]
    • [% ELSE %][% IF ( item_level_itypes ) %][% IF ( available_items_loo.imageurl ) %]
    • [% available_items_loo.description %][% ELSE %]
    • [% END %][% ELSE %]
    • [% END %][% END %] + [% IF item_level_itypes && !noItemTypeImages && available_items_loo.imageurl %] +
    • + [% available_items_loo.description %] + [% ELSE %] +
    • + [% END %] [% IF ( available_items_loo.branchname ) %][% available_items_loo.branchname %][% END %] [% IF ( available_items_loo.location ) %][% available_items_loo.location %][% END %] [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber %]][% END %] - ([% available_items_loo.count %])
    • - [% END %]
    + ([% available_items_loo.count %]) + [% IF item_level_itypes && available_items_loo.description %] +
    [% available_items_loo.description %] + [% END %] + + [% END %] + [% END %] [% IF ( SEARCH_RESULT.onloancount ) %] [% SEARCH_RESULT.onloancount %] on loan:
      [% FOREACH onloan_items_loo IN SEARCH_RESULT.onloan_items_loop %] - [% IF ( noItemTypeImages ) %]
    • [% ELSE %][% IF ( item_level_itypes ) %] - [% IF ( onloan_items_loo.imageurl ) %] -
    • [% onloan_items_loo.description %] - [% ELSE %]
    • [% END %] - [% ELSE %]
    • [% END %][% END %] - + [% IF item_level_itypes && !noItemTypeImages && onloan_items_loo.imageurl %] +
    • + [% onloan_items_loo.description %] + [% ELSE %] +
    • + [% END %] [% IF ( onloan_items_loo.branchname ) %][% onloan_items_loo.branchname %][% END %] [% IF ( onloan_items_loo.location ) %][% onloan_items_loo.location %][% END %] [% IF ( onloan_items_loo.itemcallnumber ) %][[% onloan_items_loo.itemcallnumber %]][% END %] - ([% onloan_items_loo.count %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue %] long overdue[% END %]) date due: [% onloan_items_loo.due_date %]
    • - [% END %]
    + ([% onloan_items_loo.count %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue %] long overdue[% END %]) date due: [% onloan_items_loo.due_date %] + [% IF item_level_itypes && onloan_items_loo.description %] +
    [% onloan_items_loo.description %] + [% END %] + + [% END %] + [% END %] [% IF ( SEARCH_RESULT.othercount ) %] [% SEARCH_RESULT.othercount %] unavailable:
      [% FOREACH other_items_loo IN SEARCH_RESULT.other_items_loop %] - [% IF ( noItemTypeImages ) %]
    • [% ELSE %][% IF ( item_level_itypes ) %] - [% IF ( other_items_loo.imageurl ) %] -
    • [% other_items_loo.description %] - [% ELSE %]
    • [% END %] - [% ELSE %]
    • [% END %][% END %] - + [% IF item_level_itypes && !noItemTypeImages && other_items_loo.imageurl %] +
    • + [% other_items_loo.description %] + [% ELSE %] +
    • + [% END %] [% IF ( other_items_loo.branchname ) %][% other_items_loo.branchname %][% END %] [% IF ( other_items_loo.location ) %][% other_items_loo.location %][% END %] [% IF ( other_items_loo.itemcallnumber ) %][[% other_items_loo.itemcallnumber %]][% END %] @@ -576,8 +593,13 @@ YAHOO.util.Event.onContentReady("searchheader", function () { [% IF ( other_items_loo.intransit ) %](In transit)[% END %] [% IF ( other_items_loo.onhold ) %](On hold)[% END %] [% IF ( other_items_loo.notforloan ) %][% other_items_loo.notforloan %][% END %] - ([% other_items_loo.count %])
    • - [% END %]
    + ([% other_items_loo.count %]) + [% IF item_level_itypes && other_items_loo.description %] +
    [% other_items_loo.description %] + [% END %] + + [% END %] + [% END %] [% ELSE %] [% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS.count ) %] -- 1.6.5 From info at bywatersolutions.com Wed Nov 2 10:59:41 2011 From: info at bywatersolutions.com (Brendan) Date: Wed, 2 Nov 2011 02:59:41 -0700 Subject: [Koha-patches] [PATCH] Updating About.tt for Ian Walls, Chris Nighswonger and Paul Poulain Message-ID: <1320227981-31500-1-git-send-email-info@bywatersolutions.com> --- koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 784f463..8f92fdd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -108,10 +108,10 @@
  • Rachel Hamilton-Williams (Kaitiaki from 2004 to present)
  • Henri-Damien Laurent (Koha 3.0 Release Maintainer)
  • Owen Leonard (Koha 3.x Interface Design)
  • -
  • Chris Nighswonger (Koha 3.2, 3.4 Release Maintainer)
  • -
  • Paul Poulain (Koha 2.0 Release Manager, Koha 2.2 Release Manager/Maintainer)
  • +
  • Chris Nighswonger (Koha 3.2, 3.4 Release Maintainer, Koha 3.6 Release Maintainer)
  • +
  • Paul Poulain (Koha 2.0 Release Manager, Koha 2.2 Release Manager/Maintainer, Koha 3.8 Release Manager)
  • MJ Ray (Koha 2.0 Release Maintainer)
  • -
  • Ian Walls Koha 3.6 QA Manager
  • +
  • Ian Walls Koha 3.6 QA Manager, Koha 3.8 Release Manager
  • Koha Development Team

      -- 1.7.2.5 From info at bywatersolutions.com Wed Nov 2 11:04:58 2011 From: info at bywatersolutions.com (Brendan) Date: Wed, 2 Nov 2011 03:04:58 -0700 Subject: [Koha-patches] [PATCH 2/2] Follow up patch for Updating about.tt Message-ID: <1320228298-31651-1-git-send-email-info@bywatersolutions.com> I had a typo where I put Ian Walls as Release Manager - I have fixed to QA. --- koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 8f92fdd..9f5b19d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -111,7 +111,7 @@
    • Chris Nighswonger (Koha 3.2, 3.4 Release Maintainer, Koha 3.6 Release Maintainer)
    • Paul Poulain (Koha 2.0 Release Manager, Koha 2.2 Release Manager/Maintainer, Koha 3.8 Release Manager)
    • MJ Ray (Koha 2.0 Release Maintainer)
    • -
    • Ian Walls Koha 3.6 QA Manager, Koha 3.8 Release Manager
    • +
    • Ian Walls Koha 3.6 QA Manager, Koha 3.8 QA Manager

    Koha Development Team

      -- 1.7.2.5 From oleonard at myacpl.org Wed Nov 2 15:09:14 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Wed, 2 Nov 2011 10:09:14 -0400 Subject: [Koha-patches] [PATCH] Fix for Bug 7137 - fixed width table where it should be variable Message-ID: <1320242954-12814-1-git-send-email-oleonard@myacpl.org> Removing inline style setting the table width. --- .../prog/en/modules/serials/serials-collection.tt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index bd52497..93c4fdc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -181,7 +181,7 @@ $(document).ready(function() { [% FOREACH year IN years %]
      - +
      [% UNLESS ( year.onesubscription ) %] -- 1.7.3 From Katrin.Fischer.83 at web.de Thu Nov 3 00:54:53 2011 From: Katrin.Fischer.83 at web.de (Katrin Fischer) Date: Thu, 3 Nov 2011 00:54:53 +0100 Subject: [Koha-patches] [PATCH] Bug 7138: Can't print basket group order pdf Message-ID: <1320278093-10829-1-git-send-email-Katrin.Fischer.83@web.de> PDF print of basket groups is broken. To test: 1) Make sure OrderPdfFormat is set to pdfformat::layout2pages or pdfformat::layout3pages 2) Create a basket with orders 3) Close the basket and create a basket group checking the checkbox 4) Print the basket group as PDF Before patch the file is broken and when opened in an editor contains an error message. After the patch the PDF should be generated correctly again. Thx to Chris for helping me to fix the problem. --- acqui/basketgroup.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index fbcad0f..d2e1856 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -187,7 +187,7 @@ sub printbasketgrouppdf{ my $pdfformat = C4::Context->preference("OrderPdfFormat"); if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages'){ eval { - require $pdfformat; + eval "require $pdfformat"; import $pdfformat; }; if ($@){ -- 1.7.5.4 From M.de.Rooy at rijksmuseum.nl Thu Nov 3 10:01:11 2011 From: M.de.Rooy at rijksmuseum.nl (Marcel de Rooy) Date: Thu, 3 Nov 2011 09:01:11 +0000 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 7138: Can't print basket group order pdf Message-ID: <809BE39CD64BFD4EB9036172EBCCFA31361C84@S-MAIL-1B.rijksmuseum.intra> From: Katrin Fischer PDF print of basket groups is broken. To test: 1) Make sure OrderPdfFormat is set to pdfformat::layout2pages or pdfformat::layout3pages 2) Create a basket with orders 3) Close the basket and create a basket group checking the checkbox 4) Print the basket group as PDF Before patch the file is broken and when opened in an editor contains an error message. After the patch the PDF should be generated correctly again. Thx to Chris for helping me to fix the problem. Signed-off-by: Chris Cormack Signed-off-by: Marcel de Rooy Combined require and import into use. Added a warn statement. --- acqui/basketgroup.pl | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index fbcad0f..46d49d9 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -186,12 +186,8 @@ sub printbasketgrouppdf{ my $pdfformat = C4::Context->preference("OrderPdfFormat"); if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages'){ - eval { - require $pdfformat; - import $pdfformat; - }; - if ($@){ - } + eval "use $pdfformat"; + warn "Error while loading pdfformat module: $@" if $@; } else { print $input->header; -- 1.6.0.6 From M.de.Rooy at rijksmuseum.nl Thu Nov 3 11:53:18 2011 From: M.de.Rooy at rijksmuseum.nl (Marcel de Rooy) Date: Thu, 3 Nov 2011 10:53:18 +0000 Subject: [Koha-patches] [PATCH] Fixing typo in 3.6.X Message-ID: <809BE39CD64BFD4EB9036172EBCCFA31361D25@S-MAIL-1B.rijksmuseum.intra> --- installer/data/mysql/updatedatabase.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a8cd166..815a71d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4546,7 +4546,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = "3.06.00.000"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - print "Upgrade to $DBversion done Koha 3.4.0 release \n"; + print "Upgrade to $DBversion done Koha 3.6.0 release \n"; SetVersion ($DBversion); } -- 1.6.0.6 From M.de.Rooy at rijksmuseum.nl Thu Nov 3 11:55:43 2011 From: M.de.Rooy at rijksmuseum.nl (Marcel de Rooy) Date: Thu, 3 Nov 2011 10:55:43 +0000 Subject: [Koha-patches] [PATCH] Fixing typo in updatedatabase (master) Message-ID: <809BE39CD64BFD4EB9036172EBCCFA31361D43@S-MAIL-1B.rijksmuseum.intra> --- installer/data/mysql/updatedatabase.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a8cd166..815a71d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4546,7 +4546,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = "3.06.00.000"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - print "Upgrade to $DBversion done Koha 3.4.0 release \n"; + print "Upgrade to $DBversion done Koha 3.6.0 release \n"; SetVersion ($DBversion); } -- 1.6.0.6 From M.de.Rooy at rijksmuseum.nl Thu Nov 3 13:56:14 2011 From: M.de.Rooy at rijksmuseum.nl (Marcel de Rooy) Date: Thu, 3 Nov 2011 12:56:14 +0000 Subject: [Koha-patches] [PATCH] 7146 (Update timestamps when deleting a biblio) Message-ID: <809BE39CD64BFD4EB9036172EBCCFA31361D7F@S-MAIL-1B.rijksmuseum.intra> Currently, when you delete an item, the timestamp column in deleteditems is updated with current time. (This comes from an [unintentional] additional update statement in DelItem.) It makes deletion time visible. In the past, the marcxml was updated too at that moment, resulting in an updated timestamp in biblioitems too. The timestamp in biblio was not touched. If you delete a biblio however, the timestamps in deletedbiblio and deletedbiblioitems do not reflect time of deletion. They still show the time of last update before the record was deleted. This last update can be extracted from MARC field 005 too. This behavior is not consistent nor logical. I would suggest to add a statement in DelBiblio to force updating the timestamp in deletedbiblio(items) too. It makes the time of deletion visible in the record too. The time of deletion of a biblio can be very useful for e.g. synchronizing purposes. --- C4/Biblio.pm | 18 ++++++++++++------ C4/Items.pm | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 4a9735f..8747cc5 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -3522,9 +3522,12 @@ sub _koha_delete_biblio { $bkup_sth->finish; # delete the biblio - my $del_sth = $dbh->prepare("DELETE FROM biblio WHERE biblionumber=?"); - $del_sth->execute($biblionumber); - $del_sth->finish; + my $sth2 = $dbh->prepare("DELETE FROM biblio WHERE biblionumber=?"); + $sth2->execute($biblionumber); + # update the timestamp (Bugzilla 7146) + $sth2= $dbh->prepare("UPDATE deletedbiblio SET timestamp=NOW() WHERE biblionumber=?"); + $sth2->execute($biblionumber); + $sth2->finish; } $sth->finish; return undef; @@ -3568,9 +3571,12 @@ sub _koha_delete_biblioitems { $bkup_sth->finish; # delete the biblioitem - my $del_sth = $dbh->prepare("DELETE FROM biblioitems WHERE biblioitemnumber=?"); - $del_sth->execute($biblioitemnumber); - $del_sth->finish; + my $sth2 = $dbh->prepare("DELETE FROM biblioitems WHERE biblioitemnumber=?"); + $sth2->execute($biblioitemnumber); + # update the timestamp (Bugzilla 7146) + $sth2= $dbh->prepare("UPDATE deletedbiblioitems SET timestamp=NOW() WHERE biblioitemnumber=?"); + $sth2->execute($biblioitemnumber); + $sth2->finish; } $sth->finish; return undef; diff --git a/C4/Items.pm b/C4/Items.pm index 4915884..79a927c 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -587,6 +587,7 @@ sub DelItem { # backup the record my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?"); $copy2deleted->execute( $record->as_usmarc(), $itemnumber ); + # This last update statement makes that the timestamp column in deleteditems is updated too. If you remove these lines, please add a line to update the timestamp separately. See Bugzilla report 7146 and Biblio.pm (DelBiblio). #search item field code logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); -- 1.6.0.6 From oleonard at myacpl.org Thu Nov 3 15:30:58 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Thu, 3 Nov 2011 10:30:58 -0400 Subject: [Koha-patches] [PATCH] Fix for Bug 7148 - Add some error handling to Acquisitions' Z39.50 search to match Cataloging's Message-ID: <1320330658-18480-1-git-send-email-oleonard@myacpl.org> - Copying over error handling for timeout(10007) and refused(10000) - Copying over error handling for submission with no targets chosen - Correcting "cancel" link in the template which was not modified when it was copied from cataloging's popup window template. --- acqui/z3950_search.pl | 33 +++++++++++--------- .../prog/en/modules/acqui/z3950_search.tt | 9 +++++- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/acqui/z3950_search.pl b/acqui/z3950_search.pl index 47dbe52..80503e0 100755 --- a/acqui/z3950_search.pl +++ b/acqui/z3950_search.pl @@ -134,8 +134,17 @@ if ( $op ne "do_search" ) { } else { my @id = $input->param('id'); + + if ( not defined @id ) { + # empty server list -> report and exit + $template->param( emptyserverlist => 1 ); + output_html_with_http_headers $input, $cookie, $template->output; + exit; + } + my @oConnection; my @oResult; + my @errconn; my $s = 0; my $query; my $nterms; @@ -164,7 +173,7 @@ else { $query .= " \@attr 1=21 \"$subject\" "; $nterms++; } - if ($lccn) { + if ($lccn) { $query .= " \@attr 1=9 $lccn "; $nterms++; } @@ -186,7 +195,6 @@ warn "query ".$query if $DEBUG; $sth->execute($servid); while ( $server = $sth->fetchrow_hashref ) { warn "serverinfo ".join(':',%$server) if $DEBUG; - my $noconnection = 0; my $option1 = new ZOOM::Options(); $option1->option( 'async' => 1 ); $option1->option( 'elementSetName', 'F' ); @@ -237,9 +245,10 @@ sub displayresults { my ( $error, $errmsg, $addinfo, $diagset ) = $oConnection[$k]->error_x(); if ($error) { - warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n" - if $DEBUG; - + if ($error =~ m/^(10000|10007)$/ ) { + push(@errconn, {'server' => $serverhost[$k]}); + } + $DEBUG and warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n"; } else { my $numresults = $oResult[$k]->size(); @@ -280,13 +289,6 @@ sub displayresults { ) = ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' ); my %row_data; - if ( $i % 2 ) { - $toggle = 1; - } - else { - $toggle = 0; - } - $row_data{toggle} = $toggle; $row_data{server} = $servername[$k]; $row_data{isbn} = $oldbiblio->{isbn}; $row_data{lccn} = $oldbiblio->{lccn}; @@ -295,9 +297,9 @@ sub displayresults { $row_data{breedingid} = $breedingid; $row_data{biblionumber} = $biblionumber; push( @breeding_loop, \%row_data ); - + } else { - push(@breeding_loop,{'toggle'=>($i % 2)?1:0,'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1}); + push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1}); } # $rec } # upto 5 results } #$numresults @@ -308,10 +310,11 @@ sub displayresults { breeding_loop => \@breeding_loop, server => $servername[$k], numberpending => $numberpending, + errconn => \@errconn ); output_html_with_http_headers $input, $cookie, $template->output if $numberpending == 0; - # print $template->output if $firstresult !=1; + # print $template->output if $firstresult !=1; $firstresult++; } displayresults(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt index bbcb973..5216899 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt @@ -120,7 +120,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :

      [% END %] -
      Cancel
      +
      Cancel
      @@ -155,6 +155,13 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : [% END %]
      # Subs
      [% ELSE %] + [% IF ( emptyserverlist ) %] + You didn't select any Z39.50 target. + [% ELSE %] + [% FOREACH errcon IN errconn %] + Connection failed to [% errcon.server %] + [% END %] + [% END %]

      Nothing found. Try another search.

      [% END %] -- 1.7.3 From oleonard at myacpl.org Thu Nov 3 16:46:14 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Thu, 3 Nov 2011 11:46:14 -0400 Subject: [Koha-patches] [PATCH] Fix for Bug 7123 - barcode should be one word Message-ID: <1320335174-22305-1-git-send-email-oleonard@myacpl.org> Other fixes thrown in for good measure: - Adding data to the results table to match output of returns - Better checking of error codes in the script to control output of error messages (don't show error box when there are no errors). - Move some errors/messages from the right column onto the top of the page to match Koha's established pattern. --- circ/branchtransfers.pl | 92 ++++++++++--------- .../prog/en/modules/circ/branchtransfers.tt | 97 +++++++++++--------- 2 files changed, 103 insertions(+), 86 deletions(-) diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 7e0cb75..ad7aa9a 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -118,13 +118,16 @@ if ($barcode) { my %item; my $frbranchcd = C4::Context->userenv->{'branch'}; # if ( not($found) ) { - $item{'biblionumber'} = $iteminformation->{'biblionumber'}; - $item{'title'} = $iteminformation->{'title'}; - $item{'author'} = $iteminformation->{'author'}; - $item{'itemtype'} = $iteminformation->{'itemtype'}; - $item{'ccode'} = $iteminformation->{'ccode'}; - $item{'frbrname'} = $branches->{$frbranchcd}->{'branchname'}; - $item{'tobrname'} = $branches->{$tobranchcd}->{'branchname'}; + $item{'biblionumber'} = $iteminformation->{'biblionumber'}; + $item{'itemnumber'} = $iteminformation->{'itemnumber'}; + $item{'title'} = $iteminformation->{'title'}; + $item{'author'} = $iteminformation->{'author'}; + $item{'itemtype'} = $iteminformation->{'itemtype'}; + $item{'ccode'} = $iteminformation->{'ccode'}; + $item{'itemcallnumber'} = $iteminformation->{'itemcallnumber'}; + $item{'location'} = GetKohaAuthorisedValueLib("LOC",$iteminformation->{'location'}); + $item{'frbrname'} = $branches->{$frbranchcd}->{'branchname'}; + $item{'tobrname'} = $branches->{$tobranchcd}->{'branchname'}; # } $item{counter} = 0; $item{barcode} = $barcode; @@ -148,13 +151,16 @@ foreach ( $query->param ) { $item{frombrcd} = $frbcd; $item{tobrcd} = $tobcd; my ($iteminformation) = GetBiblioFromItemNumber( GetItemnumberFromBarcode($bc) ); - $item{'biblionumber'} = $iteminformation->{'biblionumber'}; - $item{'title'} = $iteminformation->{'title'}; - $item{'author'} = $iteminformation->{'author'}; - $item{'itemtype'} = $iteminformation->{'itemtype'}; - $item{'ccode'} = $iteminformation->{'ccode'}; - $item{'frbrname'} = $branches->{$frbcd}->{'branchname'}; - $item{'tobrname'} = $branches->{$tobcd}->{'branchname'}; + $item{'biblionumber'} = $iteminformation->{'biblionumber'}; + $item{'itemnumber'} = $iteminformation->{'itemnumber'}; + $item{'title'} = $iteminformation->{'title'}; + $item{'author'} = $iteminformation->{'author'}; + $item{'itemtype'} = $iteminformation->{'itemtype'}; + $item{'ccode'} = $iteminformation->{'ccode'}; + $item{'itemcallnumber'} = $iteminformation->{'itemcallnumber'}; + $item{'location'} = GetKohaAuthorisedValueLib("LOC",$iteminformation->{'location'}); + $item{'frbrname'} = $branches->{$frbcd}->{'branchname'}; + $item{'tobrname'} = $branches->{$tobcd}->{'branchname'}; push( @trsfitemloop, \%item ); } @@ -187,35 +193,37 @@ if ( $codeType eq 'itemtype' ) { my @errmsgloop; foreach my $code ( keys %$messages ) { - my %err; - if ( $code eq 'BadBarcode' ) { - $err{msg} = $messages->{'BadBarcode'}; - $err{errbadcode} = 1; + if ( $code ne 'WasTransfered' ) { + my %err; + if ( $code eq 'BadBarcode' ) { + $err{msg} = $messages->{'BadBarcode'}; + $err{errbadcode} = 1; + } + elsif ( $code eq "NotAllowed" ) { + warn "NotAllowed: $messages->{'NotAllowed'} to " . $branches->{ $messages->{'NotAllowed'} }->{'branchname'}; + # Do we really want a error log message here? --atz + $err{errnotallowed} = 1; + my ( $tbr, $typecode ) = split( /::/, $messages->{'NotAllowed'} ); + $err{tbr} = $branches->{ $tbr }->{'branchname'}; + $err{code} = $typecode; + $err{codeType} = $codeTypeDescription; + } + elsif ( $code eq 'IsPermanent' ) { + $err{errispermanent} = 1; + $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'}; + } + elsif ( $code eq 'WasReturned' ) { + $err{errwasreturned} = 1; + $err{borrowernumber} = $messages->{'WasReturned'}; + my $borrower = GetMember('borrowernumber'=>$messages->{'WasReturned'}); + $err{title} = $borrower->{'title'}; + $err{firstname} = $borrower->{'firstname'}; + $err{surname} = $borrower->{'surname'}; + $err{cardnumber} = $borrower->{'cardnumber'}; + } + $err{errdesteqholding} = ( $code eq 'DestinationEqualsHolding' ); + push( @errmsgloop, \%err ); } - elsif ( $code eq "NotAllowed" ) { - warn "NotAllowed: $messages->{'NotAllowed'} to " . $branches->{ $messages->{'NotAllowed'} }->{'branchname'}; - # Do we really want a error log message here? --atz - $err{errnotallowed} = 1; - my ( $tbr, $typecode ) = split( /::/, $messages->{'NotAllowed'} ); - $err{tbr} = $branches->{ $tbr }->{'branchname'}; - $err{code} = $typecode; - $err{codeType} = $codeTypeDescription; - } - elsif ( $code eq 'IsPermanent' ) { - $err{errispermanent} = 1; - $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'}; - } - elsif ( $code eq 'WasReturned' ) { - $err{errwasreturned} = 1; - $err{borrowernumber} = $messages->{'WasReturned'}; - my $borrower = GetMember('borrowernumber'=>$messages->{'WasReturned'}); - $err{title} = $borrower->{'title'}; - $err{firstname} = $borrower->{'firstname'}; - $err{surname} = $borrower->{'surname'}; - $err{cardnumber} = $borrower->{'cardnumber'}; - } - $err{errdesteqholding} = ( $code eq 'DestinationEqualsHolding' ); - push( @errmsgloop, \%err ); } # use Data::Dumper; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt index 026a265..097089a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt @@ -86,8 +86,46 @@
      [% ELSE %] -
      -
      + [% IF ( reqmessage ) %] +
      +
        + [% IF ( cancelled ) %] +
      • Reserve cancelled
      • + [% END %] + [% IF ( setwaiting ) %] +
      • Item should now be waiting at library: [% reqbrchname %]
      • + [% END %] +
      +
      + [% END %] + + [% IF ( errmsgloop ) %] +
      +
        + [% FOREACH errmsgloo IN errmsgloop %] + [% IF ( errmsgloo.errbadcode ) %] +
      • No Item with barcode: [% errmsgloo.msg %]
      • + [% END %] + [% IF ( errmsgloo.errispermanent ) %] +
      • Please return item to home library: [% errmsgloo.msg %]
      • + [% END %] + [% IF ( errmsgloo.errnotallowed ) %] +
      • You cannot transfer items of [% errmsgloo.codeType %] [% errmsgloo.code %] to [% errmsgloo.tbr %]
      • + [% END %] + [% IF ( errmsgloo.errdesteqholding ) %] +
      • Item is already at destination library.
      • + [% END %] + [% IF ( errmsgloo.errwasreturned ) %] +
      • Item was on loan to + [% errmsgloo.firstname %] [% errmsgloo.surname %] + ([% errmsgloo.cardnumber %]) and has been returned.
      • + [% END %] + [% END %] +
      +
      + [% END %] + +
      Transfer @@ -119,58 +157,29 @@ [% END %]
      - -

      Messages

      -
        - [% IF ( reqmessage ) %] - [% IF ( cancelled ) %] -
      • Reserve Cancelled
      • - [% END %] - [% IF ( setwaiting ) %] -
      • Item should now be waiting at library: [% reqbrchname %]
      • - [% END %] - [% END %] - [% FOREACH errmsgloo IN errmsgloop %] - [% IF ( errmsgloo.errbadcode ) %] -
      • No Item with barcode: [% errmsgloo.msg %]
      • - [% END %] - [% IF ( errmsgloo.errispermanent ) %] -
      • Please return item to home library: [% errmsgloo.msg %]
      • - [% END %] - [% IF ( errmsgloo.errnotallowed ) %] -
      • You cannot transfer items of [% errmsgloo.codeType %] [% errmsgloo.code %] to [% errmsgloo.tbr %]
      • - [% END %] - [% IF ( errmsgloo.errdesteqholding ) %] -
      • Item is already at destination library.
      • - [% END %] - [% IF ( errmsgloo.errwasreturned ) %] -
      • Item was on loan to -[% errmsgloo.firstname %] [% errmsgloo.surname %] -([% errmsgloo.cardnumber %]) and has been returned.
      • - [% END %] - [% END %] -
      -
      -
      - +
      + [% IF ( trsfitemloop ) %]
      - + + + + + [% FOREACH trsfitemloo IN trsfitemloop %] - - + + + + + + [% END %] -- 1.7.3 From oleonard at myacpl.org Thu Nov 3 19:58:11 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Thu, 3 Nov 2011 14:58:11 -0400 Subject: [Koha-patches] [PATCH] Fix for Bug 7135: Save button options Message-ID: <1320346691-26049-1-git-send-email-oleonard@myacpl.org> This patch adds a jQuery plugin which will cause an element to remain "fixed" at the top of the screen if it would otherwise scroll up out of view. I submit this patch for TESTING ONLY because the plugin was not posted with explicit licensing. I'm waiting to hear back from the author. --- koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css | 5 ++ .../prog/en/lib/jquery/plugins/jquery.fixFloat.js | 67 ++++++++++++++++++++ .../prog/en/modules/cataloguing/addbiblio.tt | 2 + 3 files changed, 74 insertions(+), 0 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.fixFloat.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css index 3cf2e88..d2489b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css @@ -144,4 +144,9 @@ a.tagnum { .yui-gf .yui-u { width: 79.2%; +} +/* Class to be added to toolbar when it starts being fixed at the top of the screen*/ +.floating { + -webkit-box-shadow: 0px 3px 2px 0px rgba(0, 0, 0, .5); + box-shadow: 0px 3px 2px 0px rgba(0, 0, 0, .5); } \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.fixFloat.js b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.fixFloat.js new file mode 100644 index 0000000..9fb63e0 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.fixFloat.js @@ -0,0 +1,67 @@ +/* Source: http://www.webspeaks.in/2011/07/new-gmail-like-floating-toolbar-jquery.html + Revision: http://jsfiddle.net/pasmalin/AyjeZ/ +*/ +(function($){ + $.fn.fixFloat = function(options){ + + var defaults = { + enabled: true + }; + var options = $.extend(defaults, options); + + var offsetTop; /**Distance of the element from the top of window**/ + var s; /**Scrolled distance from the top of window through which we have moved**/ + var fixMe = true; + var repositionMe = true; + + var tbh = $(this); + var originalOffset = tbh.position().top; /**Get the actual distance of the element from the top mychange:change to position better work**/ + + if (tbh.css('position')!='absolute') { + var tbhBis = $("
      "); + tbhBis.css({"display":tbh.css("display"),"visibility":"hidden"}); + tbhBis.width(tbh.outerWidth(true)); + tbhBis.height(tbh.outerHeight(true)); + tbh.after(tbhBis); + tbh.width(tbh.width()); + tbh.css({'position':'absolute'}); + } + tbh.css({'z-index':1000}); + + if(options.enabled){ + $(window).scroll(function(){ + var offsetTop = tbh.offset().top; /**Get the current distance of the element from the top **/ + var s = parseInt($(window).scrollTop(), 10); /**Get the from the top of wondow through which we have scrolled**/ + var fixMe = true; + if(s > offsetTop){ + fixMe = true; + }else{ + fixMe = false; + } + + if(s < originalOffset){ + repositionMe = true; + }else{ + repositionMe = false; + } + + if(fixMe){ + var cssObj = { + 'position' : 'fixed', + 'top' : '0px' + } + tbh.css(cssObj); + tbh.addClass("floating"); + } + if(repositionMe){ + var cssObj = { + 'position' : 'absolute', + 'top' : originalOffset + } + tbh.css(cssObj); + tbh.removeClass("floating"); + } + }); + } + }; +})(jQuery); \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 65feefb..62f5d87 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -2,6 +2,7 @@ Koha › Cataloging › [% IF ( biblionumber ) %]Editing [% title |html %] (Record Number [% biblionumber %])[% ELSE %]Add MARC Record[% END %] [% INCLUDE 'doc-head-close.inc' %] + @@ -194,10 +198,34 @@ $(document).ready(function(){
      Merge reference +
      Transferred Items
      Bar Code TitleAuthorBarcodeShelving locationCall numberType To
      - [% trsfitemloo.barcode %] - -

      [% trsfitemloo.title |html %] ([% trsfitemloo.author %])

      -

      [% trsfitemloo.ccode %]

      -
      [% trsfitemloo.title |html %][% trsfitemloo.author %][% trsfitemloo.barcode %][% trsfitemloo.location %][% trsfitemloo.itemcallnumber %][% trsfitemloo.ccode %] [% trsfitemloo.tobrname %]
      + + + + +
        -
      1. -
      2. +
      3. +
      +
      + [% IF frameworkselect %] +
      + + [% END %] +
      +
      @@ -332,14 +360,15 @@ $(document).ready(function(){ [% END %]
    +
    + + + - - -
    -- 1.6.5 From srdjan at catalyst.net.nz Mon Nov 7 06:07:21 2011 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Mon, 7 Nov 2011 18:07:21 +1300 Subject: [Koha-patches] [PATCH] bug_6504: Reintroduced freight costs when receiving orders In-Reply-To: References: Message-ID: <1320642441-23921-1-git-send-email-srdjan@catalyst.net.nz> --- C4/Acquisition.pm | 4 +- acqui/addorder.pl | 3 + acqui/neworderempty.pl | 1 + acqui/parcel.pl | 44 +++++++++----------- .../prog/en/modules/acqui/neworderempty.tt | 6 +++ .../prog/en/modules/acqui/orderreceive.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/parcels.tt | 5 +- 8 files changed, 37 insertions(+), 30 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index a0dda42..519efb9 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -712,7 +712,8 @@ sub GetPendingOrders { my $strsth = " SELECT ".($grouped?"count(*),":"")."aqbasket.basketno, surname,firstname,aqorders.*,biblio.*,biblioitems.isbn, - aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname + aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname, + (SELECT count(*) FROM aqorders_items WHERE aqorders_items.ordernumber=aqorders.ordernumber) AS items FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber @@ -1269,6 +1270,7 @@ sub GetParcel { aqorders.listprice, aqorders.rrp, aqorders.ecost, + aqorders.freight, biblio.title FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno diff --git a/acqui/addorder.pl b/acqui/addorder.pl index d7f7e96..bab1ea9 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -103,6 +103,8 @@ budget_id used to pay this order. =item C +=item C + =item C =item C @@ -174,6 +176,7 @@ $orderinfo->{'uncertainprice'} ||= 0; #my $gst = $input->param('GST'); #my $budget = $input->param('budget'); #my $cost = $input->param('cost'); +#my $freight = $input->param('freight'); #my $sub = $input->param('sub'); #my $purchaseorder = $input->param('purchaseordernumber'); #my $invoice = $input->param('invoice'); diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 459dfe8..f3cd048 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -384,6 +384,7 @@ $template->param( quantityrec => $data->{'quantity'}, rrp => $data->{'rrp'}, listprice => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice), + freight => sprintf("%.2f", $data->{'freight'}||0), total => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ), ecost => $data->{'ecost'}, unitprice => sprintf("%.2f", $data->{'unitprice'}), diff --git a/acqui/parcel.pl b/acqui/parcel.pl index c256c60..5c397e4 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -178,27 +178,25 @@ for (my $i = 0 ; $i < $countlines ; $i++) { $totalprice += $parcelitems[$i]->{'unitprice'}; $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'}); - #double FIXME - totalfreight is redefined later. - -# FIXME - each order in a parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget.. - if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) { - warn "FREIGHT CHARGE MISMATCH!!"; - } - $totalfreight = $parcelitems[$i]->{'freight'}; + $totalfreight += $parcelitems[$i]->{'freight'}; $totalquantity += $parcelitems[$i]->{'quantityreceived'}; $tototal += $total; } my $pendingorders = GetPendingOrders($supplierid); -my $countpendings = scalar @$pendingorders; +my $countpendingitems = 0; +if ($pendingorders) { + $countpendingitems += $_->{items} || 1 foreach @$pendingorders; +} +my $freight_per_item = $freight && $countpendingitems ? $freight/$countpendingitems : 0; # pending orders totals my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd); my $ordergrandtotal; my @loop_orders = (); -for (my $i = 0 ; $i < $countpendings ; $i++) { - my %line; - %line = %{$pendingorders->[$i]}; +for (my $i = $startfrom; $i < $startfrom + $resultsperpage; $i++) { + last unless $pendingorders->[$i]; + my %line = %{$pendingorders->[$i]}; $line{quantity}+=0; $line{quantityreceived}+=0; @@ -210,6 +208,7 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $line{ecost} = sprintf("%.2f",$line{ecost}); $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); $line{unitprice} = sprintf("%.2f",$line{unitprice}); + $line{freight} = sprintf("%.2f",$freight_per_item * ($line{items} || 1)); $line{invoice} = $invoice; $line{gst} = $gst; $line{total} = $total; @@ -244,22 +243,20 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $line{holds} = $holds; $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; - - push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); + push @loop_orders, \%line; } -$freight = $totalfreight unless $freight; -my $count = $countpendings; +my $countpendings = $pendingorders ? scalar (@$pendingorders) : 0; -if ($count>$resultsperpage){ +if ($countpendings>$resultsperpage){ my $displaynext=0; my $displayprev=$startfrom; - if(($count - ($startfrom+$resultsperpage)) > 0 ) { + if(($countpendings - ($startfrom+$resultsperpage)) > 0 ) { $displaynext = 1; } my @numbers = (); - for (my $i=1; $i<$count/$resultsperpage+1; $i++) { + for (my $i=1; $i<$countpendings/$resultsperpage+1; $i++) { my $highlight=0; ($startfrom/$resultsperpage==($i-1)) && ($highlight=1); push @numbers, { number => $i, @@ -269,21 +266,20 @@ if ($count>$resultsperpage){ my $from = $startfrom*$resultsperpage+1; my $to; - if($count < (($startfrom+1)*$resultsperpage)){ - $to = $count; + if($countpendings < (($startfrom+1)*$resultsperpage)){ + $to = $countpendings; } else { $to = (($startfrom+1)*$resultsperpage); } $template->param(numbers=>\@numbers, displaynext=>$displaynext, displayprev=>$displayprev, - nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count), + nextstartfrom=>(($startfrom+$resultsperpage<$countpendings)?$startfrom+$resultsperpage:$countpendings), prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0) ); } -#$totalfreight=$freight; -$tototal = $tototal + $freight; +$tototal = $tototal + $totalfreight; $template->param( invoice => $invoice, @@ -300,7 +296,7 @@ $template->param( countpending => $countpendings, loop_orders => \@loop_orders, totalprice => sprintf($cfstr, $totalprice), - totalfreight => $totalfreight, + totalfreight => sprintf($cfstr, $totalfreight), totalquantity => $totalquantity, tototal => sprintf($cfstr, $tototal), ordergrandtotal => sprintf($cfstr, $ordergrandtotal), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 68c290a..cf8e019 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -464,6 +464,12 @@ $(document).ready(function() [% END %] + [% IF ( quantityrec ) %] +
  • + + +
  • + [% END %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 7147b19..ce41f6e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -82,7 +82,6 @@ -
    @@ -127,6 +126,7 @@ [% ELSE %] [% END %]
  • +
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index 45eb591..86789d2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -325,7 +325,7 @@   - Shipping + Shipping cost [% totalfreight %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt index a7d704d..4478f34 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt @@ -96,11 +96,10 @@ [% END %] - +
  • Show Calendar -- 1.6.5 From lrea at nekls.org Mon Nov 7 16:02:45 2011 From: lrea at nekls.org (Liz Rea) Date: Mon, 7 Nov 2011 09:02:45 -0600 Subject: [Koha-patches] [PATCH] Bug 6323 -- Error handling cleanup for moveitem.tt Message-ID: <1320678165-25811-1-git-send-email-lrea@nekls.org> Added button to retry attaching item, added default bib view handling, cosmetic changes to the error display (buttons now in error div). --- .../prog/en/modules/cataloguing/moveitem.tt | 112 +++++++++++++++----- 1 files changed, 83 insertions(+), 29 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt index 553d130..6fd8dfa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt @@ -5,38 +5,92 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] - +
    [% IF ( error ) %]
    - [% IF ( errornonewitem ) %]ERROR: Unable to create the new item.[% END %] - [% IF ( errornoitem ) %]ERROR: Unable to get the item.[% END %] - [% IF ( errornoitemnumber ) %]ERROR: Unable to get the item number from this barcode.[% END %] -
    -
    - - -
    -[% ELSE %] - [% IF ( success ) %] -
    The item has successfully been attached to [% INCLUDE 'biblio-default-view.inc' %][% bibliotitle |html %].[% IF ( BiblioDefaultViewmarc ) %] -
    -[% ELSIF ( BiblioDefaultViewlabeled_marc ) %] - -[% ELSIF ( BiblioDefaultViewisbd ) %] - -[% ELSE %] - -[% END %] - - -
    -
    - - -
    -
    + + [% IF ( errornonewitem ) %]ERROR: Unable to create the new item.

    + + [% IF ( BiblioDefaultViewmarc ) %] +

    + [% ELSIF ( BiblioDefaultViewlabeled_marc ) %] + + [% ELSIF ( BiblioDefaultViewisbd ) %] + + [% ELSE %] + + [% END %] + + +
    +
    + + +
    +
    + [% END %] + + [% IF ( errornoitem ) %]ERROR: Unable to get the item.

    + + [% IF ( BiblioDefaultViewmarc ) %] +

    + [% ELSIF ( BiblioDefaultViewlabeled_marc ) %] + + [% ELSIF ( BiblioDefaultViewisbd ) %] + + [% ELSE %] + + [% END %] + + +
    +
    + + +
    + + [% END %] + + [% IF ( errornoitemnumber ) %]ERROR: Unable to get the item number from this barcode.

    + + [% IF ( BiblioDefaultViewmarc ) %] +

    + [% ELSIF ( BiblioDefaultViewlabeled_marc ) %] + + [% ELSIF ( BiblioDefaultViewisbd ) %] + + [% ELSE %] + + [% END %] + + +
    +
    + + +
    + + [% END %] + + [% ELSE %] + [% IF ( success ) %] +
    The item has successfully been attached to [% INCLUDE 'biblio-default-view.inc' %][% bibliotitle |html %]. + [% IF ( BiblioDefaultViewmarc ) %] +
    + [% ELSIF ( BiblioDefaultViewlabeled_marc ) %] + + [% ELSIF ( BiblioDefaultViewisbd ) %] + + [% ELSE %] + + [% END %] + + +
    +
    + [% ELSE %] [% IF ( missingparameter ) %] @@ -44,7 +98,7 @@ [% IF ( missingbiblionumber ) %]
    -
    Enter biblionumber:
    +
    Enter biblionumber:
    -- 1.7.2.5 From colin.campbell at ptfs-europe.com Tue Nov 8 14:53:21 2011 From: colin.campbell at ptfs-europe.com (Colin Campbell) Date: Tue, 8 Nov 2011 13:53:21 +0000 Subject: [Koha-patches] [PATCH] Bug 7191 Remove GetBorrowerIssues from @EXPORT Message-ID: <1320760401-10008-1-git-send-email-colin.campbell@ptfs-europe.com> No subroutine GetBorrowerIssues exists in C4::Circulation So don't export it into users' namespace --- C4/Circulation.pm | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9f81773..d2c5f59 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -72,7 +72,6 @@ BEGIN { &GetRenewCount &GetItemIssue &GetItemIssues - &GetBorrowerIssues &GetIssuingCharges &GetIssuingRule &GetBranchBorrowerCircRule -- 1.7.6.4 From oleonard at myacpl.org Tue Nov 8 17:46:28 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Tue, 8 Nov 2011 11:46:28 -0500 Subject: [Koha-patches] [PATCH] Fix for Bug 7194 - OPAC detail and recent comments pages corrections for XHTML validity Message-ID: <1320770788-10700-1-git-send-email-oleonard@myacpl.org> - Adding html filter to subtitle output to correct unescaped ampersands - Adding missing alt attributes to libravatar output - Removing unecessary markup from comments page Bonus: Adding html_break filter to output of comments to preserve line breaks --- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 16 ++++++++++------ .../opac-tmpl/prog/en/modules/opac-showreviews.tt | 11 +++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 8cba98b..649c7aa 100755 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1,4 +1,4 @@ -[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog › Details for: [% title |html %][% FOREACH subtitl IN subtitle %], [% subtitl.subfield %][% END %] +[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog › Details for: [% title |html %][% FOREACH subtitl IN subtitle %], [% subtitl.subfield |html %][% END %] [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'header.inc' %] @@ -20,31 +39,50 @@ [% ELSE %] -
    + [% IF ( errormsg ) %] +
    +

    The following errors have occurred:

    +
      [% IF ( BADUSERID ) %] -
      You have entered a User ID that already exists. Please choose another one.
      +
    • You have entered a username that already exists. Please choose another one.
    • [% END %] [% IF ( SHORTPASSWORD ) %] -
      The password entered is too short. Password must be at least [% minPasswordLength %] characters.
      +
    • The password entered is too short. Password must be at least [% minPasswordLength %] characters.
    • [% END %] [% IF ( NOPERMISSION ) %] -
      You do not have permission to edit this patron's login information.
      +
    • You do not have permission to edit this patron's login information.
    • [% END %] + [% IF ( NOMATCH ) %] +
    • The passwords entered do not match. Please re-enter the new password.
    • + [% END %] +
    +
    [% END %]
    Change Username and/or Password for [% firstname %] [% surname %]
    1. -
    2. +
    3. -
      Koha cannot display existing passwords. Below is a randomly generated suggestion. Leave the field blank to leave password unchanged.
      +
      Koha cannot display existing passwords. Leave the field blank to leave password unchanged.
      [% IF ( minPasswordLength ) %]
      Minimum password length: [% minPasswordLength %]
      [% END %] -
    4. + [% IF ( NOMATCH ) %] + + + [% ELSE %] + + + [% END %] + +
    5. + + +
    Cancel
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 47ea6c9..48a9030 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -3,7 +3,7 @@ [% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] [% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %][% UNLESS ( opadd ) %] [% surname %], [% firstname %][% END %] [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] - @@ -143,6 +144,9 @@ [% IF ( ERROR_short_password ) %]
  • Password must be at least [% minPasswordLength %] characters long.
  • [% END %] + [% IF ( ERROR_password_mismatch ) %] +
  • Passwords do not match.
  • + [% END %] [% IF ( ERROR_extended_unique_id_failed ) %]
  • The attribute value [% ERROR_extended_unique_id_failed %] is already is use by another patron record.
  • @@ -1069,39 +1073,82 @@ [% IF ( opadd ) %] [% IF ( NoUpdateLogin ) %] [% IF ( opduplicate ) %] - + [% ELSE %] - + [% END %] [% ELSE %] [% IF ( opduplicate ) %] - + [% ELSE %] - + [% END %] [% END %] [% ELSE %] [% IF ( password ) %] [% IF ( NoUpdateLogin ) %] - + [% ELSE %] [% IF ( opduplicate ) %] - + [% ELSE %] - + [% END %] [% END %] [% ELSE %] [% IF ( NoUpdateLogin ) %] - + [% ELSE %] - + [% END %] [% END %] [% END %] [% IF ( mandatorypassword ) %]Required[% END %][% IF ( ERROR_short_password ) %]Password is too short[% END %] [% IF ( minPasswordLength ) %]
    Minimum password length: [% minPasswordLength %]
    [% END %] -
  • + +
  • + [% IF ( mandatorypassword ) %] +
  • + [% UNLESS ( opadd ) %] diff --git a/members/member-password.pl b/members/member-password.pl index 25e9551..dce3e78 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -40,17 +40,21 @@ $flagsrequired->{borrowers}=1; my $member=$input->param('member'); my $cardnumber = $input->param('cardnumber'); my $destination = $input->param('destination'); -my $errormsg; +my @errors; my ($bor)=GetMember('borrowernumber' => $member); if(( $member ne $loggedinuser ) && ($bor->{'category_type'} eq 'S' ) ) { - $errormsg = 'NOPERMISSION' unless($staffflags->{'superlibrarian'} || $staffflags->{'staffaccess'} ); + push(@errors,'NOPERMISSION') unless($staffflags->{'superlibrarian'} || $staffflags->{'staffaccess'} ); # need superlibrarian for koha-conf.xml fakeuser. } my $newpassword = $input->param('newpassword'); +my $newpassword2 = $input->param('newpassword2'); + +push(@errors,'NOMATCH') if ( ( $newpassword && $newpassword2 ) && ($newpassword ne $newpassword2) ); + my $minpw = C4::Context->preference('minPasswordLength'); -$errormsg = 'SHORTPASSWORD' if( $newpassword && $minpw && (length($newpassword) < $minpw ) ); +push(@errors,'SHORTPASSWORD') if( $newpassword && $minpw && (length($newpassword) < $minpw ) ); -if ( $newpassword && ! $errormsg ) { +if ( $newpassword && !scalar(@errors) ) { my $digest=md5_base64($input->param('newpassword')); my $uid = $input->param('newuserid'); my $dbh=C4::Context->dbh; @@ -62,13 +66,7 @@ if ( $newpassword && ! $errormsg ) { print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member"); } } else { - $errormsg = 'BADUSERID'; - $template->param(othernames => $bor->{'othernames'}, - surname => $bor->{'surname'}, - firstname => $bor->{'firstname'}, - userid => $bor->{'userid'}, - defaultnewpassword => $newpassword - ); + push(@errors,'BADUSERID'); } } else { my $userid = $bor->{'userid'}; @@ -79,7 +77,9 @@ if ( $newpassword && ! $errormsg ) { for (my $i=0; $i<$length; $i++) { $defaultnewpassword.=substr($chars, int(rand(length($chars))),1); } - + + $template->param( defaultnewpassword => $defaultnewpassword ); +} if ( $bor->{'category_type'} eq 'C') { my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); my $cnt = scalar(@$catcodes); @@ -120,15 +120,15 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { userid => $bor->{'userid'}, destination => $destination, is_child => ($bor->{'category_type'} eq 'C'), - defaultnewpassword => $defaultnewpassword, + minPasswordLength => $minpw ); +if( scalar(@errors )){ + $template->param( errormsg => 1 ); + foreach my $error (@errors) { + $template->param($error) || $template->param( $error => 1); + } } -$template->param( member => $member, - errormsg => $errormsg, - $errormsg => 1 , - minPasswordLength => $minpw ); - output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/memberentry.pl b/members/memberentry.pl index f01261e..cbb479a 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -274,6 +274,8 @@ if ($op eq 'save' || $op eq 'insert'){ } my $password = $input->param('password'); + my $password2 = $input->param('password2'); + push @errors, "ERROR_password_mismatch" if ( $password ne $password2 ); push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) ); if (C4::Context->preference('ExtendedPatronAttributes')) { -- 1.7.3 From cnighswonger at foundations.edu Wed Nov 9 20:57:01 2011 From: cnighswonger at foundations.edu (Chris Nighswonger) Date: Wed, 9 Nov 2011 14:57:01 -0500 Subject: [Koha-patches] [PATCH] [BZ6679] Reverting a portion of commit 607b5449bd5cb which breaks the label export script. Message-ID: <1320868621-27194-1-git-send-email-cnighswonger@foundations.edu> --- labels/label-print.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/labels/label-print.pl b/labels/label-print.pl index 5da731b..9e48590 100755 --- a/labels/label-print.pl +++ b/labels/label-print.pl @@ -112,8 +112,8 @@ elsif ($op eq 'none') { # setup select menus for selecting layout and template for this run... $referer = $ENV{'HTTP_REFERER'}; $referer =~ s/^.*?:\/\/.*?(\/.*)$/$1/m; - @batch_ids = grep{my $id = $_; $id = {batch_id => $id}} @batch_ids; - @label_ids = grep{my $id = $_; $id = {label_id => $id}} @label_ids; + @batch_ids = grep{$_ = {batch_id => $_}} @batch_ids; + @label_ids = grep{$_ = {label_id => $_}} @label_ids; @item_numbers = grep{my $number=$_; $number = {item_number => $number}} @item_numbers; $templates = get_all_templates(field_list => 'template_id, template_code', filter => 'creator = "Labels"'); $layouts = get_all_layouts(field_list => 'layout_id, layout_name', filter => 'creator = "Labels"'); -- 1.7.0.4 From cnighswonger at foundations.edu Wed Nov 9 21:50:10 2011 From: cnighswonger at foundations.edu (Chris Nighswonger) Date: Wed, 9 Nov 2011 15:50:10 -0500 Subject: [Koha-patches] [PATCH 2/2] [BZ6679] Don't change $_ in a list context Message-ID: <1320871810-29319-1-git-send-email-cnighswonger@foundations.edu> --- labels/label-print.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/labels/label-print.pl b/labels/label-print.pl index 9e48590..ce99959 100755 --- a/labels/label-print.pl +++ b/labels/label-print.pl @@ -112,8 +112,8 @@ elsif ($op eq 'none') { # setup select menus for selecting layout and template for this run... $referer = $ENV{'HTTP_REFERER'}; $referer =~ s/^.*?:\/\/.*?(\/.*)$/$1/m; - @batch_ids = grep{$_ = {batch_id => $_}} @batch_ids; - @label_ids = grep{$_ = {label_id => $_}} @label_ids; + @batch_ids = map{{batch_id => $_}} @batch_ids; + @label_ids = map{{label_id => $_}} @label_ids; @item_numbers = grep{my $number=$_; $number = {item_number => $number}} @item_numbers; $templates = get_all_templates(field_list => 'template_id, template_code', filter => 'creator = "Labels"'); $layouts = get_all_layouts(field_list => 'layout_id, layout_name', filter => 'creator = "Labels"'); -- 1.7.0.4 From oleonard at myacpl.org Thu Nov 10 22:29:58 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Thu, 10 Nov 2011 16:29:58 -0500 Subject: [Koha-patches] [PATCH] Follow-up fix for Bug 5150 - Issuing should read Circulation Message-ID: <1320960598-3760-1-git-send-email-oleonard@myacpl.org> Really just a typo, but I found it when trying to chase down instances of this bug, so here you go. --- .../prog/en/modules/help/reports/catalogue_out.tt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/reports/catalogue_out.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/reports/catalogue_out.tt index 5152371..3cbd511 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/reports/catalogue_out.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/reports/catalogue_out.tt @@ -8,6 +8,6 @@

    You can also choose to export to a file that you can manipulate to your needs.

    -

    See the full documentation for the Issues with no Checkouts report in the manual (online).

    +

    See the full documentation for the Items with no Checkouts report in the manual (online).

    [% INCLUDE 'help-bottom.inc' %] \ No newline at end of file -- 1.7.3 From oleonard at myacpl.org Fri Nov 11 15:03:56 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Fri, 11 Nov 2011 09:03:56 -0500 Subject: [Koha-patches] [PATCH] Fix for Bug 7124 - back to search wrapping in lower resolutions Message-ID: <1321020236-7589-1-git-send-email-oleonard@myacpl.org> Maybe not a complete fix, but hopefully an improvement. I couldn't prevent it from wrapping at smaller browser widths, but I was able to change the style so that when it does wrap it's a little more readable. --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 35 +++++++++++--------- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 8 ++-- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 11c434f..5005fb8 100755 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -2173,36 +2173,39 @@ a.koha_url { background-color:#D9D9D9; } .nav_results ul.pg_menu { - height:25px; border-top: 1px solid #D0D0D0; + white-space : nowrap; } .nav_results ul.pg_menu li { color:#B2B2B2; - display:block; - float:left; - padding:5px 0; + display:inline; list-style:none; - text-align:center; + margin: 0; } -.nav_results ul.pg_menu li.back_results { - padding:5px 0px; - width:45%; +.nav_results ul.pg_menu li.back_results a { border-left: 1px solid #D0D0D0; border-right: 1px solid #D0D0D0; } -.nav_results ul.pg_menu li a { +.nav_results ul.pg_menu li a, +.nav_results ul.pg_menu li span { + background-color: #F3F3F3; + display : block; + float:left; + padding:.4em .5em; text-decoration:none; font-weight:normal; - color:#4D4D4D; + text-align:center; } -.nav_results ul.pg_menu li a:hover { - color:#006699; + +.nav_results ul.pg_menu li span { + color : #B2B2B2; } -.nav_results ul.pg_menu li.left_results { - margin-right:10px; + +.nav_results ul.pg_menu li.left_results a { + padding-left : 0; } -.nav_results ul.pg_menu li.right_results { - margin-left:10px; + +.nav_results ul.pg_menu li a:hover { } .nav_results #listResults{ diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 8cba98b..5f88067 100755 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -994,11 +994,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
    [% IF ( busc ) %] +
    + + - - -
    -- 1.6.5 From M.de.Rooy at rijksmuseum.nl Mon Nov 14 13:42:55 2011 From: M.de.Rooy at rijksmuseum.nl (Marcel de Rooy) Date: Mon, 14 Nov 2011 12:42:55 +0000 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 6190: BorrowerUnwantedField syspref and removing fields from the patron entry Message-ID: <809BE39CD64BFD4EB9036172EBCCFA31371DE5@S-MAIL-1B.rijksmuseum.intra> From: Srdjan Jankovic Signed-off-by: Katrin Fischer Tested with example from bug and by deleting parts of it: cardnumber|surname|firstname|title|othernames|initials|streetnumber|streettype|address|address2|city|state|zipcode|country|email|phone|mobile|fax|emailpro|phonepro|B_streetnumber|B_streettype|B_address|B_address2|B_city|B_state|B_zipcode|B_country|B_email|B_phone|dateofbirth|branchcode|categorycode|dateenrolled|dateexpiry|gonenoaddress|lost|debarred|contactname|contactfirstname|contacttitle|borrowernotes|relationship|sex|password|userid|opacnote|contactnote|sort1|sort2|altcontactfirstname|altcontactsurname|altcontactaddress1|altcontactaddress2|altcontactaddress3|altcontactstate|altcontactzipcode|altcontactcountry|altcontactphone Note: This only affects the edit screen, not the patron detail tab. A nice enhancement would be to make this page follow the system preference too. Signed-off-by: Marcel de Rooy QA comments on Bugzilla. Passing QA. --- admin/systempreferences.pl | 1 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 + .../prog/en/modules/admin/preferences/patrons.pref | 5 + .../prog/en/modules/help/members/memberentry.tt | 1 + .../prog/en/modules/members/memberentrygen.tt | 124 +++++++++++++++++++- members/memberentry.pl | 7 + 7 files changed, 142 insertions(+), 4 deletions(-) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 78d0768..f4069ae 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -224,6 +224,7 @@ $tabsysprefs{intranetreadinghistory} = "Patrons"; $tabsysprefs{NotifyBorrowerDeparture} = "Patrons"; $tabsysprefs{memberofinstitution} = "Patrons"; $tabsysprefs{BorrowerMandatoryField} = "Patrons"; +$tabsysprefs{BorrowerUnwantedField} = "Patrons"; $tabsysprefs{borrowerRelationship} = "Patrons"; $tabsysprefs{BorrowersTitles} = "Patrons"; $tabsysprefs{patronimages} = "Patrons"; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ae2c1cb..67f0d26 100755 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -325,6 +325,7 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn | a|a d', NULL, NULL, 'Textarea'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerUnwantedField','','Name the fields you don\'t need to store for a patron\'s account',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 815a71d..42c2e10 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4550,6 +4550,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.06.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerUnwantedField','','Name the fields you don\'t need to store for a patron\'s account',NULL,'free')"); + print "Upgrade to $DBversion done (BorrowerUnwantedField syspref)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index ac3e1d2..6bfa0df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -32,6 +32,11 @@ Patrons: class: multi - (separate columns with |) - + - "The following database columns will not appear on the patron entry screen:" + - pref: BorrowerUnwantedField + class: multi + - (separate columns with |) + - - "Guarantors can be the following of those they guarantee:" - pref: borrowerRelationship class: multi diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt index f61f5c1..fb91651 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt @@ -22,6 +22,7 @@
  • Enter the identifying information regarding your patron
    • Required fields are defined in the BorrowerMandatoryField system preference
    • +
    • Unwanted fields are defined in the BorrowerUnwantedField system preference
    • Salutation is populated by the BorrowersTitles system preference
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 47ea6c9..57771b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -178,10 +178,12 @@ [% END %] [% IF ( step_1 ) %] +[%UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames &&nosex %]
    [% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity
      [% UNLESS ( I ) %] + [% UNLESS notitle %] [% IF ( title_cgipopup ) %]
    1. [% IF ( mandatorytitle ) %] @@ -195,6 +197,8 @@
    2. [% END %] [% END %] + [% END %] + [% UNLESS nosurname %]
    3. [% IF ( mandatorysurname ) %]
    4. + [% END %] [% UNLESS ( I ) %] + [% UNLESS nofirstname %]
    5. [% IF ( mandatoryfirstname ) %]
    6. + [% END %] + [% UNLESS nodateofbirth %]
    7. [% IF ( mandatorydateofbirth ) %]
    8. + [% END %] + [% UNLESS noinitials %]
    9. [% IF ( mandatoryinitials ) %]
    10. [% END %] + [% END %] + [% UNLESS noothernames %]
    11. [% IF ( mandatoryothernames ) %]
    12. + [% END %] [% UNLESS ( I ) %] + [% UNLESS nosex %]
    13. [% IF ( female ) %] @@ -305,9 +319,11 @@ [% END %]
    14. + [% END %] [% END %]
    +[% END # hide fieldset %] [% IF ( showguarantor ) %]
    @@ -343,6 +359,7 @@ [% END %] Patron #: [% IF ( guarantorid ) %] [% guarantorid %][% END %] + [% UNLESS nocontactname %]
  • [% IF ( guarantorid ) %] @@ -356,6 +373,8 @@ [% END %] [% END %]
  • + [% END %] + [% UNLESS nocontactfirstname %]
  • [% IF ( guarantorid ) %] @@ -369,6 +388,7 @@ [% END %] [% END %]
  • + [% END %] [% IF ( relshiploop ) %]
  • @@ -398,8 +418,10 @@
  • [% END %] +[% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
    Main address
      + [% UNLESS nostreetnumber %]
    1. [% IF ( mandatorystreetnumber ) %]
    2. + [% END %] + [% UNLESS nostreettype %] [% IF ( road_cgipopup ) %]
    3. [% IF ( mandatorystreettype ) %] @@ -426,6 +450,8 @@ [% IF ( mandatorystreettype ) %]Required[% END %]
    4. [% END %] + [% END %] + [% UNLESS noaddress %]
    5. [% IF ( mandatoryaddress ) %]
    6. + [% END %] + [% UNLESS noaddress2 %]
    7. [% IF ( mandatoryaddress2 ) %]
    8. + [% END %] + [% UNLESS nocity %]
    9. [% IF ( mandatorycity ) %]
    10. + [% END %] + [% UNLESS nostate %]
    11. [% IF ( mandatorystate ) %]
    12. + [% END %] + [% UNLESS nozipcode %]
    13. [% IF ( mandatoryzipcode ) %]
    14. - + [% END %] + [% UNLESS nocountry %]
    15. [% IF ( mandatorycountry ) %]
    16. - + [% END %]
    +[% END # nostreet && nocity etc group%] + +[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
    Contact
      + [% UNLESS nophone %]
    1. [% IF ( mandatoryphone ) %]
    2. + [% END %] + [% UNLESS nophonepro %]
    3. [% IF ( mandatoryphonepro ) %]
    4. + [% END %] + [% UNLESS nomobile %]
    5. [% IF ( mandatorymobile ) %]
    6. + [% END %] + [% UNLESS noemail %]
    7. [% IF ( mandatoryemail ) %]
    8. + [% END %] + [% UNLESS noemailpro %]
    9. [% IF ( mandatoryemailpro ) %]
    10. + [% END %] + [% UNLESS nofax %]
    11. [% IF ( mandatoryfax ) %]
    12. + [% END %]
    - +[%END # hide fieldset %] [% END %] [% IF ( step_6 ) %] + [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %]
    Alternate address
      + [% UNLESS noB_address %]
    1. [% IF ( mandatoryB_address ) %]
    2. + [% END %] + [% UNLESS noB_address2 %]
    3. [% IF ( mandatoryB_address2 ) %]
    4. + [% END %] + [% UNLESS noB_city %]
    5. [% IF ( mandatoryB_city ) %]
    6. + [% END %] + [% UNLESS noB_state %]
    7. [% IF ( mandatoryB_state ) %]
    8. + [% END %] + [% UNLESS noB_zipcode %]
    9. [% IF ( mandatoryB_zipcode ) %]
    10. + [% END %] + [% UNLESS noB_country %]
    11. [% IF ( mandatoryB_country ) %]
    12. + [% END %] + [% UNLESS noB_phone %]
    13. [% IF ( mandatoryB_phone ) %]
    14. + [% END %] + [% UNLESS noB_email %]
    15. [% IF ( mandatoryB_email ) %]
    16. + [% END %] + [% UNLESS nocontactnote %]
    17. [% IF ( mandatorycontactnote ) %]
    18. + [% END %]
    + [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %] [% END %] [% IF ( step_2 ) %] + [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
    Alternate Contact
      + [% UNLESS noaltcontactsurname %]
    1. [% IF ( mandatoryaltcontactsurname ) %]
    2. + [% END %] + [% UNLESS noaltcontactfirstname %]
    3. [% IF ( mandatoryaltcontactfirstname ) %]
    4. + [% END %] + [% UNLESS noaltcontactaddress1 %]
    5. [% IF ( mandatoryaltcontactaddress1 ) %]
    6. + [% END %] + [% UNLESS noaltcontactaddress2 %]
    7. [% IF ( mandatoryaltcontactaddress2 ) %]
    8. + [% END %] + [% UNLESS noaltcontactaddress3 %]
    9. [% IF ( mandatoryaltcontactaddress3 ) %]
    10. + [% END %] + [% UNLESS noaltcontactstate %]
    11. [% IF ( mandatoryaltcontactstate ) %]
    12. + [% END %] + [% UNLESS noaltcontactzipcode %]
    13. [% IF ( mandatoryaltcontactzipcode ) %]
    14. + [% END %] + [% UNLESS noaltcontactcountry %]
    15. [% IF ( mandatoryaltcontactcountry ) %]
    16. + [% END %] + [% UNLESS noaltcontactphone %]
    17. [% IF ( mandatoryaltcontactphone ) %]
    18. + [% END %]
    + [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %] [% END %] [% IF ( step_3 ) %]
    Library Management
      + [% UNLESS nocardnumber %]
    1. [% IF ( mandatorycardnumber ) %]
    2. + [% END %] + [% UNLESS nobranchcode %]
    3. [% IF ( mandatorybranchcode ) %]
    4. + [% END %]
    5. + [% UNLESS nosort1 %]
    6. [% IF ( mandatorysort1 ) %]
    7. + [% END %] + [% UNLESS nosort2 %]
    8. [% IF ( mandatorysort2 ) %]
    9. + [% END %]
    + [% UNLESS nodateenrolled && nodateexpiry && noopacnote && noborrowernotes %]
    Library set-up
      + [% UNLESS nodateenrolled %]
    1. [% IF ( mandatorydateenrolled ) %]
    2. + [% END %] + [% UNLESS nodateexpiry %]
    3. [% IF ( mandatorydateexpiry ) %]
    4. + [% END %] + [% UNLESS noopacnote %]
    5. [% IF ( mandatoryopacnote ) %]
    6. + [% END %] + [% UNLESS noborrowernotes %]
    7. [% IF ( mandatoryborrowernotes ) %]
    8. + [% END %]
    + [% END # hide fieldset %] + + [% UNLESS nouserid && nopassword %]
    OPAC/Staff Login
      + [% UNLESS nouserid %]
    1. [% IF ( mandatoryuserid ) %]
    2. + [%END %] + [% UNLESS nopassword %]
    3. [% IF ( mandatorypassword ) %]
    + + [% END %] +
    + [% END # hide fieldset %] [% UNLESS ( opadd ) %]
    diff --git a/members/memberentry.pl b/members/memberentry.pl index f01261e..0c8d984 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -100,6 +100,13 @@ my @field_check=split(/\|/,$check_BorrowerMandatoryField); foreach (@field_check) { $template->param( "mandatory$_" => 1); } +# function to designate unwanted fields +my $check_BorrowerUnwantedField=C4::Context->preference("BorrowerUnwantedField"); + at field_check=split(/\|/,$check_BorrowerUnwantedField); +foreach (@field_check) { + next unless m/\w/o; + $template->param( "no$_" => 1); +} $template->param( "add" => 1 ) if ( $op eq 'add' ); $template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' ); $template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 ); -- 1.6.0.6 From lrea at nekls.org Mon Nov 14 21:51:35 2011 From: lrea at nekls.org (lrea at nekls.org) Date: Mon, 14 Nov 2011 14:51:35 -0600 Subject: [Koha-patches] [PATCH] Bug 7207 - Reverting a portion of commit 607b5449bd5cb which breaks the label export script. Message-ID: <1321303895-21230-1-git-send-email-lrea@nekls.org> From: Chris Nighswonger squashed chris_n's two patches. Label export works again. Also changed the pattern for the item_number to the known working, critic friendly pattern. Don't change $_ in a list context Changed the 3rd bit to the critic friendly pattern chris_n suggests in the previous two lines. --- labels/label-print.pl | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/labels/label-print.pl b/labels/label-print.pl index 5da731b..3947163 100755 --- a/labels/label-print.pl +++ b/labels/label-print.pl @@ -112,9 +112,9 @@ elsif ($op eq 'none') { # setup select menus for selecting layout and template for this run... $referer = $ENV{'HTTP_REFERER'}; $referer =~ s/^.*?:\/\/.*?(\/.*)$/$1/m; - @batch_ids = grep{my $id = $_; $id = {batch_id => $id}} @batch_ids; - @label_ids = grep{my $id = $_; $id = {label_id => $id}} @label_ids; - @item_numbers = grep{my $number=$_; $number = {item_number => $number}} @item_numbers; + @batch_ids = map{{batch_id => $_}} @batch_ids; + @label_ids = map{{label_id => $_}} @label_ids; + @item_numbers = map{{item_number => $_}} @item_numbers; $templates = get_all_templates(field_list => 'template_id, template_code', filter => 'creator = "Labels"'); $layouts = get_all_layouts(field_list => 'layout_id, layout_name', filter => 'creator = "Labels"'); $output_formats = get_output_formats(); -- 1.7.2.5 From srdjan at catalyst.net.nz Tue Nov 15 00:21:35 2011 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Tue, 15 Nov 2011 12:21:35 +1300 Subject: [Koha-patches] [PATCH] bug_6303: Display Organisation and Parent Organisation names when viewing a borrower of type organistaion In-Reply-To: References: Message-ID: <1321312895-1392-1-git-send-email-srdjan@catalyst.net.nz> --- C4/Members.pm | 22 ++++++++++--------- circ/circulation.pl | 7 ++++- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 2 +- .../prog/en/includes/patron-title.inc | 6 +++++ .../prog/en/modules/circ/circulation.tt | 21 ++++++++++--------- .../prog/en/modules/members/boraccount.tt | 4 +- .../prog/en/modules/members/member.tt | 4 ++- .../prog/en/modules/members/moremember.tt | 10 +++++++- .../prog/en/modules/members/notices.tt | 6 ++-- .../prog/en/modules/members/readingrec.tt | 4 +- .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 17 +++++++++++--- .../opac-tmpl/prog/en/includes/patron-title.inc | 5 ++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 7 ++++- .../opac-tmpl/prog/en/modules/opac-userupdate.tt | 7 ++++- members/boraccount.pl | 3 +- members/moremember.pl | 6 ++-- members/readingrec.pl | 1 + opac/opac-user.pl | 3 ++ tools/viewlog.pl | 3 ++ 19 files changed, 93 insertions(+), 45 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/patron-title.inc diff --git a/C4/Members.pm b/C4/Members.pm index 56718f0..4f5a299 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -313,11 +313,11 @@ sub GetMemberDetails { my $query; my $sth; if ($borrowernumber) { - $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); + $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); $sth->execute($borrowernumber); } elsif ($cardnumber) { - $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); + $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); $sth->execute($cardnumber); } else { @@ -340,14 +340,16 @@ sub GetMemberDetails { $borrower->{'flags'} = $flags; $borrower->{'authflags'} = $accessflagshash; - # find out how long the membership lasts - $sth = - $dbh->prepare( - "select enrolmentperiod from categories where categorycode = ?"); - $sth->execute( $borrower->{'categorycode'} ); - my $enrolment = $sth->fetchrow; - $borrower->{'enrolmentperiod'} = $enrolment; - + # For the purposes of making templates easier, we'll define a + # 'showname' which is the alternate form the user's first name if + # 'other name' is defined. + if ($borrower->{category_type} eq 'I') { + $borrower->{'showname'} = $borrower->{'othernames'}; + $borrower->{'showname'} .= " $borrower->{'firstname'}" if $borrower->{'firstname'}; + } else { + $borrower->{'showname'} = $borrower->{'firstname'}; + } + return ($borrower); #, $flags, $accessflagshash); } diff --git a/circ/circulation.pl b/circ/circulation.pl index efb87da..378956e 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -629,9 +629,9 @@ my (undef, $roadttype_hashref) = &GetRoadTypes(); my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'}; my $fast_cataloging = 0; - if (defined getframeworkinfo('FA')) { +if (defined getframeworkinfo('FA')) { $fast_cataloging = 1 - } +} if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); @@ -654,6 +654,8 @@ $template->param( printername => $printer, firstname => $borrower->{'firstname'}, surname => $borrower->{'surname'}, + showname => $borrower->{'showname'}, + category_type => $borrower->{'category_type'}, dateexpiry => format_date($newexpiry), expiry => format_date($borrower->{'dateexpiry'}), categorycode => $borrower->{'categorycode'}, @@ -669,6 +671,7 @@ $template->param( country => $borrower->{'country'}, phone => $borrower->{'phone'} || $borrower->{'mobile'}, cardnumber => $borrower->{'cardnumber'}, + othernames => $borrower->{'othernames'}, amountold => $amountold, barcode => $barcode, stickyduedate => $stickyduedate, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 67300d5..6556562 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -1,5 +1,5 @@ [% IF ( borrowernumber ) %] -
    [% firstname %] [% surname %] ([% cardnumber %])
    +
    [% INCLUDE 'patron-title.inc' %]
    =0A=
    =0A= [% END %]=0A= +=0A= +=0A= +[% IF DashBoardDisplayed %]=0A= +[% UNLESS nofile %]=0A= +
    =0A= +Koha Library Dashboard=0A= + =0A= + =0A= + =0A= + =0A= + =0A= +
    =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= +
    OverviewSystemMy Library
    Number of Biblios=0A= + [% number_of_biblios %]
    Biblios added in last 7 days[% biblios_7days %]
    Number of Items[% items_system %][% items_library %]
    Number of items added in last 7 days [% items_7days_system %][% items_7days_system %]
    Registered Borrowers[% borrowers_system %][% borrowers_library %]
    Expired Borrowers[% expired_borrowers_system %][% expired_borrowers_library %]
     
    =0A= + Last updated: [% last_updated %]=0A= +
    =0A= =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= +
    CirculationSystemMy Library
    Items on Loan=0A= + [% issues_system %][% issues_library %]
    Loan History[% loan_history_system %][% loan_history_library %]
    Items Overdue[% overdues_system %][% overdues_library %]
    Overdue within 7 days[% overdues_7days_system %][% overdues_7days_library %]
    Overdue 8-14 days[% overdues_14days_system %][% overdues_14days_library %]
    Overdue 15-21 days[% overdues_21days_system %][% overdues_21days_library %]
    Very Overdue Items[% very_overdue_system %][% very_overdue_library %]
    =0A= +
    =0A= +
    =0A= +
    =0A= +=0A= +=0A= +[% END %]=0A= +[% END %]=0A= +[% IF nofile %]=0A= +[% nofile %]=0A= +[% END %]=0A= =0A= [% INCLUDE 'intranet-bottom.inc' %]=0A= diff --git a/mainpage.pl b/mainpage.pl=0A= index 25ee475..62d3fee 100755=0A= --- a/mainpage.pl=0A= +++ b/mainpage.pl=0A= @@ -67,4 +67,180 @@ $template->param(=0A= koha_news_count =3D> $koha_news_count=0A= );=0A= =0A= +# Dashboard (If on in SysPref)=0A= +my $nofile =3D "Dashboard is set to \"ON\". However there is no XML = file to read. Have you run it at least once?";=0A= +unless ( C4::Context->preference('DashBoardDisplayed') =3D=3D 0 )=0A= + {=0A= + my $koha_conf =3D $ENV{'KOHA_CONF'};=0A= + my ($base,$file) =3D $koha_conf =3D~ m|^(.*[/\\])([^/\\]+?)$|;=0A= + my $xml_read =3D "dashboard_xml.out";=0A= + my $xml_file =3D "$base"."$xml_read";=0A= +if (-e $xml_file) {=0A= + my $xml =3D new XML::Simple;=0A= + my $dash =3D $xml->XMLin($xml_file);=0A= + my $login_branch_name =3D $template->{VARS}{LoginBranchcode};=0A= + my $number_of_biblios;=0A= + my $biblios_7days;=0A= + my $items_7days_system;=0A= + my $items_7days_library;=0A= + my $borrowers_system;=0A= + my $expired_borrowers_library;=0A= + my $expired_borrowers_system;=0A= + my $loan_history_system;=0A= + my $loan_history_library;=0A= + my $overdues_library;=0A= + my $overdues_system;=0A= + my $overdues_7days_library;=0A= + my $overdues_7days_system;=0A= + my $overdues_14days_library;=0A= + my $overdues_14days_system;=0A= + my $overdues_21days_library;=0A= + my $overdues_21days_system;=0A= + my $very_overdue_library;=0A= + my $very_overdue_system;=0A= + my $borrowers_library;=0A= + my $issues_library;=0A= + my $issues_system;=0A= + my $items_library;=0A= + my $items_system;=0A= + my $last_updated;=0A= + =0A= + $number_of_biblios =3D = $dash->{biblios}->{NumberOfBiblios};=0A= + $biblios_7days =3D = $dash->{biblio_7days}->{NumberOfBiblio7Days};=0A= + $items_7days_system =3D = $dash->{items_7days_system}->{NumberOfItems7Days};=0A= + $borrowers_system =3D = $dash->{number_of_borrowers_system}->{NumberofBorrowersSystem};=0A= + $loan_history_system =3D = $dash->{loan_history_system}->{NumberOfLoans};=0A= + $items_system =3D = $dash->{items_system}->{NumberOfItemsSystem};=0A= + $expired_borrowers_system =3D = $dash->{expired_borrowers_system}->{ExpiredBorrowers};=0A= + $issues_system =3D = $dash->{issues_system}->{NumberOfIssuesSystem};=0A= + $overdues_system =3D = $dash->{overdues_system}->{NumberOfOverdues};=0A= + $overdues_7days_system =3D = $dash->{overdues_7days_system}->{NumberOfOverdues};=0A= + $overdues_14days_system =3D = $dash->{overdues_14days_system}->{NumberOfOverdues14Days};=0A= + $overdues_21days_system =3D = $dash->{overdues_21days_system}->{NumberOfOverdues21Days};=0A= + $very_overdue_system =3D = $dash->{very_overdue_system}->{Overdues};=0A= + $last_updated =3D = $dash->{last_updated}->{UpdatedTime};=0A= +=0A= +# Looping for "logged in branch" dependant data =0A= + foreach my $numissl(@{$dash->{issues_library}})=0A= + {=0A= + if($numissl->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $issues_library =3D $numissl->{NumberOfIssues}=0A= + }=0A= + }=0A= + foreach my $numitm(@{$dash->{items_library}})=0A= + {=0A= + if($numitm->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $items_library =3D $numitm->{NumberOfItems}=0A= + }=0A= + }=0A= + foreach my $numbor(@{$dash->{borrowers_library}})=0A= + {=0A= + if($numbor->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $borrowers_library =3D = $numbor->{NumberOfBorrowers}=0A= + }=0A= + }=0A= + foreach my $numex(@{$dash->{expired_borrowers_library}})=0A= + {=0A= + if($numex->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $expired_borrowers_library =3D = $numex->{ExpiredBorrowers}=0A= + }=0A= + }=0A= + =0A= + foreach my $numitm7(@{$dash->{items_7days_library}})=0A= + {=0A= + if($numitm7->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $items_7days_library =3D = $numitm7->{NumberOfItems7DaysLibrary}=0A= + }=0A= + }=0A= + =0A= + foreach my $oldiss(@{$dash->{loan_history_library}})=0A= + {=0A= + if($oldiss->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $loan_history_library =3D = $oldiss->{NumberOfLoans}=0A= + }=0A= + }=0A= + =0A= + foreach my $ovdlib(@{$dash->{overdues_library}})=0A= + {=0A= + if($ovdlib->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $overdues_library =3D = $ovdlib->{NumberOfOverdues}=0A= + }=0A= + }=0A= + =0A= + foreach my $ovd7day(@{$dash->{overdues_7days_library}})=0A= + {=0A= + if($ovd7day->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $overdues_7days_library =3D = $ovd7day->{NumberOfOverdues7Days}=0A= + }=0A= + }=0A= + =0A= + foreach my $ovd14day(@{$dash->{overdues_14days_library}})=0A= + {=0A= + if($ovd14day->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $overdues_14days_library =3D = $ovd14day->{NumberOfOverdues14Days}=0A= + }=0A= + }=0A= + =0A= + foreach my $ovd21day(@{$dash->{overdues_21days_library}})=0A= + {=0A= + if($ovd21day->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $overdues_21days_library =3D = $ovd21day->{NumberOfOverdues21Days}=0A= + }=0A= + }=0A= + =0A= + foreach my $vryod(@{$dash->{very_overdue_library}})=0A= + {=0A= + if($vryod->{BranchCode} eq $login_branch_name)=0A= + {=0A= + $very_overdue_library =3D = $vryod->{NumberOfVeryOverdue}=0A= + }=0A= + }=0A= + =0A= + $template->param('number_of_biblios' =3D> = $number_of_biblios,=0A= + 'biblios_7days' =3D> = $biblios_7days,=0A= + 'items_7days_system' =3D> = $items_7days_system,=0A= + 'items_7days_library' =3D> = $items_7days_library,=0A= + 'borrowers_system' =3D> = $borrowers_system,=0A= + 'expired_borrowers_library' =3D> = $expired_borrowers_library,=0A= + 'expired_borrowers_system' =3D> = $expired_borrowers_system,=0A= + 'overdues_library' =3D> = $overdues_library,=0A= + 'overdues_system' =3D> = $overdues_system,=0A= + 'overdues_7days_library' =3D> = $overdues_7days_library,=0A= + 'overdues_7days_system' =3D> = $overdues_7days_system,=0A= + 'overdues_14days_library' =3D> = $overdues_14days_library,=0A= + 'overdues_14days_system' =3D> = $overdues_14days_system,=0A= + 'overdues_21days_library' =3D> = $overdues_21days_library,=0A= + 'overdues_21days_system' =3D> = $overdues_21days_system,=0A= + 'very_overdue_library' =3D> = $very_overdue_library,=0A= + 'very_overdue_system' =3D> = $very_overdue_system,=0A= + 'loan_history_system' =3D> = $loan_history_system,=0A= + 'loan_history_library' =3D> = $loan_history_library,=0A= + 'issues_library' =3D> = $issues_library,=0A= + 'issues_system' =3D> = $issues_system,=0A= + 'items_library' =3D> = $items_library,=0A= + 'items_system' =3D> = $items_system,=0A= + 'borrowers_library' =3D> = $borrowers_library,=0A= + 'last_updated' =3D> = $last_updated=0A= + =0A= + );=0A= +}=0A= +=0A= +elsif(!-e $xml_file) {=0A= + $template->param('nofile' =3D> $nofile,);=0A= + }=0A= +=0A= +}=0A= +=0A= +# Dashboard end=0A= +=0A= output_html_with_http_headers $query, $cookie, $template->output;=0A= -- =0A= 1.7.2.5=0A= =0A= ------=_NextPart_000_00D3_01CCA467.DA4CE140-- From srdjan at catalyst.net.nz Thu Nov 17 00:47:48 2011 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Thu, 17 Nov 2011 12:47:48 +1300 Subject: [Koha-patches] [PATCH] bug_6303: Display Organisation and Parent Organisation names when viewing a borrower of type organistaion In-Reply-To: References: Message-ID: <1321487268-26482-1-git-send-email-srdjan@catalyst.net.nz> --- C4/Members.pm | 22 ++++++++++--------- circ/circulation.pl | 7 ++++- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 2 +- .../prog/en/includes/patron-title.inc | 6 +++++ .../prog/en/modules/circ/circulation.tt | 21 ++++++++++--------- .../prog/en/modules/members/boraccount.tt | 4 +- .../prog/en/modules/members/member.tt | 4 ++- .../prog/en/modules/members/moremember.tt | 10 +++++++- .../prog/en/modules/members/notices.tt | 6 ++-- .../prog/en/modules/members/readingrec.tt | 4 +- .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 17 +++++++++++--- .../opac-tmpl/prog/en/includes/patron-title.inc | 5 ++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 7 ++++- .../opac-tmpl/prog/en/modules/opac-userupdate.tt | 7 ++++- members/boraccount.pl | 3 +- members/moremember.pl | 6 ++-- members/readingrec.pl | 1 + opac/opac-user.pl | 2 + tools/viewlog.pl | 3 ++ 19 files changed, 92 insertions(+), 45 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/patron-title.inc diff --git a/C4/Members.pm b/C4/Members.pm index 56718f0..4f5a299 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -313,11 +313,11 @@ sub GetMemberDetails { my $query; my $sth; if ($borrowernumber) { - $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); + $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); $sth->execute($borrowernumber); } elsif ($cardnumber) { - $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); + $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); $sth->execute($cardnumber); } else { @@ -340,14 +340,16 @@ sub GetMemberDetails { $borrower->{'flags'} = $flags; $borrower->{'authflags'} = $accessflagshash; - # find out how long the membership lasts - $sth = - $dbh->prepare( - "select enrolmentperiod from categories where categorycode = ?"); - $sth->execute( $borrower->{'categorycode'} ); - my $enrolment = $sth->fetchrow; - $borrower->{'enrolmentperiod'} = $enrolment; - + # For the purposes of making templates easier, we'll define a + # 'showname' which is the alternate form the user's first name if + # 'other name' is defined. + if ($borrower->{category_type} eq 'I') { + $borrower->{'showname'} = $borrower->{'othernames'}; + $borrower->{'showname'} .= " $borrower->{'firstname'}" if $borrower->{'firstname'}; + } else { + $borrower->{'showname'} = $borrower->{'firstname'}; + } + return ($borrower); #, $flags, $accessflagshash); } diff --git a/circ/circulation.pl b/circ/circulation.pl index efb87da..378956e 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -629,9 +629,9 @@ my (undef, $roadttype_hashref) = &GetRoadTypes(); my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'}; my $fast_cataloging = 0; - if (defined getframeworkinfo('FA')) { +if (defined getframeworkinfo('FA')) { $fast_cataloging = 1 - } +} if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); @@ -654,6 +654,8 @@ $template->param( printername => $printer, firstname => $borrower->{'firstname'}, surname => $borrower->{'surname'}, + showname => $borrower->{'showname'}, + category_type => $borrower->{'category_type'}, dateexpiry => format_date($newexpiry), expiry => format_date($borrower->{'dateexpiry'}), categorycode => $borrower->{'categorycode'}, @@ -669,6 +671,7 @@ $template->param( country => $borrower->{'country'}, phone => $borrower->{'phone'} || $borrower->{'mobile'}, cardnumber => $borrower->{'cardnumber'}, + othernames => $borrower->{'othernames'}, amountold => $amountold, barcode => $barcode, stickyduedate => $stickyduedate, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 67300d5..6556562 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -1,5 +1,5 @@ [% IF ( borrowernumber ) %] -
    [% firstname %] [% surname %] ([% cardnumber %])
    +
    [% INCLUDE 'patron-title.inc' %]
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/C4/SIP/sip_run.sh b/C4/SIP/sip_run.sh deleted file mode 100755 index 587e323..0000000 --- a/C4/SIP/sip_run.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# A sample script for starting SIP. -# You probably want to specify new log destinations. -# -# Takes 3 optional arguments: -# ~ SIPconfig.xml file to use -# ~ file for STDOUT, default ~/sip.out -# ~ file for STDERR, default ~/sip.err -# -# The STDOUT and STDERR files are only for the SIPServer process itself. -# Actual SIP communication and transaction logs are handled by Syslog. -# -# Examples: -# sip_run.sh /path/to/SIPconfig.xml -# sip_run.sh ~/my_sip/SIPconfig.xml sip_out.log sip_err.log - - -for x in HOME PERL5LIB KOHA_CONF ; do - echo $x=${!x} - if [ -z ${!x} ] ; then - echo ERROR: $x not defined; - exit 1; - fi; -done; -unset x; -cd $PERL5LIB/C4/SIP; -echo; -echo Running from `pwd`; - -sipconfig=${1:-`pwd`/SIPconfig.xml}; -outfile=${2:-$HOME/sip.out}; -errfile=${3:-$HOME/sip.err}; - -echo "Calling (backgrounded):"; -echo "perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile"; -perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile & diff --git a/C4/SIP/sip_shutdown.sh b/C4/SIP/sip_shutdown.sh deleted file mode 100755 index 07abbce..0000000 --- a/C4/SIP/sip_shutdown.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -. $HOME/.bash_profile - -# this is brittle: the primary server must have the lowest PPID -# this is brittle: ps behavior is very platform-specific, only tested on Debian Etch - -target="SIPServer"; -PROCPID=$(ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep | head -1 | awk '{print $1}'); - -if [ ! $PROCPID ] ; then - echo "No processes found for $target"; - exit; -fi - -echo "SIP Processes for this user ($USER):"; -ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep ; -echo "Killing process #$PROCPID"; -kill $PROCPID; diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml new file mode 100644 index 0000000..f229b9a --- /dev/null +++ b/etc/SIPconfig.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/misc/bin/sip_run.sh b/misc/bin/sip_run.sh new file mode 100755 index 0000000..587e323 --- /dev/null +++ b/misc/bin/sip_run.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# A sample script for starting SIP. +# You probably want to specify new log destinations. +# +# Takes 3 optional arguments: +# ~ SIPconfig.xml file to use +# ~ file for STDOUT, default ~/sip.out +# ~ file for STDERR, default ~/sip.err +# +# The STDOUT and STDERR files are only for the SIPServer process itself. +# Actual SIP communication and transaction logs are handled by Syslog. +# +# Examples: +# sip_run.sh /path/to/SIPconfig.xml +# sip_run.sh ~/my_sip/SIPconfig.xml sip_out.log sip_err.log + + +for x in HOME PERL5LIB KOHA_CONF ; do + echo $x=${!x} + if [ -z ${!x} ] ; then + echo ERROR: $x not defined; + exit 1; + fi; +done; +unset x; +cd $PERL5LIB/C4/SIP; +echo; +echo Running from `pwd`; + +sipconfig=${1:-`pwd`/SIPconfig.xml}; +outfile=${2:-$HOME/sip.out}; +errfile=${3:-$HOME/sip.err}; + +echo "Calling (backgrounded):"; +echo "perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile"; +perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile & diff --git a/misc/bin/sip_shutdown.sh b/misc/bin/sip_shutdown.sh new file mode 100755 index 0000000..07abbce --- /dev/null +++ b/misc/bin/sip_shutdown.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +. $HOME/.bash_profile + +# this is brittle: the primary server must have the lowest PPID +# this is brittle: ps behavior is very platform-specific, only tested on Debian Etch + +target="SIPServer"; +PROCPID=$(ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep | head -1 | awk '{print $1}'); + +if [ ! $PROCPID ] ; then + echo "No processes found for $target"; + exit; +fi + +echo "SIP Processes for this user ($USER):"; +ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep ; +echo "Killing process #$PROCPID"; +kill $PROCPID; -- 1.7.5.4 From srdjan at catalyst.net.nz Fri Nov 18 09:53:17 2011 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Fri, 18 Nov 2011 21:53:17 +1300 Subject: [Koha-patches] [PATCH] bug_7243: C4::Members::GetMemberAccountRecords() changes In-Reply-To: References: Message-ID: <1321606397-19838-1-git-send-email-srdjan@catalyst.net.nz> Input params: $borrowernumber, $fines_only If $fines_only is true, discard assount records of type 'Rent', 'Res' and authorised_values MANUAL_INV Dropped input param $date, it is not used Set $fines_only to true when calling GetMemberAccountRecords() from C4::Circulation::CanBookBeIssued() and C4::Members::patronflags(). That way only fines decide whether an item can be issued, and not other non-fine charges --- C4/Circulation.pm | 2 +- C4/Members.pm | 20 ++++++++++++-------- circ/circulation.pl | 13 ++++++------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9f81773..63a5701 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -729,7 +729,7 @@ sub CanBookBeIssued { # DEBTS my ($amount) = - C4::Members::GetMemberAccountRecords( $borrower->{'borrowernumber'}, '' && $duedate->output('iso') ); + C4::Members::GetMemberAccountRecords( $borrower->{'borrowernumber'}, 'FINES ONLY' ); my $amountlimit = C4::Context->preference("noissuescharge"); my $allowfineoverride = C4::Context->preference("AllowFineOverride"); my $allfinesneedoverride = C4::Context->preference("AllFinesNeedOverride"); diff --git a/C4/Members.pm b/C4/Members.pm index 4f5a299..86c78c0 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -420,7 +420,7 @@ sub patronflags { my %flags; my ( $patroninformation) = @_; my $dbh=C4::Context->dbh; - my ($amount) = GetMemberAccountRecords( $patroninformation->{'borrowernumber'}); + my ($amount) = GetMemberAccountRecords( $patroninformation->{'borrowernumber'}, 'FINES ONLY'); if ( $amount > 0 ) { my %flaginfo; my $noissuescharge = C4::Context->preference("noissuescharge") || 5; @@ -1119,7 +1119,7 @@ sub GetAllIssues { =head2 GetMemberAccountRecords - ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber); + ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber, $fines_only); Looks up accounting data for the patron with the given borrowernumber. @@ -1129,11 +1129,13 @@ keys are the fields of the C 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. +If C<$fines_only> flag is set to true, only fines are taken in account + =cut #' sub GetMemberAccountRecords { - my ($borrowernumber,$date) = @_; + my ($borrowernumber, $fines_only) = @_; my $dbh = C4::Context->dbh; my @acctlines; my $numlines = 0; @@ -1141,14 +1143,16 @@ sub GetMemberAccountRecords { SELECT * FROM accountlines WHERE borrowernumber=?); - my @bind = ($borrowernumber); - if ($date && $date ne ''){ - $strsth.=" AND date < ? "; - push(@bind,$date); + if ($fines_only) { + $strsth .= " AND accounttype NOT IN ( + 'Res', + 'Rent', + (SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV') + )"; } $strsth.=" ORDER BY date desc,timestamp DESC"; my $sth= $dbh->prepare( $strsth ); - $sth->execute( @bind ); + $sth->execute( $borrowernumber ); my $total = 0; while ( my $data = $sth->fetchrow_hashref ) { if ( $data->{itemnumber} ) { diff --git a/circ/circulation.pl b/circ/circulation.pl index 378956e..5814617 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -187,8 +187,7 @@ if ( $print eq 'yes' && $borrowernumber ne '' ) { my $borrowerslist; my $message; if ($findborrower) { - my $borrowers = Search($findborrower, 'cardnumber'); - my @borrowers = @$borrowers; + my $borrowers = Search($findborrower, 'cardnumber') || []; if (C4::Context->preference("AddPatronLists")) { $template->param( "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1", @@ -199,17 +198,17 @@ if ($findborrower) { $template->param(categories=>$categories); } } - if ( $#borrowers == -1 ) { + if ( @$borrowers == 0 ) { $query->param( 'findborrower', '' ); $message = "'$findborrower'"; } - elsif ( $#borrowers == 0 ) { - $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} ); + elsif ( @$borrowers == 1 ) { + $borrowernumber = $borrowers->[0]->{'borrowernumber'}; + $query->param( 'borrowernumber', $borrowernumber ); $query->param( 'barcode', '' ); - $borrowernumber = $borrowers[0]->{'borrowernumber'}; } else { - $borrowerslist = \@borrowers; + $borrowerslist = $borrowers; } } -- 1.6.5 From oleonard at myacpl.org Fri Nov 18 18:28:21 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Fri, 18 Nov 2011 12:28:21 -0500 Subject: [Koha-patches] [PATCH] Bug 6836 follow-up: Working on CSS to make more like existing interface Message-ID: <1321637301-16370-1-git-send-email-oleonard@myacpl.org> - Changing default styles for Datatables pager, filter, etc. to make it more like the style we have now on table pagers - Adding another paging style via a plugin function in js/datatables.js to give us a "four_button" option (more like the old tablesorter.js pager). - Tweaking configuration on serials-home.tt and adding the same to readingrec.tt I don't have much serials data so I added it to readingrec.tt as well. --- koha-tmpl/intranet-tmpl/prog/en/css/datatables.css | 157 +++++++++++++++++++- koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 101 +++++++++++++ .../prog/en/modules/members/readingrec.tt | 26 +-- .../prog/en/modules/serials/serials-home.tt | 3 +- 4 files changed, 266 insertions(+), 21 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css b/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css index e069b93..fbd919c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css @@ -3,15 +3,15 @@ input.search_init { } .sorting_asc { padding-right: 19px; - background: url("../../img/datatables/sort_asc.png") no-repeat scroll right center #EEEEEE; + background: url("../../img/asc.gif") no-repeat scroll right center #EEEEEE; } .sorting_desc { padding-right: 19px; - background: url("../../img/datatables/sort_desc.png") no-repeat scroll right center #EEEEEE; + background: url("../../img/desc.gif") no-repeat scroll right center #EEEEEE; } .sorting { padding-right: 19px; - background: url("../../img/datatables/sort_both.png") no-repeat scroll right center #EEEEEE; + background: url("../../img/ascdesc.gif") no-repeat scroll right center #EEEEEE; } .sorting_asc_disabled { padding-right: 19px; @@ -26,6 +26,157 @@ input.search_init { background-color: #EEEEEE; } +div.top {clear : both; } + +div.top.pager, +div.bottom.pager { + background-color : #E5E5E5; + padding : 0; +} + +div.bottom.pager div.dataTables_paginate.paging_full_numbers, +div.bottom.pager div.dataTables_paginate.paging_four_button { + border-right-width : 0; +} + +div.dataTables_filter, +div.dataTables_length, +div.dataTables_info, +div.dataTables_paginate { + float: left; + padding : .3em .5em .3em .5em; + +} +div.dataTables_length { + border-right : 1px solid #686868; + line-height:1.9em; +} +div.dataTables_info { + border-right : 1px solid #AAA; + line-height:1.9em; +} +div.dataTables_length, +div.dataTables_filter { + border-left : 1px solid #FFF; +} +div.dataTables_filter { + line-height : 1.9em; +} +div.dataTables_paginate { + background-color : #F4F4F4; + font-size: 110%; + padding : 0; +} + +.paging_full_numbers span.paginate_button, +.paging_full_numbers span.paginate_active { + border-right : 1px solid #AAA; + border-left : 1px solid #FFF; + display : block; + float : left; + line-height:1.6em; + padding: .3em .7em; + cursor: pointer; +} + +.paging_full_numbers span.paginate_button { + color : #0000CC; +} +.paging_full_numbers span.paginate_button.first { + background-image : url('../../img/arrow-first.png'); + background-repeat: no-repeat; + background-position : 2px center; + padding-left : 2em; +} +.paging_full_numbers span.paginate_button.previous { + background-image : url('../../img/arrow-back.png'); + background-repeat: no-repeat; + background-position : 2px center; + padding-left : 2em; +} +.paging_full_numbers span.paginate_button.next { + background-image : url('../../img/arrow-next.png'); + background-repeat: no-repeat; + background-position : right center; + padding-right : 2em; +} +.paging_full_numbers span.paginate_button.last { + background-image : url('../../img/arrow-last.png'); + background-repeat: no-repeat; + background-position : right center; + border-right : 1px solid #686868; + padding-right : 2em; +} +div.bottom.pager .paging_full_numbers span.paginate_button.last { + border-right-width : 0; +} +.paging_full_numbers span.paginate_active { + background-color : #FFFFEA; + color : #000; + font-weight: bold; +} + +.paging_full_numbers span.paginate_button:hover { + background-color: #FFC; +} + +.paging_full_numbers span.paginate_button.paginate_button_disabled { + color : #666; +} + +/* Two-button version */ + +div.dataTables_paginate.paging_two_button, +div.dataTables_paginate.paging_four_button { + background-color : transparent; + border-right : 1px solid #686868; + border-left : 1px solid #FFF; + line-height : 1.8em; +} +.paginate_disabled_first, +.paginate_enabled_first, +.paginate_disabled_previous, +.paginate_enabled_previous, +.paginate_disabled_next, +.paginate_enabled_next, +.paginate_disabled_last, +.paginate_enabled_last { + float: left; + height: 16px; + margin: .5em; + width: 16px; +} +.paginate_disabled_first { + background-image: url("../../img/first-disabled.png"); +} +.paginate_enabled_first { + background-image: url("../../img/first.png"); + cursor: pointer; +} +.paginate_disabled_previous { + background-image: url("../../img/prev-disabled.png"); +} +.paginate_enabled_previous { + background-image: url("../../img/prev.png"); + cursor: pointer; +} +.paginate_disabled_next { + background-image: url("../../img/next-disabled.png"); +} +.paginate_enabled_next { + background-image: url("../../img/next.png"); + cursor: pointer; +} +.paginate_disabled_last { + background-image: url("../../img/last-disabled.png"); +} +.paginate_enabled_last { + background-image: url("../../img/last.png"); + cursor: pointer; +} + + +/* table.display { width: 100%; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js index 9ae078d..62bf24b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js @@ -278,3 +278,104 @@ function replace_html_date( original_node, id, format ) { script.text = script_content; $(original_node).append( script ); } +$.fn.dataTableExt.oPagination.four_button = { + /* + * Function: oPagination.four_button.fnInit + * Purpose: Initalise dom elements required for pagination with a list of the pages + * Returns: - + * Inputs: object:oSettings - dataTables settings object + * node:nPaging - the DIV which contains this pagination control + * function:fnCallbackDraw - draw function which must be called on update + */ + "fnInit": function ( oSettings, nPaging, fnCallbackDraw ) + { + nFirst = document.createElement( 'span' ); + nPrevious = document.createElement( 'span' ); + nNext = document.createElement( 'span' ); + nLast = document.createElement( 'span' ); + +/* nFirst.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sFirst ) ); + nPrevious.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sPrevious ) ); + nNext.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sNext ) ); + nLast.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sLast ) );*/ + + nFirst.className = "paginate_button first"; + nPrevious.className = "paginate_button previous"; + nNext.className="paginate_button next"; + nLast.className = "paginate_button last"; + + nPaging.appendChild( nFirst ); + nPaging.appendChild( nPrevious ); + nPaging.appendChild( nNext ); + nPaging.appendChild( nLast ); + + $(nFirst).click( function () { + oSettings.oApi._fnPageChange( oSettings, "first" ); + fnCallbackDraw( oSettings ); + } ); + + $(nPrevious).click( function() { + oSettings.oApi._fnPageChange( oSettings, "previous" ); + fnCallbackDraw( oSettings ); + } ); + + $(nNext).click( function() { + oSettings.oApi._fnPageChange( oSettings, "next" ); + fnCallbackDraw( oSettings ); + } ); + + $(nLast).click( function() { + oSettings.oApi._fnPageChange( oSettings, "last" ); + fnCallbackDraw( oSettings ); + } ); + + /* Disallow text selection */ + $(nFirst).bind( 'selectstart', function () { return false; } ); + $(nPrevious).bind( 'selectstart', function () { return false; } ); + $(nNext).bind( 'selectstart', function () { return false; } ); + $(nLast).bind( 'selectstart', function () { return false; } ); + }, + + /* + * Function: oPagination.four_button.fnUpdate + * Purpose: Update the list of page buttons shows + * Returns: - + * Inputs: object:oSettings - dataTables settings object + * function:fnCallbackDraw - draw function which must be called on update + */ + "fnUpdate": function ( oSettings, fnCallbackDraw ) + { + if ( !oSettings.aanFeatures.p ) + { + return; + } + + /* Loop over each instance of the pager */ + var an = oSettings.aanFeatures.p; + for ( var i=0, iLen=an.length ; iCirculation History for [% firstname %] [% surname %] [% INCLUDE 'doc-head-close.inc' %] - - + + + @@ -34,9 +29,6 @@ [% IF ( loop_reading ) %]
    -
    -[% INCLUDE 'table-pager.inc' perpage='20' %] -
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt index 6fbf31f..100a0c7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt @@ -11,7 +11,8 @@ "aoColumnDefs": [ { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false }, ], - "sPaginationType": "full_numbers" + "sPaginationType": "full_numbers", + "sDom": '<"top pager"ilpf>t<"bottom pager"ip>' } ) ); srlt.fnAddFilters("filter", 750); -- 1.7.3 From oleonard at myacpl.org Fri Nov 18 20:09:09 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Fri, 18 Nov 2011 14:09:09 -0500 Subject: [Koha-patches] [PATCH] Bug 7127 - Templates must be valid XHTML Message-ID: <1321643350-17885-1-git-send-email-oleonard@myacpl.org> --- .../prog/en/includes/biblio-view-menu.inc | 2 +- .../prog/en/modules/admin/systempreferences.tt | 2 +- .../modules/authorities/searchresultlist-auth.tt | 2 +- .../prog/en/modules/catalogue/detail.tt | 6 +- .../prog/en/modules/catalogue/moredetail.tt | 2 +- .../prog/en/modules/cataloguing/additem.tt | 4 +- .../prog/en/modules/help/acqui/lateorders.tt | 2 +- .../prog/en/modules/help/acqui/supplier.tt | 2 +- .../prog/en/modules/help/admin/branches.tt | 4 +- .../prog/en/modules/help/members/boraccount.tt | 4 +- .../rotating_collections/editCollections.tt | 4 +- koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt | 72 ++++++++++---------- 12 files changed, 53 insertions(+), 53 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc index a944dc5..903cf3a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc @@ -23,7 +23,7 @@ [% IF ( CAN_user_reserveforothers ) %] [% IF ( holdsview ) %]
  • [% ELSE %]
  • [% END %]Holds
  • [% END %] - [% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]
  • [% ELSE %]
  • [% END %]Analytics
  • [% END %] + [% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]
  • [% ELSE %]
  • [% END %]Analytics
  • [% END %] [% IF ( subscriptionsnumber ) %]
  • Subscription(s)
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt index 18c0552..d4a7bf3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt @@ -78,7 +78,7 @@ [% INCLUDE 'sysprefs-admin-search.inc' %] +[% IF ( delete_confirm ) %] System Preferences[% searchfield %] › Confirm Deletion of Parameter '[% searchfield %]'[% END %][% IF ( delete_confirmed ) %] System Preferences › Parameter Deleted[% END %][% IF ( else ) %]System Preferences[% END %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt index ba22e9c..7a118c9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt @@ -99,7 +99,7 @@ function jumpfull(page) [% END %] [% END %] [% IF ( displaynext ) %] - + >> [% END %]
    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index b1e225f..44a941a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -381,11 +381,11 @@ function verify_images() { [% END %] [% IF ( analyze ) %] [% END %] [% IF ( analyze ) %] - + [% END %] @@ -393,7 +393,7 @@ function verify_images() {
    Date [% IF ( itemloo.countanalytics ) %] - [% itemloo.countanalytics %] analytics + [% itemloo.countanalytics %] analytics [% END %]Create AnalyticsCreate Analytics
    [% END %] [% IF ( hiddencount ) %] -

    Show all items ([% hiddencount %] hidden) +

    Show all items ([% hiddencount %] hidden) [% END %] [% IF ( debug_display ) %]

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 36e7149..42506f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -33,7 +33,7 @@

  • Physical Details: [% BIBITEM_DAT.pages %] [% BIBITEM_DAT.illus %] [% BIBITEM_DAT.size %] 
  • [% IF ( BIBITEM_DAT.bnotes ) %]
  • Notes: [% BIBITEM_DAT.bnotes %]
  • [% END %]
  • No. of Items: [% BIBITEM_DAT.count %] [% IF ( BIBITEM_DAT.hiddencount ) %]total ([% BIBITEM_DAT.showncount %] shown / [% BIBITEM_DAT.hiddencount %] hidden) -Show all items[% END %]
  • +Show all items[% END %] [% END %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 673b08b..91c2d48 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -190,7 +190,7 @@ function set_to_today(id, force) { [% IF ( book_on_loan ) %]
    Cannot Delete: item is checked out.
    [% END %] [% IF ( book_reserved ) %]
    Cannot Delete: item has a waiting hold.
    [% END %] [% IF ( not_same_branch ) %]
    Cannot Delete: The items do not belong to your branch.
    [% END %] -[% IF ( linked_analytics ) %]
    Cannot Delete: item has linked analytics..
    [% END %] +[% IF ( linked_analytics ) %]
    Cannot Delete: item has linked analytics..
    [% END %]
    [% IF ( item_loop ) %] @@ -209,7 +209,7 @@ function set_to_today(id, force) { [% IF ( item_loo.nomod ) %]  [% ELSE %][% IF ( item_loo.hostitemflag ) %]Edit in Host Delink [% ELSE %]Edit - [% IF ( item_loo.countanalytics ) %]view analytics[% ELSE %]Delete[% END %][% END %][% END %] + [% IF ( item_loo.countanalytics ) %]view analytics[% ELSE %]Delete[% END %][% END %][% END %] [% FOREACH item_valu IN item_loo.item_value %] [% item_valu.field |html %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/lateorders.tt index fa94187..35fbfec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/lateorders.tt @@ -1,6 +1,6 @@ [% INCLUDE 'help-top.inc' %] -

    Claims & Late Orders

    +

    Claims & Late Orders

    If you have entered in an email address for the vendors in your system you can send them claim emails when an order is late. Before you can send claims you will need to set up an acquisitions claim notice.

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/supplier.tt index 550d783..ef3eb1c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/supplier.tt @@ -26,7 +26,7 @@
  • To be able to order from a vendor you must make them 'Active'
  • For List Prices and Invoice Prices choose the currency
      -
    • Currencies are assigned in the Currencies & Exchange Rates admin area
    • +
    • Currencies are assigned in the Currencies & Exchange Rates admin area
  • If the vendor offers a consistent blank discount, enter that in the 'Discount' field diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/branches.tt index 973e2af..69e1dd4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/branches.tt @@ -1,6 +1,6 @@ [% INCLUDE 'help-top.inc' %] -

    Libraries & Groups

    +

    Libraries & Groups

    When setting up your Koha system you will want to add information for every library that will be sharing your system. This data is used in several areas of Koha.

    @@ -47,6 +47,6 @@

    Properties are then applied to libraries via the add or edit library form.

    -

    See the full documentation for Libraries & Groups in the manual (online).

    +

    See the full documentation for Libraries & Groups in the manual (online).

    [% INCLUDE 'help-bottom.inc' %] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/boraccount.tt index fd8cc7f..8d26aea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/boraccount.tt @@ -9,8 +9,8 @@

    Most fees and fines will be charged automatically if the fines cron job is running:

      -
    • Fines will be charged based on your Circulation & Fines Rules
    • -
    • Hold fees will be charged based on the rules you set in the Patron Types & Categories administration area
    • +
    • Fines will be charged based on your Circulation & Fines Rules
    • +
    • Hold fees will be charged based on the rules you set in the Patron Types & Categories administration area
    • Rental fees will be charged based on the settings in your Item Types administration area
    • Marking an item 'Lost' via the cataloging module will automatically charge the patron the replacement cost for that item
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt index 7a50b4f..6c63cfb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt @@ -56,8 +56,8 @@ [% collectionsLoo.colTitle %] [% collectionsLoo.colDesc %] [% collectionsLoo.colBranchcode %] - Edit - Delete + Edit + Delete [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt index 8ee8b7b..219dc41 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt @@ -37,8 +37,8 @@
    requests a particular format or set of formats in reporting availability

    Example Call

    - - ilsdi.pl?service=GetAvailability&id=1+2+99999&id_type=item + + ilsdi.pl?service=GetAvailability&id=1+2+99999&id_type=item

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -110,8 +110,8 @@
                         
                     
                     

    Example Call

    - - ilsdi.pl?service=GetRecords&id=1+2+99999 + + ilsdi.pl?service=GetRecords&id=1+2+99999

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -314,8 +314,8 @@
                         
                     
                     

    Example Call

    - - ilsdi.pl?service=GetAuthorityRecords&id=1+2+99999 + + ilsdi.pl?service=GetAuthorityRecords&id=1+2+99999

    Example Response

    <xml version="1.0" encoding="UTF-8">;
    @@ -372,8 +372,8 @@
                         
                     
                     

    Example Call

    - - ilsdi.pl?service=LookupPatron&id=815&id_type=cardnumber + + ilsdi.pl?service=LookupPatron&id=815&id_type=cardnumber

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -393,8 +393,8 @@
                         
    user's password

    Example Call

    - - ilsdi.pl?service=AuthenticatePatron&username=john9&password=soul + + ilsdi.pl?service=AuthenticatePatron&username=john9&password=soul

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -423,8 +423,8 @@
                         
    whether or not to return loan information in the response

    Example Call

    - - ilsdi.pl?service=GetPatronInfo&patron_id=1&show_contact=0&show_loans=1 + + ilsdi.pl?service=GetPatronInfo&patron_id=1&show_contact=0&show_loans=1

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -542,8 +542,8 @@
                         
    the unique patron identifier in the ILS; the same identifier returned by LookupPatron or AuthenticatePatron

    Example Call

    - - ilsdi.pl?service=GetPatronStatus&patron_id=1 + + ilsdi.pl?service=GetPatronStatus&patron_id=1

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -565,8 +565,8 @@
                         
    system item identifier

    Example Call

    - - ilsdi.pl?service=GetServices&patron_id=1&item_id=1 + + ilsdi.pl?service=GetServices&patron_id=1&item_id=1

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -589,8 +589,8 @@
                         
    the date the patron would like the item returned by

    Example Call

    - - ilsdi.pl?service=RenewLoan&patron_id=1&item_id=1 + + ilsdi.pl?service=RenewLoan&patron_id=1&item_id=1

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -620,8 +620,8 @@
                         
    date after which item returned to shelf if item is not picked up

    Example Call

    - - ilsdi.pl?service=HoldTitle&patron_id=1&bib_id=1&request_location=127.0.0.1 + + ilsdi.pl?service=HoldTitle&patron_id=1&bib_id=1&request_location=127.0.0.1

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -651,8 +651,8 @@
                         
    date after which item returned to shelf if item is not picked up

    Example Call

    - - ilsdi.pl?service=HoldItem&patron_id=1&bib_id=1&item_id=1 + + ilsdi.pl?service=HoldItem&patron_id=1&bib_id=1&item_id=1

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -674,8 +674,8 @@
                         
    system item identifier

    Example Call

    - - ilsdi.pl?service=CancelHold&patron_id=1&item_id=1 + + ilsdi.pl?service=CancelHold&patron_id=1&item_id=1

    Example Response

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    @@ -689,31 +689,31 @@
                     
    • HarvestBibliographicRecords (Use OAI-PMH instead)
    • HarvestExpandedRecords (Use OAI-PMH instead)
    • -
    • GetAvailability
    • +
    • GetAvailability
    • GoToBibliographicRequestPage (Use OPAC instead)

    Level 2: Elementary OPAC supplement

    • HarvestAuthorityRecords (Use OAI-PMH instead)
    • HarvestHoldingsRecords (Use OAI-PMH instead)
    • -
    • GetRecords
    • +
    • GetRecords
    • Search (Use SRU instead)
    • Scan (Use SRU instead)
    • -
    • GetAuthorityRecords
    • +
    • GetAuthorityRecords
    • OutputRewritablePage (Not supported yet)
    • OutputIntermediateFormat (Not supported yet)

    Level 3: Elementary OPAC alternative

    -- 1.7.3 From oleonard at myacpl.org Fri Nov 18 20:54:24 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Fri, 18 Nov 2011 14:54:24 -0500 Subject: [Koha-patches] [PATCH] Bug 3385 - Add checkout date and renewal date to display list of checked out items Message-ID: <1321646064-18877-1-git-send-email-oleonard@myacpl.org> This patch doesn't fix the origial request to add the renewal date to the list of checked out items, but follows the other bug commenter's suggestion that the information be added to the item details page (moredetail.pl). The other part of this request, to add the checkout date, has already been fixed by another patch. --- C4/Items.pm | 1 + catalogue/moredetail.pl | 4 +--- .../prog/en/modules/catalogue/moredetail.tt | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 0b91b65..0756832 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1214,6 +1214,7 @@ sub GetItemsInfo { $data->{cardnumber} = $idata->{cardnumber}; $data->{surname} = $idata->{surname}; $data->{firstname} = $idata->{firstname}; + $data->{lastreneweddate} = $idata->{lastreneweddate}; $datedue = $idata->{'date_due'}; if (C4::Context->preference("IndependantBranches")){ my $userenv = C4::Context->userenv; diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 47e1adf..68af91c 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -128,9 +128,7 @@ foreach my $item (@items){ $item->{'collection'} = $ccodes->{ $item->{ccode} } if ($ccodes); $item->{'itype'} = $itemtypes->{ $item->{'itype'} }->{'description'}; $item->{'replacementprice'} = sprintf( "%.2f", $item->{'replacementprice'} ); - $item->{'datelastborrowed'} = format_date( $item->{'datelastborrowed'} ); - $item->{'dateaccessioned'} = format_date( $item->{'dateaccessioned'} ); - $item->{'datelastseen'} = format_date( $item->{'datelastseen'} ); + $item->{$_} = format_date( $item->{$_} ) foreach qw/datelastborrowed dateaccessioned datelastseen lastreneweddate/; $item->{'copyvol'} = $item->{'copynumber'}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 36e7149..a79fde6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -67,7 +67,7 @@
    1. Current Location: [% ITEM_DAT.holdingbranchname %] 
    2. -
    3. Checkout Status: [% IF ( ITEM_DAT.issue ) %]Checked out to [% ITEM_DAT.cardnumber %], Due back on [% ITEM_DAT.datedue %][% ELSE %]Not Checked out [% END %]
    4. +
    5. Checkout Status: [% IF ( ITEM_DAT.issue ) %]Checked out to [% ITEM_DAT.cardnumber %][% IF ( ITEM_DAT.lastreneweddate ) %], Last renewed [% ITEM_DAT.lastreneweddate %][% END %], Due back on [% ITEM_DAT.datedue %][% ELSE %]Not Checked out [% END %]
    6. Current Renewals: [% ITEM_DAT.renewals %] 
    7. [% IF ( ITEM_DAT.itemlostloop ) %]
    8. Lost Status: -- 1.7.3 From chrisc at catalyst.net.nz Fri Nov 18 00:13:36 2011 From: chrisc at catalyst.net.nz (Chris Cormack) Date: Fri, 18 Nov 2011 12:13:36 +1300 Subject: [Koha-patches] [PATCH] Bug 7242 : Fixing typo in a div Message-ID: <1321571616-8297-1-git-send-email-chrisc@catalyst.net.nz> --- .../opac-tmpl/prog/en/modules/opac-shelves.tt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt index aa10dae..528b8a7 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt @@ -600,7 +600,7 @@ $(function() {
  • [% IF ( OpacNav||loggedinusername ) %]
    -
    +
    [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
    -- 1.7.5.4 From dpavlin at rot13.org Sat Nov 19 12:27:32 2011 From: dpavlin at rot13.org (Dobrica Pavlinusic) Date: Sat, 19 Nov 2011 12:27:32 +0100 Subject: [Koha-patches] [PATCH] Bug 7247 - rebuild_zebra.pl -v should show all Zebra log output Message-ID: <1321702052-30199-1-git-send-email-dpavlin@rot13.org> Currently, -v option resets Zebra log output to default system values. This produce amount of log specified in system defaults which is usually too low for debugging. This change explicitly forces all Zebra log output which create much more chatter so it triggers with verbosity level 2 Test scenario: 1. pick koha site to reindex 2. use -v -v options to rebuild_zebra.pl to see additional output --- misc/migration_tools/rebuild_zebra.pl | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 6fa6501..027b648 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -34,7 +34,7 @@ my $want_help; my $as_xml; my $process_zebraqueue; my $do_not_clear_zebraqueue; -my $verbose_logging; +my $verbose_logging = 0; my $zebraidx_log_opt = " -v none,fatal,warn "; my $result = GetOptions( 'd:s' => \$directory, @@ -51,7 +51,7 @@ my $result = GetOptions( 'x' => \$as_xml, 'y' => \$do_not_clear_zebraqueue, 'z' => \$process_zebraqueue, - 'v' => \$verbose_logging, + 'v+' => \$verbose_logging, ); @@ -96,8 +96,8 @@ if ($noshadow) { # -v is for verbose, which seems backwards here because of how logging is set # on the CLI of zebraidx. It works this way. The default is to not log much -if ($verbose_logging) { - $zebraidx_log_opt = ''; +if ($verbose_logging >= 2) { + $zebraidx_log_opt = '-v none,fatal,warn,all'; } my $use_tempdir = 0; -- 1.7.2.5 From dpavlin at rot13.org Sat Nov 19 12:30:00 2011 From: dpavlin at rot13.org (Dobrica Pavlinusic) Date: Sat, 19 Nov 2011 12:30:00 +0100 Subject: [Koha-patches] [PATCH] Bug 7246 - rebuild_zebra.pl --limit number for partial reindexing Message-ID: <1321702200-30260-1-git-send-email-dpavlin@rot13.org> Partial re-indexing is mostly useful when experimenting with Zebra configuration and your test database is too large to be re-indexed for each trial. I'm submitting it after I added this twice to source code of rebuild_zebra.pl and I hope it might prove useful to others also. Test scenario: 1. pick koha instance for which you don't mind truncating results in search 2. re-run rebuild_zebra.pl and add --limit 1000 http://bugs.koha-community.org/show_bug.cgi?id=7246 --- misc/migration_tools/rebuild_zebra.pl | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 6fa6501..be0ceb7 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -35,6 +35,7 @@ my $as_xml; my $process_zebraqueue; my $do_not_clear_zebraqueue; my $verbose_logging; +my $limit; my $zebraidx_log_opt = " -v none,fatal,warn "; my $result = GetOptions( 'd:s' => \$directory, @@ -52,6 +53,7 @@ my $result = GetOptions( 'y' => \$do_not_clear_zebraqueue, 'z' => \$process_zebraqueue, 'v' => \$verbose_logging, + 'l|limit:i' => \$limit, ); @@ -313,6 +315,7 @@ sub export_marc_records_from_sth { my $i = 0; my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",''); while (my ($record_number) = $sth->fetchrow_array) { + last if defined $limit && $i >= $limit; print "." if ( $verbose_logging ); print "\r$i" unless ($i++ %100 or !$verbose_logging); if ( $nosanitize ) { -- 1.7.2.5 From Katrin.Fischer.83 at web.de Sun Nov 20 22:35:07 2011 From: Katrin.Fischer.83 at web.de (Katrin Fischer) Date: Sun, 20 Nov 2011 22:35:07 +0100 Subject: [Koha-patches] [PATCH] Bug 6530: Item Due notice label displaying as 'unknown' Message-ID: <1321824907-14928-1-git-send-email-Katrin.Fischer.83@web.de> Some of the translated sql files still had 'Item_DUE' instead of 'Item_Due' causing the staff interface to display 'unknown' instead of the correct description. To test: - Do a new installation, using German, French, Polish, Russian or Ukrainian sample files. - Actived EnhancedMessagingPreferences - Create a new patron category and check message descriptions display correctly --- .../sample_notices_message_attributes.sql | 2 +- .../sample_notices_message_attributes.sql | 2 +- .../sample_notices_message_attributes.sql | 2 +- .../sample_notices_message_attributes.sql | 2 +- .../sample_notices_message_attributes.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/installer/data/mysql/de-DE/mandatory/sample_notices_message_attributes.sql b/installer/data/mysql/de-DE/mandatory/sample_notices_message_attributes.sql index b505486..b078106 100644 --- a/installer/data/mysql/de-DE/mandatory/sample_notices_message_attributes.sql +++ b/installer/data/mysql/de-DE/mandatory/sample_notices_message_attributes.sql @@ -1,7 +1,7 @@ insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item_DUE', 0), +(1, 'Item_Due', 0), (2, 'Advance_Notice', 1), (4, 'Hold_Filled', 0), (5, 'Item_Check_in', 0), diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices_message_attributes.sql b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices_message_attributes.sql index 8e919e9..a7a6032 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices_message_attributes.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices_message_attributes.sql @@ -1,7 +1,7 @@ insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item_DUE', 0), +(1, 'Item_Due', 0), (2, 'Advance_Notice', 1), (4, 'Hold_Filled', 0), (5, 'Item_Check_in', 0), diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices_message_attributes.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices_message_attributes.sql index 8e919e9..a7a6032 100644 --- a/installer/data/mysql/pl-PL/mandatory/sample_notices_message_attributes.sql +++ b/installer/data/mysql/pl-PL/mandatory/sample_notices_message_attributes.sql @@ -1,7 +1,7 @@ insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item_DUE', 0), +(1, 'Item_Due', 0), (2, 'Advance_Notice', 1), (4, 'Hold_Filled', 0), (5, 'Item_Check_in', 0), diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices_message_attributes.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices_message_attributes.sql index c9d9bd1..94c7897 100644 --- a/installer/data/mysql/ru-RU/mandatory/sample_notices_message_attributes.sql +++ b/installer/data/mysql/ru-RU/mandatory/sample_notices_message_attributes.sql @@ -3,7 +3,7 @@ truncate message_attributes; insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item_DUE', 0), +(1, 'Item_Due', 0), (2, 'Advance_Notice', 1), (4, 'Hold_Filled', 0), (5, 'Item_Check_in', 0), diff --git a/installer/data/mysql/uk-UA/mandatory/sample_notices_message_attributes.sql b/installer/data/mysql/uk-UA/mandatory/sample_notices_message_attributes.sql index 75e2793..53eeeac 100644 --- a/installer/data/mysql/uk-UA/mandatory/sample_notices_message_attributes.sql +++ b/installer/data/mysql/uk-UA/mandatory/sample_notices_message_attributes.sql @@ -3,7 +3,7 @@ truncate message_attributes; insert into `message_attributes` (`message_attribute_id`, `message_name`, `takes_days`) values -(1, 'Item_DUE' , 0), +(1, 'Item_Due' , 0), (2, 'Advance_Notice' , 1), (4, 'Hold_Filled' , 0), (5, 'Item_Check_in' , 0), -- 1.7.5.4 From srdjan at catalyst.net.nz Mon Nov 21 01:46:23 2011 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Mon, 21 Nov 2011 13:46:23 +1300 Subject: [Koha-patches] [PATCH] bug_7001: Issue and Reserve slips are notices. In-Reply-To: References: Message-ID: <1321836383-24058-1-git-send-email-srdjan@catalyst.net.nz> Branches can have their own version of notices - added branchcode to letter table. Support html notices - added is_html to letter table. GetPreparedletter() is the interface for compiling letters (notices). Sysprefs for notice and slips stylesheets. --- C4/Circulation.pm | 20 +- C4/Letters.pm | 580 +++++++++++++------- C4/Members.pm | 81 +++- C4/Message.pm | 12 +- C4/Print.pm | 139 ++---- C4/Reserves.pm | 103 +++-- C4/Suggestions.pm | 22 +- acqui/booksellers.pl | 7 +- circ/circulation.pl | 3 +- circ/hold-transfer-slip.pl | 27 +- .../data/mysql/de-DE/mandatory/sample_notices.sql | 2 +- .../data/mysql/en/mandatory/sample_notices.sql | 84 +++- .../data/mysql/es-ES/mandatory/sample_notices.sql | 2 +- .../mysql/fr-FR/1-Obligatoire/sample_notices.sql | 2 +- installer/data/mysql/it-IT/necessari/notices.sql | 2 +- installer/data/mysql/kohastructure.sql | 4 +- .../mysql/nb-NO/1-Obligatorisk/sample_notices.sql | 2 +- .../data/mysql/pl-PL/mandatory/sample_notices.sql | 2 +- .../data/mysql/ru-RU/mandatory/sample_notices.sql | 2 +- installer/data/mysql/sysprefs.sql | 3 + .../data/mysql/uk-UA/mandatory/sample_notices.sql | 2 +- installer/data/mysql/updatedatabase.pl | 98 ++++- .../prog/en/includes/circ-toolbar.inc | 4 +- .../en/modules/admin/preferences/circulation.pref | 5 + .../en/modules/admin/preferences/staff_client.pref | 5 + .../prog/en/modules/batch/print-notices.tt | 6 +- .../prog/en/modules/circ/hold-transfer-slip.tt | 54 -- .../prog/en/modules/circ/printslip.tt | 28 + .../prog/en/modules/members/moremember-receipt.tt | 76 --- .../intranet-tmpl/prog/en/modules/tools/letter.tt | 113 +++- members/memberentry.pl | 5 +- members/moremember.pl | 10 - members/printslip.pl | 89 +++ misc/cronjobs/advance_notices.pl | 78 ++-- misc/cronjobs/gather_print_notices.pl | 14 +- misc/cronjobs/overdue_notices.pl | 86 ++-- t/db_dependent/lib/KohaTest/Letters.pm | 5 +- t/db_dependent/lib/KohaTest/Letters/GetLetter.pm | 3 +- t/db_dependent/lib/KohaTest/Members.pm | 1 + t/db_dependent/lib/KohaTest/Print.pm | 5 +- t/db_dependent/lib/KohaTest/Reserves.pm | 1 + tools/letter.pl | 214 +++++--- 42 files changed, 1259 insertions(+), 742 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt create mode 100755 members/printslip.pl diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9f81773..33e5430 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2628,11 +2628,18 @@ sub SendCirculationAlert { borrowernumber => $borrower->{borrowernumber}, message_name => $message_name{$type}, }); - my $letter = C4::Letters::getletter('circulation', $type); - C4::Letters::parseletter($letter, 'biblio', $item->{biblionumber}); - C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber}); - C4::Letters::parseletter($letter, 'borrowers', $borrower->{borrowernumber}); - C4::Letters::parseletter($letter, 'branches', $branch); + my $letter = C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => $type, + branchcode => $branch, + tables => { + 'biblio' => $item->{biblionumber}, + 'biblioitems' => $item->{biblionumber}, + 'borrowers' => $borrower, + 'branches' => $branch, + } + ) or return; + my @transports = @{ $borrower_preferences->{transports} }; # warn "no transports" unless @transports; for (@transports) { @@ -2647,7 +2654,8 @@ sub SendCirculationAlert { $message->update; } } - $letter; + + return $letter; } =head2 updateWrongTransfer diff --git a/C4/Letters.pm b/C4/Letters.pm index 6846a00..8ca260f 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -26,6 +26,7 @@ use Encode; use Carp; use C4::Members; +use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Branch; use C4::Log; use C4::SMS; @@ -42,7 +43,7 @@ BEGIN { $VERSION = 3.01; @ISA = qw(Exporter); @EXPORT = qw( - &GetLetters &getletter &addalert &getalert &delalert &findrelatedto &SendAlerts GetPrintMessages + &GetLetters &GetPreparedLetter &GetWrappedLetter &addalert &getalert &delalert &findrelatedto &SendAlerts &GetPrintMessages ); } @@ -117,13 +118,26 @@ sub GetLetters (;$) { return \%letters; } -sub getletter ($$) { - my ( $module, $code ) = @_; +my %letter; +sub getletter ($$$) { + my ( $module, $code, $branchcode ) = @_; + + if (C4::Context->preference('IndependantBranches') && $branchcode){ + $$branchcode = C4::Context->userenv->{'branch'}; + } + + if ( my $l = $letter{$module}{$code}{$branchcode} ) { + return { %$l }; # deep copy + } + my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("select * from letter where module=? and code=?"); - $sth->execute( $module, $code ); - my $line = $sth->fetchrow_hashref; - return $line; + my $sth = $dbh->prepare("select * from letter where module=? and code=? and (branchcode = ? or branchcode = '') order by branchcode desc limit 1"); + $sth->execute( $module, $code, $branchcode ); + my $line = $sth->fetchrow_hashref + or return; + $line->{'content-type'} = 'text/html; charset="UTF-8"' if $line->{is_html}; + $letter{$module}{$code}{$branchcode} = $line; + return { %$line }; } =head2 addalert ($borrowernumber, $type, $externalid) @@ -178,7 +192,7 @@ sub delalert ($) { sub getalert (;$$$) { my ( $borrowernumber, $type, $externalid ) = @_; my $dbh = C4::Context->dbh; - my $query = "SELECT * FROM alert WHERE"; + my $query = "SELECT a.*, b.branchcode FROM alert a JOIN borrowers b USING(borrowernumber) WHERE"; my @bind; if ($borrowernumber and $borrowernumber =~ /^\d+$/) { $query .= " borrowernumber=? AND "; @@ -234,70 +248,65 @@ sub findrelatedto ($$) { parameters : - $type : the type of alert - $externalid : the id of the "object" to query - - $letter : the letter to send. + - $letter_code : the letter to send. send an alert to all borrowers having put an alert on a given subject. =cut sub SendAlerts { - my ( $type, $externalid, $letter ) = @_; + my ( $type, $externalid, $letter_code ) = @_; my $dbh = C4::Context->dbh; if ( $type eq 'issue' ) { - # warn "sending issues..."; - my $letter = getletter( 'serial', $letter ); - # prepare the letter... # search the biblionumber my $sth = $dbh->prepare( "SELECT biblionumber FROM subscription WHERE subscriptionid=?"); $sth->execute($externalid); - my ($biblionumber) = $sth->fetchrow; - - # parsing branch info - my $userenv = C4::Context->userenv; - parseletter( $letter, 'branches', $userenv->{branch} ); - - # parsing librarian name - $letter->{content} =~ s/<>/$userenv->{firstname}/g; - $letter->{content} =~ s/<>/$userenv->{surname}/g; - $letter->{content} =~ - s/<>/$userenv->{emailaddress}/g; - - # parsing biblio information - parseletter( $letter, 'biblio', $biblionumber ); - parseletter( $letter, 'biblioitems', $biblionumber ); + my ($biblionumber) = $sth->fetchrow + or warn( "No subscription for '$externalid'" ), + return; + my %letter; # find the list of borrowers to alert my $alerts = getalert( '', 'issue', $externalid ); foreach (@$alerts) { - # and parse borrower ... - my $innerletter = $letter; my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); - parseletter( $innerletter, 'borrowers', $_->{'borrowernumber'} ); + my $email = $borinfo->{email} or next; + + # warn "sending issues..."; + my $userenv = C4::Context->userenv; + my $letter = GetPreparedLetter ( + module => 'serial', + letter_code => $letter_code, + branchcode => $userenv->{branch}, + tables => { + 'branches' => $_->{branchcode}, + 'biblio' => $biblionumber, + 'biblioitems' => $biblionumber, + 'borrowers' => $borinfo, + }, + want_librarian => 1, + ) or return; # ... then send mail - if ( $borinfo->{email} ) { - my %mail = ( - To => $borinfo->{email}, - From => $borinfo->{email}, - Subject => "" . $innerletter->{title}, - Message => "" . $innerletter->{content}, - 'Content-Type' => 'text/plain; charset="utf8"', - ); - sendmail(%mail) or carp $Mail::Sendmail::error; - + my %mail = ( + To => $email, + From => $email, + Subject => "" . $letter->{title}, + Message => "" . $letter->{content}, + 'Content-Type' => 'text/plain; charset="utf8"', + ); + sendmail(%mail) or carp $Mail::Sendmail::error; # warn "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}"; - } } } elsif ( $type eq 'claimacquisition' ) { # warn "sending issues..."; - my $letter = getletter( 'claimacquisition', $letter ); # prepare the letter... # search the biblionumber @@ -307,52 +316,43 @@ sub SendAlerts { my $sthorders = $dbh->prepare($strsth); $sthorders->execute; my $dataorders = $sthorders->fetchall_arrayref( {} ); - parseletter( $letter, 'aqbooksellers', - $dataorders->[0]->{booksellerid} ); + my $sthbookseller = $dbh->prepare("select * from aqbooksellers where id=?"); $sthbookseller->execute( $dataorders->[0]->{booksellerid} ); my $databookseller = $sthbookseller->fetchrow_hashref; - # parsing branch info - my $userenv = C4::Context->userenv; - parseletter( $letter, 'branches', $userenv->{branch} ); - - # parsing librarian name - $letter->{content} =~ s/<>/$userenv->{firstname}/g; - $letter->{content} =~ s/<>/$userenv->{surname}/g; - $letter->{content} =~ - s/<>/$userenv->{emailaddress}/g; - foreach my $data ( @{$dataorders} ) { - if ( $letter->{content} =~ m/(<<.*>>)/ ) { - my $line = $1; - foreach my $field ( keys %{$data} ) { - $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/; - } - $letter->{content} =~ s/(<<.*>>)/$line\n$1/; - } + my @email; + push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail}; + push @email, $databookseller->{contemail} if $databookseller->{contemail}; + unless (@email) { + warn "Bookseller $dataorders->[0]->{booksellerid} without emails"; + return; } - $letter->{content} =~ s/<<[^>]*>>//g; - my $innerletter = $letter; + + my $userenv = C4::Context->userenv; + my $letter = GetPreparedLetter ( + module => 'claimacquisition', + letter_code => $letter_code, + branchcode => $userenv->{branch}, + tables => { + 'branches' => $userenv->{branch}, + 'aqbooksellers' => $databookseller, + }, + repeat => $dataorders, + want_librarian => 1, + ) or return; # ... then send mail - if ( $databookseller->{bookselleremail} - || $databookseller->{contemail} ) - { - my %mail = ( - To => $databookseller->{bookselleremail} - . ( - $databookseller->{contemail} - ? "," . $databookseller->{contemail} - : "" - ), - From => $userenv->{emailaddress}, - Subject => "" . $innerletter->{title}, - Message => "" . $innerletter->{content}, - 'Content-Type' => 'text/plain; charset="utf8"', - ); - sendmail(%mail) or carp $Mail::Sendmail::error; - } + my %mail = ( + To => join( ','. @email), + From => $userenv->{emailaddress}, + Subject => "" . $letter->{title}, + Message => "" . $letter->{content}, + 'Content-Type' => 'text/plain; charset="utf8"', + ); + sendmail(%mail) or carp $Mail::Sendmail::error; + if ( C4::Context->preference("LetterLog") ) { logaction( "ACQUISITION", @@ -360,16 +360,13 @@ sub SendAlerts { "", "order list : " . join( ",", @$externalid ) - . "\n$innerletter->{title}\n$innerletter->{content}" + . "\n$letter->{title}\n$letter->{content}" ); } } elsif ( $type eq 'claimissues' ) { # warn "sending issues..."; - my $letter = getletter( 'claimissues', $letter ); - - # prepare the letter... # search the biblionumber my $strsth = "select serial.*,subscription.*, biblio.* from serial LEFT JOIN subscription on serial.subscriptionid=subscription.subscriptionid LEFT JOIN biblio on serial.biblionumber=biblio.biblionumber where serial.serialid IN (" @@ -377,81 +374,76 @@ sub SendAlerts { my $sthorders = $dbh->prepare($strsth); $sthorders->execute; my $dataorders = $sthorders->fetchall_arrayref( {} ); - parseletter( $letter, 'aqbooksellers', - $dataorders->[0]->{aqbooksellerid} ); + my $sthbookseller = $dbh->prepare("select * from aqbooksellers where id=?"); $sthbookseller->execute( $dataorders->[0]->{aqbooksellerid} ); my $databookseller = $sthbookseller->fetchrow_hashref; - # parsing branch info - my $userenv = C4::Context->userenv; - parseletter( $letter, 'branches', $userenv->{branch} ); - - # parsing librarian name - $letter->{content} =~ s/<>/$userenv->{firstname}/g; - $letter->{content} =~ s/<>/$userenv->{surname}/g; - $letter->{content} =~ - s/<>/$userenv->{emailaddress}/g; - foreach my $data ( @{$dataorders} ) { - if ( $letter->{content} =~ m/(<<.*>>)/ ) { - my $line = $1; - foreach my $field ( keys %{$data} ) { - $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/; - } - $letter->{content} =~ s/(<<.*>>)/$line\n$1/; - } + my @email; + push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail}; + push @email, $databookseller->{contemail} if $databookseller->{contemail}; + unless (@email) { + warn "Bookseller $dataorders->[0]->{booksellerid} without emails"; + return; } - $letter->{content} =~ s/<<[^>]*>>//g; - my $innerletter = $letter; + + # prepare the letter... + my $userenv = C4::Context->userenv; + my $letter = GetPreparedLetter ( + module => 'claimissues', + letter_code => $letter_code, + branchcode => $userenv->{branch}, + tables => { + 'branches' => $userenv->{branch}, + 'aqbooksellers' => $databookseller, + }, + repeat => $dataorders, + want_librarian => 1, + ) or return; # ... then send mail - if ( $databookseller->{bookselleremail} - || $databookseller->{contemail} ) { - my $mail_to = $databookseller->{bookselleremail}; - if ($databookseller->{contemail}) { - if (!$mail_to) { - $mail_to = $databookseller->{contemail}; - } else { - $mail_to .= q|,|; - $mail_to .= $databookseller->{contemail}; - } - } - my $mail_subj = $innerletter->{title}; - my $mail_msg = $innerletter->{content}; - $mail_msg ||= q{}; - $mail_subj ||= q{}; + my $mail_subj = $letter->{title}; + my $mail_msg = $letter->{content}; + $mail_msg ||= q{}; + $mail_subj ||= q{}; - my %mail = ( - To => $mail_to, - From => $userenv->{emailaddress}, - Subject => $mail_subj, - Message => $mail_msg, - 'Content-Type' => 'text/plain; charset="utf8"', - ); - sendmail(%mail) or carp $Mail::Sendmail::error; - logaction( - "ACQUISITION", - "CLAIM ISSUE", - undef, - "To=" - . $databookseller->{contemail} - . " Title=" - . $innerletter->{title} - . " Content=" - . $innerletter->{content} - ) if C4::Context->preference("LetterLog"); - } + my %mail = ( + To => join( ','. @email), + From => $userenv->{emailaddress}, + Subject => $mail_subj, + Message => $mail_msg, + 'Content-Type' => 'text/plain; charset="utf8"', + ); + sendmail(%mail) or carp $Mail::Sendmail::error; + + logaction( + "ACQUISITION", + "CLAIM ISSUE", + undef, + "To=" + . $databookseller->{contemail} + . " Title=" + . $letter->{title} + . " Content=" + . $letter->{content} + ) if C4::Context->preference("LetterLog"); } # send an "account details" notice to a newly created user elsif ( $type eq 'members' ) { - # must parse the password special, before it's hashed. - $letter->{content} =~ s/<>/$externalid->{'password'}/g; - - parseletter( $letter, 'borrowers', $externalid->{'borrowernumber'}); - parseletter( $letter, 'branches', $externalid->{'branchcode'} ); - my $branchdetails = GetBranchDetail($externalid->{'branchcode'}); + my $letter = GetPreparedLetter ( + module => 'members', + letter_code => $letter_code, + branchcode => $externalid->{'branchcode'}, + tables => { + 'branches' => $branchdetails, + 'borrowers' => $externalid->{'borrowernumber'}, + }, + substitute => { 'borrowers.password' => $externalid->{'password'} }, + want_librarian => 1, + ) or return; + my %mail = ( To => $externalid->{'emailaddr'}, From => $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"), @@ -463,24 +455,148 @@ sub SendAlerts { } } -=head2 parseletter($letter, $table, $pk) - - parameters : - - $letter : a hash to letter fields (title & content useful) - - $table : the Koha table to parse. - - $pk : the primary key to query on the $table table - parse all fields from a table, and replace values in title & content with the appropriate value - (not exported sub, used only internally) +=head2 GetPreparedLetter( %params ) + + %params hash: + module => letter module, mandatory + letter_code => letter code, mandatory + branchcode => for letter selection, if missing default system letter taken + tables => a hashref with table names as keys. Values are either: + - a scalar - primary key value + - an arrayref - primary key values + - a hashref - full record + substitute => custom substitution key/value pairs + repeat => records to be substituted on consecutive lines: + - an arrayref - tries to guess what needs substituting by + taking remaining << >> tokensr; not recommended + - a hashref token => @tables - replaces << >> << >> + subtemplate for each @tables row; table is a hashref as above + want_librarian => boolean, if set to true triggers librarian details + substitution from the userenv + Return value: + letter fields hashref (title & content useful) =cut -our %handles = (); -our %columns = (); +sub GetPreparedLetter { + my %params = @_; + + my $module = $params{module} or croak "No module"; + my $letter_code = $params{letter_code} or croak "No letter_code"; + my $branchcode = $params{branchcode} || ''; + + my $letter = getletter( $module, $letter_code, $branchcode ) + or warn( "No $module $letter_code letter"), + return; + + my $tables = $params{tables}; + my $substitute = $params{substitute}; + my $repeat = $params{repeat}; + $tables || $substitute || $repeat + or carp( "ERROR: nothing to substitute - both 'tables' and 'substitute' are empty" ), + return; + my $want_librarian = $params{want_librarian}; + + if ($substitute) { + while ( my ($token, $val) = each %$substitute ) { + $letter->{title} =~ s/<<$token>>/$val/g; + $letter->{content} =~ s/<<$token>>/$val/g; + } + } + + if ($want_librarian) { + # parsing librarian name + my $userenv = C4::Context->userenv; + $letter->{content} =~ s/<>/$userenv->{firstname}/go; + $letter->{content} =~ s/<>/$userenv->{surname}/go; + $letter->{content} =~ s/<>/$userenv->{emailaddress}/go; + } + + my ($repeat_no_enclosing_tags, $repeat_enclosing_tags); + + if ($repeat) { + if (ref ($repeat) eq 'ARRAY' ) { + $repeat_no_enclosing_tags = $repeat; + } else { + $repeat_enclosing_tags = $repeat; + } + } + + if ($repeat_enclosing_tags) { + while ( my ($tag, $tag_tables) = each %$repeat_enclosing_tags ) { + if ( $letter->{content} =~ m!<$tag>(.*)!s ) { + my $subcontent = $1; + my @lines = map { + my %subletter = ( title => '', content => $subcontent ); + _substitute_tables( \%subletter, $_ ); + $subletter{content}; + } @$tag_tables; + $letter->{content} =~ s!<$tag>.*!join( "\n", @lines )!se; + } + } + } + + if ($tables) { + _substitute_tables( $letter, $tables ); + } + + if ($repeat_no_enclosing_tags) { + if ( $letter->{content} =~ m/[^\n]*<<.*>>[^\n]*/so ) { + my $line = $&; + my $i = 1; + my @lines = map { + my $c = $line; + $c =~ s/<>/$i/go; + foreach my $field ( keys %{$_} ) { + $c =~ s/(<<[^\.]+.$field>>)/$_->{$field}/; + } + $i++; + $c; + } @$repeat_no_enclosing_tags; + + my $replaceby = join( "\n", @lines ); + $letter->{content} =~ s/\Q$line\E/$replaceby/s; + } + } + + $letter->{content} =~ s/<<\S*>>//go; #remove any stragglers +# $letter->{content} =~ s/<<[^>]*>>//go; + + return $letter; +} + +sub _substitute_tables { + my ( $letter, $tables ) = @_; + while ( my ($table, $param) = each %$tables ) { + next unless $param; + + my $ref = ref $param; -sub parseletter_sth { + my $values; + if ($ref && $ref eq 'HASH') { + $values = $param; + } + else { + my @pk; + my $sth = _parseletter_sth($table); + unless ($sth) { + warn "_parseletter_sth('$table') failed to return a valid sth. No substitution will be done for that table."; + return; + } + $sth->execute( $ref ? @$param : $param ); + + $values = $sth->fetchrow_hashref; + } + + _parseletter ( $letter, $table, $values ); + } +} + +my %handles = (); +sub _parseletter_sth { my $table = shift; unless ($table) { - carp "ERROR: parseletter_sth() called without argument (table)"; + carp "ERROR: _parseletter_sth() called without argument (table)"; return; } # check cache first @@ -496,8 +612,10 @@ sub parseletter_sth { ($table eq 'branches' ) ? "SELECT * FROM $table WHERE branchcode = ?" : ($table eq 'suggestions' ) ? "SELECT * FROM $table WHERE suggestionid = ?" : ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE id = ?" : undef ; + ($table eq 'aqorders' ) ? "SELECT * FROM $table WHERE ordernumber = ?" : undef ; + ($table eq 'opac_news' ) ? "SELECT * FROM $table WHERE idnew = ?" : undef ; unless ($query) { - warn "ERROR: No parseletter_sth query for table '$table'"; + warn "ERROR: No _parseletter_sth query for table '$table'"; return; # nothing to get } unless ($handles{$table} = C4::Context->dbh->prepare($query)) { @@ -507,25 +625,21 @@ sub parseletter_sth { return $handles{$table}; # now cache is populated for that $table } -sub parseletter { - my ( $letter, $table, $pk, $pk2 ) = @_; - unless ($letter) { - carp "ERROR: parseletter() 1st argument 'letter' empty"; - return; - } - my $sth = parseletter_sth($table); - unless ($sth) { - warn "parseletter_sth('$table') failed to return a valid sth. No substitution will be done for that table."; - return; - } - if ( $pk2 ) { - $sth->execute($pk, $pk2); - } else { - $sth->execute($pk); - } +=head2 _parseletter($letter, $table, $values) - my $values = $sth->fetchrow_hashref; - + parameters : + - $letter : a hash to letter fields (title & content useful) + - $table : the Koha table to parse. + - $values : table record hashref + parse all fields from a table, and replace values in title & content with the appropriate value + (not exported sub, used only internally) + +=cut + +my %columns = (); +sub _parseletter { + my ( $letter, $table, $values ) = @_; + # TEMPORARY hack until the expirationdate column is added to reserves if ( $table eq 'reserves' && $values->{'waitingdate'} ) { my @waitingdate = split /-/, $values->{'waitingdate'}; @@ -539,16 +653,51 @@ sub parseletter { )->output(); } + if ($letter->{content} && $letter->{content} =~ /<>/) { + my @da = localtime(); + my $todaysdate = "$da[2]:$da[1] " . C4::Dates->today(); + $letter->{content} =~ s/<>/$todaysdate/go; + } # and get all fields from the table - my $columns = C4::Context->dbh->prepare("SHOW COLUMNS FROM $table"); - $columns->execute; - while ( ( my $field ) = $columns->fetchrow_array ) { - my $replacefield = "<<$table.$field>>"; - $values->{$field} =~ s/\p{P}(?=$)//g if $values->{$field}; - my $replacedby = $values->{$field} || ''; - ($letter->{title} ) and $letter->{title} =~ s/$replacefield/$replacedby/g; - ($letter->{content}) and $letter->{content} =~ s/$replacefield/$replacedby/g; +# my $columns = $columns{$table}; +# unless ($columns) { +# $columns = $columns{$table} = C4::Context->dbh->selectcol_arrayref("SHOW COLUMNS FROM $table"); +# } +# foreach my $field (@$columns) { + + while ( my ($field, $val) = each %$values ) { + my $replacetablefield = "<<$table.$field>>"; + my $replacefield = "<<$field>>"; + $val =~ s/\p{P}(?=$)//g if $val; + my $replacedby = defined ($val) ? $val : ''; + ($letter->{title} ) and do { + $letter->{title} =~ s/$replacetablefield/$replacedby/g; + $letter->{title} =~ s/$replacefield/$replacedby/g; + }; + ($letter->{content}) and do { + $letter->{content} =~ s/$replacetablefield/$replacedby/g; + $letter->{content} =~ s/$replacefield/$replacedby/g; + }; + } + + if ($table eq 'borrowers' && $letter->{content}) { + if ( my $attributes = GetBorrowerAttributes($values->{borrowernumber}) ) { + my %attr; + foreach (@$attributes) { + my $code = $_->{code}; + my $val = $_->{value_description} || $_->{value}; + $val =~ s/\p{P}(?=$)//g if $val; + next unless $val gt ''; + $attr{$code} ||= []; + push @{ $attr{$code} }, $val; + } + while ( my ($code, $val_ar) = each %attr ) { + my $replacefield = "<>"; + my $replacedby = join ',', @$val_ar; + $letter->{content} =~ s/$replacefield/$replacedby/g; + } + } } return $letter; } @@ -733,31 +882,32 @@ returns your letter object, with the content updated. sub _add_attachments { my $params = shift; - return unless 'HASH' eq ref $params; - foreach my $required_parameter (qw( letter attachments message )) { - return unless exists $params->{$required_parameter}; - } - return $params->{'letter'} unless @{ $params->{'attachments'} }; + my $letter = $params->{'letter'}; + my $attachments = $params->{'attachments'}; + return $letter unless @$attachments; + my $message = $params->{'message'}; # First, we have to put the body in as the first attachment - $params->{'message'}->attach( - Type => 'TEXT', - Data => $params->{'letter'}->{'content'}, + $message->attach( + Type => $letter->{'content-type'} || 'TEXT', + Data => $letter->{'is_html'} + ? _wrap_html($letter->{'content'}, $letter->{'title'}) + : $letter->{'content'}, ); - foreach my $attachment ( @{ $params->{'attachments'} } ) { - $params->{'message'}->attach( + foreach my $attachment ( @$attachments ) { + $message->attach( Type => $attachment->{'type'}, Data => $attachment->{'content'}, Filename => $attachment->{'filename'}, ); } # we're forcing list context here to get the header, not the count back from grep. - ( $params->{'letter'}->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) ); - $params->{'letter'}->{'content-type'} =~ s/^Content-Type:\s+//; - $params->{'letter'}->{'content'} = $params->{'message'}->body_as_string; + ( $letter->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) ); + $letter->{'content-type'} =~ s/^Content-Type:\s+//; + $letter->{'content'} = $message->body_as_string; - return $params->{'letter'}; + return $letter; } @@ -824,14 +974,17 @@ sub _send_message_by_email ($;$$$) { my $utf8 = decode('MIME-Header', $message->{'subject'} ); $message->{subject}= encode('MIME-Header', $utf8); + my $subject = encode('utf8', $message->{'subject'}); my $content = encode('utf8', $message->{'content'}); + my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"'; + my $is_html = $content_type =~ m/html/io; my %sendmail_params = ( To => $to_address, From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'), - Subject => encode('utf8', $message->{'subject'}), + Subject => $subject, charset => 'utf8', - Message => $content, - 'content-type' => $message->{'content_type'} || 'text/plain; charset="UTF-8"', + Message => $is_html ? _wrap_html($content, $subject) : $content, + 'content-type' => $content_type, ); $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username; if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) { @@ -851,6 +1004,27 @@ sub _send_message_by_email ($;$$$) { } } +sub _wrap_html { + my ($content, $title) = @_; + + my $css = C4::Context->preference("NoticeCSS") || ''; + $css = qq{} if $css; + return < + + +$title + +$css + + +$content + + +EOS +} + sub _send_message_by_sms ($) { my $message = shift or return undef; my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} ); diff --git a/C4/Members.pm b/C4/Members.pm index 56718f0..2abc178 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -23,7 +23,7 @@ package C4::Members; use strict; #use warnings; FIXME - Bug 2505 use C4::Context; -use C4::Dates qw(format_date_in_iso); +use C4::Dates qw(format_date_in_iso format_date); use Digest::MD5 qw(md5_base64); use Date::Calc qw/Today Add_Delta_YM/; use C4::Log; # logaction @@ -31,8 +31,10 @@ use C4::Overdues; use C4::Reserves; use C4::Accounts; use C4::Biblio; +use C4::Letters; use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable); use C4::Members::Attributes qw(SearchIdMatchingAttribute); +use C4::NewsChannels; #get slip news our ($VERSION, at ISA, at EXPORT, at EXPORT_OK,$debug); @@ -91,6 +93,8 @@ BEGIN { &DeleteMessage &GetMessages &GetMessagesCount + + &IssueSlip ); #Modify data @@ -2243,7 +2247,80 @@ sub DeleteMessage { } -END { } # module clean-up code here (global destructor) +=head2 IssueSlip + + IssueSlip($branchcode, $borrowernumber, $quickslip) + + Returns letter hash ( see C4::Letters::GetPreparedLetter ) + + $quickslip is boolean, to indicate whether we want a quick slip + +=cut + +sub IssueSlip { + my ($branch, $borrowernumber, $quickslip) = @_; + +# return unless ( C4::Context->boolean_preference('printcirculationslips') ); + + my $today = POSIX::strftime("%Y-%m-%d", localtime); + + my $issueslist = GetPendingIssues($borrowernumber); + foreach my $it (@$issueslist){ + if ($it->{'issuedate'} eq $today) { + $it->{'today'} = 1; + } + elsif ($it->{'date_due'} le $today) { + $it->{'overdue'} = 1; + } + + $it->{'date_due'}=format_date($it->{'date_due'}); + } + my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist; + + my ($letter_code, %repeat); + if ( $quickslip ) { + $letter_code = 'ISSUEQSLIP'; + %repeat = ( + 'checkedout' => [ map { + 'biblio' => $_, + 'items' => $_, + 'issues' => $_, + }, grep { $_->{'today'} } @issues ], + ); + } + else { + $letter_code = 'ISSUESLIP'; + %repeat = ( + 'checkedout' => [ map { + 'biblio' => $_, + 'items' => $_, + 'issues' => $_, + }, grep { !$_->{'overdue'} } @issues ], + + 'overdue' => [ map { + 'biblio' => $_, + 'items' => $_, + 'issues' => $_, + }, grep { $_->{'overdue'} } @issues ], + + 'news' => [ map { + $_->{'timestamp'} = $_->{'newdate'}; + { opac_news => $_ } + } @{ GetNewsToDisplay("slip") } ], + ); + } + + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => $letter_code, + branchcode => $branch, + tables => { + 'branches' => $branch, + 'borrowers' => $borrowernumber, + }, + repeat => \%repeat, + ); +} 1; diff --git a/C4/Message.pm b/C4/Message.pm index 16272ff..4b88970 100644 --- a/C4/Message.pm +++ b/C4/Message.pm @@ -18,9 +18,15 @@ How to add a new message to the queue: use C4::Items; my $borrower = { borrowernumber => 1 }; my $item = C4::Items::GetItem(1); - my $letter = C4::Letters::getletter('circulation', 'CHECKOUT'); - C4::Letters::parseletter($letter, 'biblio', $item->{biblionumber}); - C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber}); + my $letter = C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => 'CHECKOUT', + branchcode => $branch, + tables => { + 'biblio', $item->{biblionumber}, + 'biblioitems', $item->{biblionumber}, + }, + ); C4::Message->enqueue($letter, $borrower->{borrowernumber}, 'email'); How to update a borrower's last checkout message: diff --git a/C4/Print.pm b/C4/Print.pm index 2ba7584..2343fa4 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -20,8 +20,6 @@ package C4::Print; use strict; #use warnings; FIXME - Bug 2505 use C4::Context; -use C4::Members; -use C4::Dates qw(format_date); use vars qw($VERSION @ISA @EXPORT); @@ -30,7 +28,7 @@ BEGIN { $VERSION = 3.01; require Exporter; @ISA = qw(Exporter); - @EXPORT = qw(&remoteprint &printreserve &printslip); + @EXPORT = qw(&printslip); } =head1 NAME @@ -47,28 +45,48 @@ The functions in this module handle sending text to a printer. =head1 FUNCTIONS -=head2 remoteprint +=cut - &remoteprint($items, $borrower); +=comment + my $slip = <<"EOF"; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Date: $todaysdate; -Prints the list of items in C<$items> to a printer. +ITEM RESERVED: +$itemdata->{'title'} ($itemdata->{'author'}) +barcode: $itemdata->{'barcode'} + +COLLECT AT: $branchname -C<$borrower> is a reference-to-hash giving information about a patron. -This may be gotten from C<&GetMemberDetails>. The patron's name -will be printed in the output. +BORROWER: +$bordata->{'surname'}, $bordata->{'firstname'} +card number: $bordata->{'cardnumber'} +Phone: $bordata->{'phone'} +$bordata->{'streetaddress'} +$bordata->{'suburb'} +$bordata->{'town'} +$bordata->{'emailaddress'} -C<$items> is a reference-to-list, where each element is a -reference-to-hash describing a borrowed item. C<$items> may be gotten -from C<&GetBorrowerIssues>. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +EOF =cut +=head2 printslip + + &printslip($slip) + +print a slip for the given $borrowernumber and $branchcode + +=cut + +sub printslip ($) { + my ($slip) = @_; + + return unless ( C4::Context->boolean_preference('printcirculationslips') ); + # FIXME - It'd be nifty if this could generate pretty PostScript. -sub remoteprint ($$) { - my ($items, $borrower) = @_; - (return) - unless ( C4::Context->boolean_preference('printcirculationslips') ); my $queue = ''; # FIXME - If 'queue' is undefined or empty, then presumably it should @@ -93,100 +111,13 @@ sub remoteprint ($$) { # print $queue; #open (FILE,">/tmp/$file"); - my $i = 0; - # FIXME - This is HLT-specific. Put this stuff in a customizable - # site-specific file somewhere. - print PRINTER "Horowhenua Library Trust\r\n"; - print PRINTER "Phone: 368-1953\r\n"; - print PRINTER "Fax: 367-9218\r\n"; - print PRINTER "Email: renewals\@library.org.nz\r\n\r\n\r\n"; - print PRINTER "$borrower->{'cardnumber'}\r\n"; - print PRINTER - "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n"; - - # FIXME - Use for ($i = 0; $items->[$i]; $i++) - # Or better yet, foreach $item (@{$items}) - while ( $items->[$i] ) { - - # print $i; - my $itemdata = $items->[$i]; - - # FIXME - This is just begging for a Perl format. - print PRINTER "$i $itemdata->{'title'}\r\n"; - print PRINTER "$itemdata->{'barcode'}"; - print PRINTER " " x 15; - print PRINTER "$itemdata->{'date_due'}\r\n"; - $i++; - } + print PRINTER $slip; print PRINTER "\r\n" x 7 ; close PRINTER; #system("lpr /tmp/$file"); } -sub printreserve { - my ( $branchname, $bordata, $itemdata ) = @_; - my $printer = ''; - (return) unless ( C4::Context->boolean_preference('printreserveslips') ); - if ( $printer eq "" || $printer eq 'nulllp' ) { - open( PRINTER, ">>/tmp/kohares" ) - or die "Could not write to /tmp/kohares"; - } - else { - open( PRINTER, "| lpr -P $printer >/dev/null" ) - or die "Couldn't write to queue:$!\n"; - } - my @da = localtime(); - my $todaysdate = "$da[2]:$da[1] " . C4::Dates->today(); - my $slip = <<"EOF"; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Date: $todaysdate; - -ITEM RESERVED: -$itemdata->{'title'} ($itemdata->{'author'}) -barcode: $itemdata->{'barcode'} - -COLLECT AT: $branchname - -BORROWER: -$bordata->{'surname'}, $bordata->{'firstname'} -card number: $bordata->{'cardnumber'} -Phone: $bordata->{'phone'} -$bordata->{'streetaddress'} -$bordata->{'suburb'} -$bordata->{'town'} -$bordata->{'emailaddress'} - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -EOF - print PRINTER $slip; - close PRINTER; - return $slip; -} - -=head2 printslip - - &printslip($borrowernumber) - -print a slip for the given $borrowernumber - -=cut - -#' -sub printslip ($) { - my $borrowernumber = shift; - my $borrower = GetMemberDetails($borrowernumber); - my $issueslist = GetPendingIssues($borrowernumber); - foreach my $it (@$issueslist){ - $it->{'date_due'}=format_date($it->{'date_due'}); - } - my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist; - remoteprint(\@issues, $borrower ); -} - -END { } # module clean-up code here (global destructor) - 1; __END__ diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 4af8a85..886829e 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -120,6 +120,8 @@ BEGIN { &AlterPriority &ToggleLowestPriority + + &ReserveSlip ); @EXPORT_OK = qw( MergeHolds ); } @@ -193,32 +195,31 @@ sub AddReserve { # Send e-mail to librarian if syspref is active if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){ my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber); - my $biblio = GetBiblioData($biblionumber); - my $letter = C4::Letters::getletter( 'reserves', 'HOLDPLACED'); - my $branchcode = $borrower->{branchcode}; - my $branch_details = C4::Branch::GetBranchDetail($branchcode); - my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'); - - my %keys = (%$borrower, %$biblio); - foreach my $key (keys %keys) { - my $replacefield = "<<$key>>"; - $letter->{content} =~ s/$replacefield/$keys{$key}/g; - $letter->{title} =~ s/$replacefield/$keys{$key}/g; + my $branch_details = C4::Branch::GetBranchDetail($borrower->{branchcode}); + if ( my $letter = C4::Letters::GetPreparedLetter ( + module => 'reserves', + letter_code => 'HOLDPLACED', + branchcode => $branch, + tables => { + 'branches' => $branch_details, + 'borrowers' => $borrower, + 'biblio' => $biblionumber, + }, + ) ) { + + my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'); + + C4::Letters::EnqueueLetter( + { letter => $letter, + borrowernumber => $borrowernumber, + message_transport_type => 'email', + from_address => $admin_email_address, + to_address => $admin_email_address, + } + ); } - - C4::Letters::EnqueueLetter( - { letter => $letter, - borrowernumber => $borrowernumber, - message_transport_type => 'email', - from_address => $admin_email_address, - to_address => $admin_email_address, - } - ); - - } - #} ($const eq "o" || $const eq "e") or return; # FIXME: why not have a useful return value? $query = qq/ @@ -1720,21 +1721,21 @@ sub _koha_notify_reserve { my $admin_email_address = $branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'); - my $letter = getletter( 'reserves', $letter_code ); - die "Could not find a letter called '$letter_code' in the 'reserves' module" unless( $letter ); + my $letter = C4::Letters::GetPreparedLetter ( + module => 'reserves', + letter_code => $letter_code, + branchcode => $reserve->{branchcode}, + tables => { + 'branches' => $branch_details, + 'borrowers' => $borrower, + 'biblio' => $biblionumber, + 'reserves' => $reserve, + 'items', $reserve->{'itemnumber'}, + }, + substitute => { today => C4::Dates->new()->output() }, + ) or die "Could not find a letter called '$letter_code' in the 'reserves' module"; - C4::Letters::parseletter( $letter, 'branches', $reserve->{'branchcode'} ); - C4::Letters::parseletter( $letter, 'borrowers', $borrowernumber ); - C4::Letters::parseletter( $letter, 'biblio', $biblionumber ); - C4::Letters::parseletter( $letter, 'reserves', $borrowernumber, $biblionumber ); - if ( $reserve->{'itemnumber'} ) { - C4::Letters::parseletter( $letter, 'items', $reserve->{'itemnumber'} ); - } - my $today = C4::Dates->new()->output(); - $letter->{'title'} =~ s/<>/$today/g; - $letter->{'content'} =~ s/<>/$today/g; - $letter->{'content'} =~ s/<<[a-z0-9_]+\.[a-z0-9]+>>//g; #remove any stragglers if ( $print_mode ) { C4::Letters::EnqueueLetter( { @@ -1861,6 +1862,36 @@ sub MergeHolds { } +=head2 ReserveSlip + + ReserveSlip($branchcode, $borrowernumber, $biblionumber) + + Returns letter hash ( see C4::Letters::GetPreparedLetter ) or undef + +=cut + +sub ReserveSlip { + my ($branch, $borrowernumber, $biblionumber) = @_; + +# return unless ( C4::Context->boolean_preference('printreserveslips') ); + + my $reserve = GetReserveInfo($borrowernumber,$biblionumber ) + or return; + + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => 'RESERVESLIP', + branchcode => $branch, + tables => { + 'reserves' => $reserve, + 'branches' => $reserve->{branchcode}, + 'borrowers' => $reserve, + 'biblio' => $reserve, + 'items' => $reserve, + }, + ); +} + =head1 AUTHOR Koha Development Team diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 1a93f2e..8a8459b 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -371,20 +371,24 @@ sub ModSuggestion { if ($suggestion->{STATUS}) { # fetch the entire updated suggestion so that we can populate the letter my $full_suggestion = GetSuggestion($suggestion->{suggestionid}); - my $letter = C4::Letters::getletter('suggestions', $full_suggestion->{STATUS}); - if ($letter) { - C4::Letters::parseletter($letter, 'branches', $full_suggestion->{branchcode}); - C4::Letters::parseletter($letter, 'borrowers', $full_suggestion->{suggestedby}); - C4::Letters::parseletter($letter, 'suggestions', $full_suggestion->{suggestionid}); - C4::Letters::parseletter($letter, 'biblio', $full_suggestion->{biblionumber}); - my $enqueued = C4::Letters::EnqueueLetter({ + if ( my $letter = C4::Letters::GetPreparedLetter ( + module => 'suggestions', + letter_code => $full_suggestion->{STATUS}, + branchcode => $full_suggestion->{branchcode}, + tables => { + 'branches' => $full_suggestion->{branchcode}, + 'borrowers' => $full_suggestion->{suggestedby}, + 'suggestions' => $full_suggestion, + 'biblio' => $full_suggestion->{biblionumber}, + }, + ) ) { + C4::Letters::EnqueueLetter({ letter => $letter, borrowernumber => $full_suggestion->{suggestedby}, suggestionid => $full_suggestion->{suggestionid}, LibraryName => C4::Context->preference("LibraryName"), message_transport_type => 'email', - }); - if (!$enqueued){warn "can't enqueue letter $letter";} + }) or warn "can't enqueue letter $letter"; } } return $status_update_table; diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index 634eb93..745d040 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -111,16 +111,11 @@ for my $vendor (@suppliers) { for my $basket ( @{$baskets} ) { my $authorisedby = $basket->{authorisedby}; - my $basketbranch = ''; # set a blank branch to start with - if ( GetMember( borrowernumber => $authorisedby ) ) { - # authorisedby may not be a valid borrowernumber; it's not foreign-key constrained! - $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode}; - } if ($userenv->{'flags'} & 1 || #user is superlibrarian (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and ($viewbaskets eq 'all' || #user is allowed to see all baskets - ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq $basketbranch) || #basket belongs to user's branch + ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq GetMember( borrowernumber => $authorisedby )->{branchcode}) || #basket belongs to user's branch ($basket->{authorisedby} && $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket ) ) diff --git a/circ/circulation.pl b/circ/circulation.pl index efb87da..8d0abfb 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -24,7 +24,6 @@ use strict; #use warnings; FIXME - Bug 2505 use CGI; use C4::Output; -use C4::Print; use C4::Auth qw/:DEFAULT get_session/; use C4::Dates qw/format_date/; use C4::Branch; # GetBranches @@ -175,7 +174,7 @@ if ( $barcode eq '' && $query->param('charges') eq 'yes' ) { } if ( $print eq 'yes' && $borrowernumber ne '' ) { - printslip( $borrowernumber ); + PrintIssueSlip($branch, $borrowernumber); $query->param( 'borrowernumber', '' ); $borrowernumber = ''; } diff --git a/circ/hold-transfer-slip.pl b/circ/hold-transfer-slip.pl index f581464..492dac7 100755 --- a/circ/hold-transfer-slip.pl +++ b/circ/hold-transfer-slip.pl @@ -25,8 +25,6 @@ use C4::Output; use CGI; use C4::Auth; use C4::Reserves; -use C4::Branch; -use C4::Dates qw/format_date format_date_in_iso/; use vars qw($debug); @@ -41,7 +39,7 @@ my $transfer = $input->param('transfer'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "circ/hold-transfer-slip.tmpl", + template_name => "circ/printslip.tmpl", query => $input, type => "intranet", authnotrequired => 0, @@ -50,14 +48,21 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $reserveinfo = GetReserveInfo($borrowernumber,$biblionumber ); -my $pulldate = C4::Dates->new(); -$reserveinfo->{'pulldate'} = $pulldate->output(); -$reserveinfo->{'branchname'} = GetBranchName($reserveinfo->{'branchcode'}); -$reserveinfo->{'transferrequired'} = $transfer; - -$template->param( reservedata => [ $reserveinfo ] , - ); +my $userenv = C4::Context->userenv; +my ($slip, $is_html); +if ( my $letter = ReserveSlip ($userenv->{branch}, $borrowernumber, $biblionumber) ) { + $slip = $letter->{content}; + $is_html = $letter->{is_html}; +} +else { + $slip = "Reserve not found"; +} +$template->param( + slip => $slip, + plain => !$is_html, + title => "Koha -- Circulation: Transfers", + stylesheet => C4::Context->preference("SlipCSS"), +); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/installer/data/mysql/de-DE/mandatory/sample_notices.sql b/installer/data/mysql/de-DE/mandatory/sample_notices.sql index 166c36d..efdad91 100644 --- a/installer/data/mysql/de-DE/mandatory/sample_notices.sql +++ b/installer/data/mysql/de-DE/mandatory/sample_notices.sql @@ -11,7 +11,7 @@ VALUES ('circulation','ODUE','Mahnung','Mahnung','Liebe/r < ('reserves', 'HOLD_PRINT', 'Vormerkbenachrichtigung (Print)', 'Vormerkbenachrichtigung (Print)', '<>\r\n<>\r\n<>\r\n<>\r\n<> <>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<> <>\r\n<>\r\n<>\r\n<> <>\r\n<>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nLiebe(r) <> <>,\r\n\r\nF??r Sie liegt seit dem <> eine Vormerkung zur Abholung bereit:\r\n\r\nTitel: <>\r\nVerfasser: <>\r\nSignatur: <>\r\n'), ('circulation','CHECKIN','R??ckgabequittung (Zusammenfassung)','R??ckgabequittung','Die folgenden Medien wurden zur??ckgegeben:\r\n----\r\n<>\r\n----\r\nVielen Dank.'), ('circulation','CHECKOUT','Ausleihquittung (Zusammenfassung)','Ausleihquittung','Die folgenden Medien wurden entliehen:\r\n----\r\n<>\r\n----\r\nVielen Dank f??r Ihren Besuch in <>.'), -('reserves', 'HOLDPLACED', 'Neue Vormerkung', 'Neue Vormerkung','Folgender Titel wurde vorgemerkt: <> (<<biblionumber>>) durch den Benutzer <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Neue Vormerkung', 'Neue Vormerkung','Folgender Titel wurde vorgemerkt: <<biblio.title>> (<<biblio.biblionumber>>) durch den Benutzer <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Anschaffungsvorschlag wurde angenommen', 'Ihr Anschaffungsvorschlag wurde angenommen','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlagen: <<suggestions.title>> by <<suggestions.author>>.\n\nDie Bibliothek hat diesen Titel heute recherchiert und wird Ihn sobald wie m??glich im Buchhandel bestellen. Sie erhalten Nachricht, sobald die Bestellung abgeschlossen ist und sobald der Titel in der Bibliotek verf??gbar ist.\n\nWenn Sie Fragen haben, richten Sie Ihre Mail bitte an: <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Vorgeschlagenes Medium verf??gbar', 'Das vorgeschlagene Medium ist jetzt verf??gbar','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlagen: <<suggestions.title>> von <<suggestions.author>>.\n\nWir freuen uns Ihnen mitteilen zu k??nnen, dass dieser Titel jetzt im Bestand der Bibliothek verf??gbar ist.\n\nWenn Sie Fragen haben, richten Sie Ihre Mail bitte an: <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Vorgeschlagenes Medium bestellt', 'Das vorgeschlagene Medium wurde im Buchhandel bestellt','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlaten: <<suggestions.title>> von <<suggestions.author>>.\n\nWir freuen uns Ihnen mitteilen zu k??nnen, dass dieser Titel jetzt im Buchhandel bestellt wurde. Nach Eintreffen wird er in unseren Bestand eingearbeitet.\n\nSie erhalten Nachricht, sobald das Medium verf??gbar ist.\n\nBei Nachfragen erreichen Sie uns unter der Emailadresse <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql index 689fa0f..8c9f4bd 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ b/installer/data/mysql/en/mandatory/sample_notices.sql @@ -11,8 +11,90 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <<suggestions.reason>>\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'); +INSERT INTO `letter` (module, code, name, title, content, is_html) +VALUES ('circulation','ISSUESLIP','Issue Slip','Issue Slip', '<h3><<branches.branchname>></h3> +Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> +(<<borrowers.cardnumber>>) <br /> + +<<today>><br /> + +<h4>Checked Out</h4> +<checkedout> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</checkedout> + +<h4>Overdues</h4> +<overdue> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</overdue> + +<hr> + +<h4 style="text-align: center; font-style:italic;">News</h4> +<news> +<div class="newsitem"> +<h5 style="margin-bottom: 1px; margin-top: 1px"><b><<opac_news.title>></b></h5> +<p style="margin-bottom: 1px; margin-top: 1px"><<opac_news.new>></p> +<p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px">Posted on <<opac_news.timestamp>></p> +<hr /> +</div> +</news>', 1), +('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '<h3><<branches.branchname>></h3> +Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> +(<<borrowers.cardnumber>>) <br /> + +<<today>><br /> + +<h4>Checked Out Today</h4> +<checkedout> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</checkedout>', 1), +('circulation','RESERVESLIP','Reserve Slip','Reserve Slip', '<h5>Date: <<today>></h5> + +<h3> Transfer to/Hold in <<branches.branchname>></h3> + +<reserves> +<div> +<h3><<borrowers.surname>>, <<borrowers.firstname>></h3> + +<ul> + <li><<borrowers.cardnumber>></li> + <li><<borrowers.phone>></li> + <li> <<borrowers.address>><br /> + <<borrowers.address2>><br /> + <<borrowers.city >> <<borrowers.zipcode>> + </li> + <li><<borrowers.email>></li> +</ul> +<br /> +<h3>ITEM ON HOLD</h3> + <h4><<biblio.title>></h4> + <h5><<biblio.author>></h5> + <ul> + <li><<items.barcode>></li> + <li><<items.itemcallnumber>></li> + <li><<reserves.waitingdate>></li> + </ul> + <p>Notes: + <pre><<reserves.reservenotes>></pre> + </p> +</div> +</reserves>', 1); + diff --git a/installer/data/mysql/es-ES/mandatory/sample_notices.sql b/installer/data/mysql/es-ES/mandatory/sample_notices.sql index 689fa0f..bf3324d 100644 --- a/installer/data/mysql/es-ES/mandatory/sample_notices.sql +++ b/installer/data/mysql/es-ES/mandatory/sample_notices.sql @@ -11,7 +11,7 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql index 977e59d..acffe73 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql @@ -13,7 +13,7 @@ VALUES ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup at <<branches.branchname>>', '<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n\n\nChange Service Requested\n\n\n\n\n\n\n\n<<borrowers.firstname>> <<borrowers.surname>>\n<<borrowers.address>>\n<<borrowers.city>> <<borrowers.zipcode>>\n\n\n\n\n\n\n\n\n\n\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\n\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/it-IT/necessari/notices.sql b/installer/data/mysql/it-IT/necessari/notices.sql index 689fa0f..bf3324d 100644 --- a/installer/data/mysql/it-IT/necessari/notices.sql +++ b/installer/data/mysql/it-IT/necessari/notices.sql @@ -11,7 +11,7 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e4388a4..59ee5f3 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1166,10 +1166,12 @@ DROP TABLE IF EXISTS `letter`; CREATE TABLE `letter` ( -- table for all notice templates in Koha `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice `code` varchar(20) NOT NULL default '', -- unique identifier for this notice + `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out `name` varchar(100) NOT NULL default '', -- plain text name for this notice + `is_html` tinyint(1) default 0, `title` varchar(200) NOT NULL default '', -- subject line of the notice `content` text, -- body text for the notice - PRIMARY KEY (`module`,`code`) + PRIMARY KEY (`module`,`code`, `branchcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql index cdb5529..08b452e 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql @@ -32,7 +32,7 @@ VALUES ('circulation','ODUE','Purring','Purring p?? dokument','<<borrowers.first ('reserves', 'HOLD_PRINT', 'Hentemelding (p?? papir)', 'Hentemelding', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nDu har et reservert dokument som kan hentes fra <<reserves.waitingdate>>:\r\n\r\nTittel: <<biblio.title>>\r\nForfatter: <<biblio.author>>\r\nEksemplar: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Innlevering','Melding om innlevering','F??lgende dokument har blitt innlevert:\r\n----\r\n<<biblio.title>>\r\n----\r\nVennlig hilsen\r\nBiblioteket'), ('circulation','CHECKOUT','Utl??n','Melding om utl??n','F??lgende dokument har blitt l??nt ut:\r\n----\r\n<<biblio.title>>\r\n----\r\nVennlig hilsen\r\nBiblioteket'), -('reserves', 'HOLDPLACED', 'Melding om reservasjon', 'Melding om reservasjon','F??lgende dokument har blitt reservert : <<title>> (<<biblionumber>>) av <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Melding om reservasjon', 'Melding om reservasjon','F??lgende dokument har blitt reservert : <<biblio.title>> (<<biblio.biblionumber>>) av <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Forslag godtatt', 'Innkj??psforslag godtatt','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foresl??tt at biblioteket kj??per inn <<suggestions.title>> av <<suggestions.author>>.\n\nBiblioteket har vurdert forslaget i dag. Dokumentet vil bli bestilt s?? fort det lar seg gj??re. Du vil f?? en ny melding n??r bestillingen er gjort, og n??r dokumentet ankommer biblioteket.\n\nEr det noe du lurer p??, vennligst kontakt oss p?? <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Foresl??tt dokument tilgjengelig', 'Foresl??tt dokument tilgjengelig','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foresl??tt at biblioteket kj??per inn <<suggestions.title>> av <<suggestions.author>>.\n\nVi har gleden av ?? informere deg om at dokumentet n?? er innlemmet i samlingen.\n\nEr det noe du lurer p??, vennligst kontakt oss p?? <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Innkj??psforslag i bestilling', 'Innkj??psforslag i bestilling','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foresl??tt at biblioteket kj??per inn <<suggestions.title>> av <<suggestions.author>>.\n\nVi har gleden av ?? informere deg om at dokumentet du foreslo n?? er i bestilling.\n\nDu vil f?? en ny melding n??r dokumentet er tilgjengelig.\n\nEr det noe du lurer p??, vennligst kontakt oss p?? <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql index 6be2eb8..f0844f3 100644 --- a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql +++ b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql @@ -13,7 +13,7 @@ VALUES ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql index 689fa0f..bf3324d 100644 --- a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql +++ b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql @@ -11,7 +11,7 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ae2c1cb..f10a7b3 100755 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -328,4 +328,7 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free'); + diff --git a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql index 358205b..b637343 100644 --- a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql +++ b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql @@ -10,7 +10,7 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f ('reserves', 'HOLD', 'Hold Available for Pickup', 'Hold Available for Pickup at <<branches.branchname>>', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\nLocation: <<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress3>>\r\n<<branches.branchcity>> <<branches.branchzip>>'), ('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'), ('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'), -('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'), +('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'), ('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 815a71d..7dc7557 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4496,7 +4496,6 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n"; SetVersion ($DBversion); } - } $DBversion = "3.05.00.018"; @@ -4550,6 +4549,103 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.06.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE `letter` DROP PRIMARY KEY"); + $dbh->do("ALTER TABLE `letter` ADD `branchcode` varchar(10) default NULL AFTER `code`"); + $dbh->do("ALTER TABLE `letter` ADD PRIMARY KEY (`module`,`code`, `branchcode`)"); + $dbh->do("ALTER TABLE `letter` ADD `is_html` tinyint(1) default 0 AFTER `name`"); + print "Added branchcode and is_html to letter table\n"; + + $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html) + VALUES ('circulation','ISSUESLIP','Issue Slip','Issue Slip', '<h3><<branches.branchname>></h3> +Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> +(<<borrowers.cardnumber>>) <br /> + +<<today>><br /> + +<h4>Checked Out</h4> +<checkedout> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</checkedout> + +<h4>Overdues</h4> +<overdue> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</overdue> + +<hr> + +<h4 style=\"text-align: center; font-style:italic;\">News</h4> +<news> +<div class=\"newsitem\"> +<h5 style=\"margin-bottom: 1px; margin-top: 1px\"><b><<opac_news.title>></b></h5> +<p style=\"margin-bottom: 1px; margin-top: 1px\"><<opac_news.new>></p> +<p class=\"newsfooter\" style=\"font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px\">Posted on <<opac_news.timestamp>></p> +<hr /> +</div> +</news>', 1)"); + $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html) + VALUES ('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '<h3><<branches.branchname>></h3> +Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> +(<<borrowers.cardnumber>>) <br /> + +<<today>><br /> + +<h4>Checked Out Today</h4> +<checkedout> +<p> +<<biblio.title>> <br /> +Barcode: <<items.barcode>><br /> +Date due: <<issues.date_due>><br /> +</p> +</checkedout>', 1)"); + $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html) + VALUES ('circulation','RESERVESLIP','Reserve Slip','Reserve Slip', '<h5>Date: <<today>></h5> + +<h3> Transfer to/Hold in <<branches.branchname>></h3> + +<h3><<borrowers.surname>>, <<borrowers.firstname>></h3> + +<ul> + <li><<borrowers.cardnumber>></li> + <li><<borrowers.phone>></li> + <li> <<borrowers.address>><br /> + <<borrowers.address2>><br /> + <<borrowers.city >> <<borrowers.zipcode>> + </li> + <li><<borrowers.email>></li> +</ul> +<br /> +<h3>ITEM ON HOLD</h3> +<h4><<biblio.title>></h4> +<h5><<biblio.author>></h5> +<ul> + <li><<items.barcode>></li> + <li><<items.itemcallnumber>></li> + <li><<reserves.waitingdate>></li> +</ul> +<p>Notes: +<pre><<reserves.reservenotes>></pre> +</p>', 1)"); + + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free')"); + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free')"); + + $dbh->do("UPDATE `letter` SET content = replace(content, '<<title>>', '<<biblio.title>>') WHERE code = 'HOLDPLACED')"); + + print "Upgrade to $DBversion done (Add branchcode and is_html to letter table; Add NoticeCSS and SlipCSS sysprefs)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc index 503f954..e7e150d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc @@ -42,8 +42,10 @@ function update_child() { }); // YUI Toolbar Functions + var slip_re = /slip/; function printx_window(print_type) { - window.open("/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]&print=" + print_type, "printwindow"); + var handler = print_type.match(slip_re) ? "printslip" : "moremember"; + window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&print=" + print_type, "printwindow"); return false; } function searchToHold(){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index f4946b5..b3b279c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -91,6 +91,11 @@ Circulation: yes: Record no: "Don't record" - local use when an unissued item is checked in. + - + - Include the stylesheet at + - pref: NoticeCSS + class: url + - on Notices. (This should be a complete URL, starting with <code>http://</code>.) Checkout Policy: - - pref: AllowNotForLoanOverride diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref index df0a434..efa33a8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -83,6 +83,11 @@ Staff Client: Results: "Results page (for future use, Results XSLT not functional at this time)." Both: "Both Results and Details pages (for future use, Results XSLT not functional at this time)." - 'Note: The corresponding XSLT option must be turned on.' + - + - Include the stylesheet at + - pref: SlipCSS + class: url + - on Issue and Reserve Slips. (This should be a complete URL, starting with <code>http://</code>.) Options: - - pref: viewMARC diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt index 1904381..73f9e61 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt @@ -8,11 +8,7 @@ --> </style> [% IF ( stylesheet ) %] - <style type="text/css"> - <!-- - [% stylesheet %] - --> - </style> + <link rel="stylesheet" type="text/css" href="[% stylesheet %]"> [% END %] </head> <body> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt deleted file mode 100644 index 18d45aa..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt +++ /dev/null @@ -1,54 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -<title>Koha -- Circulation: Transfers -[% INCLUDE 'doc-head-close-receipt.inc' %] - - -
    - -[% FOREACH reservedat IN reservedata %] - -
    Date: [% reservedat.pulldate %]
    -

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

    - -
    - -

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

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

    ITEM ON HOLD

    -

    [% reservedat.title |html %]

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

    Notes: [% reservedat.reservenotes %]

    - [% END %] - - - -[% END %] -
    -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt new file mode 100644 index 0000000..a790069 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt @@ -0,0 +1,28 @@ +[% INCLUDE 'doc-head-open.inc' %] +[% title %] + + + +[% IF stylesheet %] + +[% END %] + + + + +
    + +[% IF plain %] +
    +[% slip %]
    +
    +[% ELSE %] +[% slip %] +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt deleted file mode 100644 index 4a85ccb..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt +++ /dev/null @@ -1,76 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Print Receipt for [% cardnumber %] - - - - - - - - -
    - -

    [% LibraryName %]

    -[% IF ( branchname ) %][% branchname %]
    [% END %] -Checked out to [% firstname %] [% surname %]
    -([% cardnumber %])
    - -[% todaysdate %]
    - -[% IF ( quickslip ) %] -

    Checked Out Today

    -[% FOREACH issueloo IN issueloop %] -[% IF ( issueloo.red ) %][% ELSE %] -[% IF ( issueloo.today ) %] -

    [% issueloo.title |html %]
    -Barcode: [% issueloo.barcode %]
    -Date due: [% issueloo.date_due %]

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

    Checked Out

    -[% FOREACH issueloo IN issueloop %] -[% IF ( issueloo.red ) %][% ELSE %] -

    [% issueloo.title |html %]
    -Barcode: [% issueloo.barcode %]
    -Date due: [% issueloo.date_due %]

    - [% END %] - [% END %] - -[% END %] - -[% IF ( quickslip ) %] -[% ELSE %] -[% IF ( overdues_exist ) %] -

    Overdues

    - [% FOREACH issueloo IN issueloop %] - [% IF ( issueloo.red ) %] -

    [% issueloo.title |html %]
    -Barcode: [% issueloo.barcode %]
    -Date due: [% issueloo.date_due %]

    -[% END %] -[% END %] -[% END %] -[% END %] - -[% IF ( koha_news_count ) %] -

    News

    - - [% FOREACH koha_new IN koha_news %] -
    [% koha_new.title %]
    -

    [% koha_new.new %]

    -

    Posted on [% koha_new.newdate %] - -


    - [% END %] -[% END %] - - -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 063236e..b64477e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -10,6 +10,10 @@ $(document).ready(function() { sortList: [[0,0]], headers: { 3: {sorter:false},4: { sorter: false }} }); + + $('#branch').change(function() { + $('#selectlibrary').submit(); + }); }); [% IF ( add_form ) %] @@ -114,7 +118,7 @@ $(document).ready(function() {
    - [% IF ( no_op_set ) %] +[% IF ( no_op_set ) %]
    + + [% UNLESS independant_branch %] +

    +

    + + Select a library : + +
    +

    + [% END %] +
    @@ -135,41 +155,71 @@ $(document).ready(function() { [% IF ( search ) %]

    You Searched for [% searchfield %]

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

    Delete Notice?

    @@ -290,14 +357,14 @@ $(document).ready(function() { - [% END %] +[% END %] - [% IF ( delete_confirmed ) %] +[% IF ( delete_confirmed ) %] Data deleted - [% END %] +[% END %] diff --git a/members/memberentry.pl b/members/memberentry.pl index f01261e..195704a 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -327,10 +327,7 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ # if we manage to find a valid email address, send notice if ($emailaddr) { $newdata{emailaddr} = $emailaddr; - my $letter = getletter ('members', "ACCTDETAILS:$newdata{'branchcode'}") ; - # if $branch notice fails, then email a default notice instead. - $letter = getletter ('members', "ACCTDETAILS") if !$letter; - SendAlerts ( 'members' , \%newdata , $letter ) if $letter + SendAlerts ( 'members', \%newdata, "ACCTDETAILS" ); } } diff --git a/members/moremember.pl b/members/moremember.pl index 9115dd1..6b7a50f 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -50,7 +50,6 @@ use C4::Biblio; use C4::Reserves; use C4::Branch; # GetBranchName use C4::Form::MessagingPreferences; -use C4::NewsChannels; #get slip news use List::MoreUtils qw/uniq/; use C4::Members::Attributes qw(GetBorrowerAttributes); @@ -473,13 +472,4 @@ $template->param( quickslip => $quickslip, ); -#Get the slip news items -my $all_koha_news = &GetNewsToDisplay("slip"); -my $koha_news_count = scalar @$all_koha_news; - -$template->param( - koha_news => $all_koha_news, - koha_news_count => $koha_news_count -); - output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/printslip.pl b/members/printslip.pl new file mode 100755 index 0000000..eba8d68 --- /dev/null +++ b/members/printslip.pl @@ -0,0 +1,89 @@ +#!/usr/bin/perl + +# Copyright 2000-2002 Katipo Communications +# Copyright 2010 BibLibre +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +=head1 moremember.pl + + script to do a borrower enquiry/bring up borrower details etc + Displays all the details about a borrower + written 20/12/99 by chris at katipo.co.nz + last modified 21/1/2000 by chris at katipo.co.nz + modified 31/1/2001 by chris at katipo.co.nz + to not allow items on request to be renewed + + needs html removed and to use the C4::Output more, but its tricky + +=cut + +use strict; +#use warnings; FIXME - Bug 2505 +use CGI; +use C4::Context; +use C4::Auth; +use C4::Output; +use C4::Members; +use C4::Koha; + +#use Smart::Comments; +#use Data::Dumper; + +use vars qw($debug); + +BEGIN { + $debug = $ENV{DEBUG} || 0; +} + +my $input = new CGI; +$debug or $debug = $input->param('debug') || 0; +my $print = $input->param('print'); +my $error = $input->param('error'); + +# circ staff who process checkouts but can't edit +# patrons still need to be able to print receipts +my $flagsrequired = { circulate => "circulate_remaining_permissions" }; + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "circ/printslip.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => $flagsrequired, + debug => 1, + } +); + +my $borrowernumber = $input->param('borrowernumber'); +my $branch=C4::Context->userenv->{'branch'}; +my ($slip, $is_html); +if (my $letter = IssueSlip ($branch, $borrowernumber, $print eq "qslip")) { + $slip = $letter->{content}; + $is_html = $letter->{is_html}; +} + +$template->param( + slip => $slip, + plain => !$is_html, + title => "Print Receipt for $borrowernumber", + stylesheet => C4::Context->preference("SlipCSS"), + error => $error, +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl index 1fa358f..09c4017 100755 --- a/misc/cronjobs/advance_notices.pl +++ b/misc/cronjobs/advance_notices.pl @@ -79,13 +79,10 @@ patrons. It queues them in the message queue, which is processed by the process_message_queue.pl cronjob. See the comments in the script for directions on changing the script. This script has the following parameters : - -c Confirm and remove this help & warning - -m maximum number of days in advance to send advance notices. - -n send No mail. Instead, all mail messages are printed on screen. Usefull for testing purposes. - -v verbose - -i csv list of fields that get substituted into templates in places - of the EEitems.contentEE placeholder. Defaults to - issuedate,title,barcode,author + -c Confirm and remove this help & warning + -m maximum number of days in advance to send advance notices. + -n send No mail. Instead, all mail messages are printed on screen. Usefull for testing purposes. + -v verbose ENDUSAGE # Since advance notice options are not visible in the web-interface @@ -157,8 +154,6 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { } else { my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} ); my $letter_type = 'DUE'; - $letter = C4::Letters::getletter( 'circulation', $letter_type ); - die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter; $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},'0'); my $titles = ""; while ( my $item_info = $sth->fetchrow_hashref()) { @@ -166,13 +161,14 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { $titles .= join("\t", at item_info) . "\n"; } - $letter = parse_letter( { letter => $letter, + $letter = parse_letter( { letter_code => $letter_type, borrowernumber => $upcoming->{'borrowernumber'}, branchcode => $upcoming->{'branchcode'}, biblionumber => $biblio->{'biblionumber'}, itemnumber => $upcoming->{'itemnumber'}, substitute => { 'items.content' => $titles } - } ); + } ) + or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; } } else { $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'}, @@ -189,8 +185,6 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { } else { my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} ); my $letter_type = 'PREDUE'; - $letter = C4::Letters::getletter( 'circulation', $letter_type ); - die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter; $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},$borrower_preferences->{'days_in_advance'}); my $titles = ""; while ( my $item_info = $sth->fetchrow_hashref()) { @@ -198,13 +192,14 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { $titles .= join("\t", at item_info) . "\n"; } - $letter = parse_letter( { letter => $letter, + $letter = parse_letter( { letter_code => $letter_type, borrowernumber => $upcoming->{'borrowernumber'}, branchcode => $upcoming->{'branchcode'}, biblionumber => $biblio->{'biblionumber'}, itemnumber => $upcoming->{'itemnumber'}, substitute => { 'items.content' => $titles } - } ); + } ) + or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; } } @@ -250,8 +245,6 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) { my $letter_type = 'PREDUEDGST'; - my $letter = C4::Letters::getletter( 'circulation', $letter_type ); - die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter; $sth->execute($borrowernumber,$borrower_preferences->{'days_in_advance'}); my $titles = ""; @@ -259,12 +252,13 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) { my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields; $titles .= join("\t", at item_info) . "\n"; } - $letter = parse_letter( { letter => $letter, + my $letter = parse_letter( { letter_code => $letter_type, borrowernumber => $borrowernumber, substitute => { count => $count, 'items.content' => $titles } - } ); + } ) + or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; if ($nomail) { local $, = "\f"; print $letter->{'content'}; @@ -290,20 +284,19 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) { next PATRON unless $borrower_preferences; # how could this happen? my $letter_type = 'DUEDGST'; - my $letter = C4::Letters::getletter( 'circulation', $letter_type ); - die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter; $sth->execute($borrowernumber,'0'); my $titles = ""; while ( my $item_info = $sth->fetchrow_hashref()) { my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields; $titles .= join("\t", at item_info) . "\n"; } - $letter = parse_letter( { letter => $letter, + my $letter = parse_letter( { letter_code => $letter_type, borrowernumber => $borrowernumber, substitute => { count => $count, 'items.content' => $titles } - } ); + } ) + or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; if ($nomail) { local $, = "\f"; @@ -323,40 +316,35 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) { =head2 parse_letter - - =cut sub parse_letter { my $params = shift; - foreach my $required ( qw( letter borrowernumber ) ) { + foreach my $required ( qw( letter_code borrowernumber ) ) { return unless exists $params->{$required}; } - if ( $params->{'substitute'} ) { - while ( my ($key, $replacedby) = each %{$params->{'substitute'}} ) { - my $replacefield = "<<$key>>"; - - $params->{'letter'}->{title} =~ s/$replacefield/$replacedby/g; - $params->{'letter'}->{content} =~ s/$replacefield/$replacedby/g; - } - } - - C4::Letters::parseletter( $params->{'letter'}, 'borrowers', $params->{'borrowernumber'} ); + my %table_params = ( 'borrowers' => $params->{'borrowernumber'} ); - if ( $params->{'branchcode'} ) { - C4::Letters::parseletter( $params->{'letter'}, 'branches', $params->{'branchcode'} ); + if ( my $p = $params->{'branchcode'} ) { + $table_params{'branches'} = $p; } - if ( $params->{'itemnumber'} ) { - C4::Letters::parseletter( $params->{'letter'}, 'issues', $params->{'itemnumber'} ); - C4::Letters::parseletter( $params->{'letter'}, 'items', $params->{'itemnumber'} ); + if ( my $p = $params->{'itemnumber'} ) { + $table_params{'issues'} = $p; + $table_params{'items'} = $p; } - if ( $params->{'biblionumber'} ) { - C4::Letters::parseletter( $params->{'letter'}, 'biblio', $params->{'biblionumber'} ); - C4::Letters::parseletter( $params->{'letter'}, 'biblioitems', $params->{'biblionumber'} ); + if ( my $p = $params->{'biblionumber'} ) { + $table_params{'biblio'} = $p; + $table_params{'biblioitems'} = $p; } - return $params->{'letter'}; + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => $params->{'letter_code'}, + branchcode => $table_params{'branches'}, + substitute => $params->{'substitute'}, + tables => \%table_params, + ); } 1; diff --git a/misc/cronjobs/gather_print_notices.pl b/misc/cronjobs/gather_print_notices.pl index a72d6a6..165b16e 100755 --- a/misc/cronjobs/gather_print_notices.pl +++ b/misc/cronjobs/gather_print_notices.pl @@ -39,11 +39,9 @@ use Getopt::Long; sub usage { print STDERR < \$stylesheet, 'h|help' => \$help, ) || usage( 1 ); @@ -71,16 +68,9 @@ exit unless( @messages ); open OUTPUT, '>', File::Spec->catdir( $output_directory, "holdnotices-" . $today->output( 'iso' ) . ".html" ); my $template = C4::Templates::gettemplate( 'batch/print-notices.tmpl', 'intranet', new CGI ); -my $stylesheet_contents = ''; - -if ($stylesheet) { - open STYLESHEET, '<', $stylesheet; - while ( ) { $stylesheet_contents .= $_ } - close STYLESHEET; -} $template->param( - stylesheet => $stylesheet_contents, + stylesheet => C4::Context->preference("NoticeCSS"), today => $today->output(), messages => \@messages, ); diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 37774b5..a8544c6 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -459,17 +459,7 @@ END_SQL $longest_issue ) = $sth->fetchrow ) { $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has $itemcount items triggering level $i."; - - my $letter = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"} ); - - unless ($letter) { - $verbose and warn "Message '$overdue_rules->{letter$i}' content not found"; - - # might as well skip while PERIOD, no other borrowers are going to work. - # FIXME : Does this mean a letter must be defined in order to trigger a debar ? - next PERIOD; - } - + if ( $overdue_rules->{"debarred$i"} ) { #action taken is debarring @@ -494,11 +484,12 @@ END_SQL my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields; $titles .= join("\t", @item_info) . "\n"; $itemcount++; - push @items, { itemnumber => $item_info->{'itemnumber'}, biblionumber => $item_info->{'biblionumber'} }; + push @items, $item_info; } $sth2->finish; - $letter = parse_letter( - { letter => $letter, + + my $letter = parse_letter( + { letter_code => $overdue_rules->{"letter$i"}, borrowernumber => $borrowernumber, branchcode => $branchcode, items => \@items, @@ -508,6 +499,13 @@ END_SQL } } ); + unless ($letter) { + $verbose and warn "Message '$overdue_rules->{letter$i}' content not found"; + + # might as well skip while PERIOD, no other borrowers are going to work. + # FIXME : Does this mean a letter must be defined in order to trigger a debar ? + next PERIOD; + } if ( $exceededPrintNoticesMaxLines ) { $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items."; @@ -642,53 +640,55 @@ substituted keys and values. =cut -sub parse_letter { # FIXME: this code should probably be moved to C4::Letters:parseletter +sub parse_letter { my $params = shift; - foreach my $required (qw( letter borrowernumber )) { + foreach my $required (qw( letter_code borrowernumber )) { return unless exists $params->{$required}; } - my $todaysdate = C4::Dates->new()->output("syspref"); - $params->{'letter'}->{title} =~ s/<>/$todaysdate/g; - $params->{'letter'}->{content} =~ s/<>/$todaysdate/g; + my $substitute = $params->{'substitute'} || {}; + $substitute->{today} ||= C4::Dates->new()->output("syspref"); - if ( $params->{'substitute'} ) { - while ( my ( $key, $replacedby ) = each %{ $params->{'substitute'} } ) { - my $replacefield = "<<$key>>"; - $params->{'letter'}->{title} =~ s/$replacefield/$replacedby/g; - $params->{'letter'}->{content} =~ s/$replacefield/$replacedby/g; - } + my %tables = ( 'borrowers' => $params->{'borrowernumber'} ); + if ( my $p = $params->{'branchcode'} ) { + $tables{'branches'} = $p; } - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'borrowers', $params->{'borrowernumber'} ); - - if ( $params->{'branchcode'} ) { - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'branches', $params->{'branchcode'} ); + my $currency_format; + if ($params->{'letter'}->{'content'} =~ m/(.*)<\/fine>/o) { # process any fine tags... + $currency_format = $1; + $params->{'letter'}->{'content'} =~ s/.*<\/fine>/<>/o; } - if ( $params->{'items'} ) { + my @item_tables; + if ( my $i = $params->{'items'} ) { my $item_format = ''; - PROCESS_ITEMS: - while (scalar(@{$params->{'items'}}) > 0) { - my $item = shift @{$params->{'items'}}; + foreach my $item (@$i) { my $fine = GetFine($item->{'itemnumber'}, $params->{'borrowernumber'}); if (!$item_format) { $params->{'letter'}->{'content'} =~ m/(.*<\/item>)/; $item_format = $1; } - if ($params->{'letter'}->{'content'} =~ m/(.*)<\/fine>/) { # process any fine tags... - my $formatted_fine = currency_format("$1", "$fine", FMT_SYMBOL); - $params->{'letter'}->{'content'} =~ s/.*<\/fine>/$formatted_fine/; - } - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'biblio', $item->{'biblionumber'} ); - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'biblioitems', $item->{'biblionumber'} ); - $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'items', $item->{'itemnumber'} ); - $params->{'letter'}->{'content'} =~ s/(.*<\/item>)/$1\n$item_format/ if scalar(@{$params->{'items'}} > 0); + $item->{'fine'} = currency_format($currency_format, "$fine", FMT_SYMBOL) + if $currency_format; + + push @item_tables, { + 'biblio' => $item->{'biblionumber'}, + 'biblioitems' => $item->{'biblionumber'}, + 'items' => $item, + }; } } - $params->{'letter'}->{'content'} =~ s/<\/{0,1}?item>//g; # strip all remaining item tags... - return $params->{'letter'}; + + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => $params->{'letter_code'}, + branchcode => $params->{'branchcode'}, + tables => \%tables, + substitute => $substitute, + repeat => { item => \@item_tables }, + ); } =head2 prepare_letter_for_printing diff --git a/t/db_dependent/lib/KohaTest/Letters.pm b/t/db_dependent/lib/KohaTest/Letters.pm index 97d58fb..f2d7b0d 100644 --- a/t/db_dependent/lib/KohaTest/Letters.pm +++ b/t/db_dependent/lib/KohaTest/Letters.pm @@ -12,13 +12,12 @@ sub testing_class { 'C4::Letters' }; sub methods : Test( 1 ) { my $self = shift; - my @methods = qw( getletter - addalert + my @methods = qw( addalert delalert getalert findrelatedto SendAlerts - parseletter + GetPreparedLetter ); can_ok( $self->testing_class, @methods ); diff --git a/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm b/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm index 76b6ab4..53e5439 100644 --- a/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm +++ b/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm @@ -10,7 +10,7 @@ use Test::More; sub GetLetter : Test( 6 ) { my $self = shift; - my $letter = getletter( 'circulation', 'ODUE' ); + my $letter = getletter( 'circulation', 'ODUE', '' ); isa_ok( $letter, 'HASH' ) or diag( Data::Dumper->Dump( [ $letter ], [ 'letter' ] ) ); @@ -21,7 +21,6 @@ sub GetLetter : Test( 6 ) { ok( exists $letter->{'name'}, 'name' ); ok( exists $letter->{'title'}, 'title' ); - } 1; diff --git a/t/db_dependent/lib/KohaTest/Members.pm b/t/db_dependent/lib/KohaTest/Members.pm index 5646be1..dfde7da 100644 --- a/t/db_dependent/lib/KohaTest/Members.pm +++ b/t/db_dependent/lib/KohaTest/Members.pm @@ -52,6 +52,7 @@ sub methods : Test( 1 ) { GetBorrowersWhoHaveNeverBorrowed GetBorrowersWithIssuesHistoryOlderThan GetBorrowersNamesAndLatestIssue + IssueSlip ); can_ok( $self->testing_class, @methods ); diff --git a/t/db_dependent/lib/KohaTest/Print.pm b/t/db_dependent/lib/KohaTest/Print.pm index 02fd5fb..d35ab34 100644 --- a/t/db_dependent/lib/KohaTest/Print.pm +++ b/t/db_dependent/lib/KohaTest/Print.pm @@ -12,10 +12,7 @@ sub testing_class { 'C4::Print' }; sub methods : Test( 1 ) { my $self = shift; - my @methods = qw( remoteprint - printreserve - printslip - ); + my @methods = qw( printslip ); can_ok( $self->testing_class, @methods ); } diff --git a/t/db_dependent/lib/KohaTest/Reserves.pm b/t/db_dependent/lib/KohaTest/Reserves.pm index 5317029..70a96fc 100644 --- a/t/db_dependent/lib/KohaTest/Reserves.pm +++ b/t/db_dependent/lib/KohaTest/Reserves.pm @@ -32,6 +32,7 @@ sub methods : Test( 1 ) { GetReserveInfo _FixPriority _Findgroupreserve + ReserveSlip ); can_ok( $self->testing_class, @methods ); diff --git a/tools/letter.pl b/tools/letter.pl index f5dc0c6..7cfca55 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -46,14 +46,34 @@ use CGI; use C4::Auth; use C4::Context; use C4::Output; +use C4::Branch; # GetBranches -# letter_exists($module, $code) -# - return true if a letter with the given $module and $code exists +# _letter_from_where($branchcode,$module, $code) +# - return FROM WHERE clause and bind args for a letter +sub _letter_from_where { + my ($branchcode, $module, $code) = @_; + my $sql = q{FROM letter WHERE branchcode = ? AND module = ? AND code = ?}; + my @args = ($branchcode || '', $module, $code); +# Mysql is retarded. cause branchcode is part of the primary key it cannot be null. How does that +# work with foreign key constraint I wonder... + +# if ($branchcode) { +# $sql .= " AND branchcode = ?"; +# push @args, $branchcode; +# } else { +# $sql .= " AND branchcode IS NULL"; +# } + + return ($sql, \@args); +} + +# letter_exists($branchcode,$module, $code) +# - return true if a letter with the given $branchcode, $module and $code exists sub letter_exists { - my ($module, $code) = @_; + my ($sql, $args) = _letter_from_where(@_); my $dbh = C4::Context->dbh; - my $letters = $dbh->selectall_arrayref(q{SELECT name FROM letter WHERE module = ? AND code = ?}, undef, $module, $code); - return @{$letters}; + my $letter = $dbh->selectrow_hashref("SELECT * $sql", undef, @$args); + return $letter; } # $protected_letters = protected_letters() @@ -67,14 +87,12 @@ sub protected_letters { my $input = new CGI; my $searchfield = $input->param('searchfield'); my $script_name = '/cgi-bin/koha/tools/letter.pl'; +my $branchcode = $input->param('branchcode'); my $code = $input->param('code'); my $module = $input->param('module'); my $content = $input->param('content'); -my $op = $input->param('op'); +my $op = $input->param('op') || ''; my $dbh = C4::Context->dbh; -if (!defined $module ) { - $module = q{}; -} my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { @@ -87,32 +105,38 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); -if (!defined $op) { - $op = q{}; # silence errors from eq -} +my $my_branch = C4::Context->preference("IndependantBranches") + ? C4::Context->userenv()->{'branch'} + : undef; # we show only the TMPL_VAR names $op $template->param( + independant_branch => $my_branch, script_name => $script_name, action => $script_name ); +if ($op eq 'copy') { + add_copy(); + $op = 'add_form'; +} + if ($op eq 'add_form') { - add_form($module, $code); + add_form($branchcode, $module, $code); } elsif ( $op eq 'add_validate' ) { add_validate(); $op = q{}; # next operation is to return to default screen } elsif ( $op eq 'delete_confirm' ) { - delete_confirm($module, $code); + delete_confirm($branchcode, $module, $code); } elsif ( $op eq 'delete_confirmed' ) { - delete_confirmed($module, $code); + delete_confirmed($branchcode, $module, $code); $op = q{}; # next operation is to return to default screen } else { - default_display($searchfield); + default_display($branchcode,$searchfield); } # Do this last as delete_confirmed resets @@ -125,23 +149,21 @@ if ($op) { output_html_with_http_headers $input, $cookie, $template->output; sub add_form { - my ($module, $code ) = @_; + my ($branchcode,$module, $code ) = @_; my $letter; # if code has been passed we can identify letter and its an update action if ($code) { - $letter = $dbh->selectrow_hashref(q{SELECT module, code, name, title, content FROM letter WHERE module=? AND code=?}, - undef, $module, $code); + $letter = letter_exists($branchcode,$module, $code); + } + if ($letter) { $template->param( modify => 1 ); $template->param( code => $letter->{code} ); } else { # initialize the new fields $letter = { - module => $module, - code => q{}, - name => q{}, - title => q{}, - content => q{}, + branchcode => $branchcode, + module => $module, }; $template->param( adding => 1 ); } @@ -173,14 +195,20 @@ sub add_form { {value => q{}, text => '---ITEMS---' }, {value => 'items.content', text => 'items.content'}, add_fields('issues','borrowers'); + if ($module eq 'circulation') { + push @{$field_selection}, add_fields('opac_news'); + } } $template->param( - name => $letter->{name}, - title => $letter->{title}, - content => $letter->{content}, - module => $module, - $module => 1, + branchcode => $letter->{branchcode}, + name => $letter->{name}, + is_html => $letter->{is_html}, + title => $letter->{title}, + content => $letter->{content}, + module => $module, + $module => 1, + branchloop => _branchloop($branchcode), SQLfieldname => $field_selection, ); return; @@ -188,37 +216,56 @@ sub add_form { sub add_validate { my $dbh = C4::Context->dbh; - my $module = $input->param('module'); - my $oldmodule = $input->param('oldmodule'); - my $code = $input->param('code'); - my $name = $input->param('name'); - my $title = $input->param('title'); - my $content = $input->param('content'); - if (letter_exists($oldmodule, $code)) { + my $oldbranchcode = $input->param('oldbranchcode'); + my $branchcode = $input->param('branchcode') || ''; + my $module = $input->param('module'); + my $oldmodule = $input->param('oldmodule'); + my $code = $input->param('code'); + my $name = $input->param('name'); + my $is_html = $input->param('is_html'); + my $title = $input->param('title'); + my $content = $input->param('content'); + if (letter_exists($oldbranchcode,$oldmodule, $code)) { $dbh->do( - q{UPDATE letter SET module = ?, code = ?, name = ?, title = ?, content = ? WHERE module = ? AND code = ?}, + q{UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ? WHERE branchcode = ? AND module = ? AND code = ?}, undef, - $module, $code, $name, $title, $content, - $oldmodule, $code + $branchcode, $module, $name, $is_html || 0, $title, $content, + $oldbranchcode, $oldmodule, $code ); } else { $dbh->do( - q{INSERT INTO letter (module,code,name,title,content) VALUES (?,?,?,?,?)}, + q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content) VALUES (?,?,?,?,?,?,?)}, undef, - $module, $code, $name, $title, $content + $branchcode, $module, $code, $name, $is_html || 0, $title, $content ); } # set up default display - default_display(); - return; + default_display($branchcode); +} + +sub add_copy { + my $dbh = C4::Context->dbh; + my $oldbranchcode = $input->param('oldbranchcode'); + my $branchcode = $input->param('branchcode'); + my $module = $input->param('module'); + my $code = $input->param('code'); + + return if letter_exists($branchcode,$module, $code); + + my $old_letter = letter_exists($oldbranchcode,$module, $code); + + $dbh->do( + q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content) VALUES (?,?,?,?,?,?,?)}, + undef, + $branchcode, $module, $code, $old_letter->{name}, $old_letter->{is_html}, $old_letter->{title}, $old_letter->{content} + ); } sub delete_confirm { - my ($module, $code) = @_; + my ($branchcode, $module, $code) = @_; my $dbh = C4::Context->dbh; - my $letter = $dbh->selectrow_hashref(q|SELECT name FROM letter WHERE module = ? AND code = ?|, - { Slice => {} }, - $module, $code); + my $letter = letter_exists($branchcode, $module, $code); + $template->param( branchcode => $branchcode ); $template->param( code => $code ); $template->param( module => $module); $template->param( name => $letter->{name}); @@ -226,40 +273,54 @@ sub delete_confirm { } sub delete_confirmed { - my ($module, $code) = @_; + my ($branchcode, $module, $code) = @_; + my ($sql, $args) = _letter_from_where($branchcode, $module, $code); my $dbh = C4::Context->dbh; - $dbh->do('DELETE FROM letter WHERE module=? AND code=?',{},$module,$code); + $dbh->do("DELETE $sql", undef, @$args); # setup default display for screen - default_display(); + default_display($branchcode); return; } sub retrieve_letters { - my $searchstring = shift; + my ($branchcode, $searchstring) = @_; + + $branchcode = $my_branch if $branchcode && $my_branch; + my $dbh = C4::Context->dbh; - if ($searchstring) { - if ($searchstring=~m/(\S+)/) { - $searchstring = $1 . q{%}; - return $dbh->selectall_arrayref('SELECT module, code, name FROM letter WHERE code LIKE ? ORDER BY module, code', - { Slice => {} }, $searchstring); - } + my ($sql, @where, @args); + $sql = "SELECT branchcode, module, code, name, branchname + FROM letter + LEFT OUTER JOIN branches USING (branchcode)"; + if ($searchstring && $searchstring=~m/(\S+)/) { + $searchstring = $1 . q{%}; + push @where, 'code LIKE ?'; + push @args, $searchstring; } - else { - return $dbh->selectall_arrayref('SELECT module, code, name FROM letter ORDER BY module, code', { Slice => {} }); + elsif ($branchcode) { + push @where, 'branchcode = ?'; + push @args, $branchcode || ''; } - return; + elsif ($my_branch) { + push @where, "(branchcode = ? OR branchcode = '')"; + push @args, $my_branch; + } + + $sql .= " WHERE ".join(" AND ", @where) if @where; + $sql .= " ORDER BY module, code, branchcode"; +# use Data::Dumper; die Dumper($sql, \@args); + return $dbh->selectall_arrayref($sql, { Slice => {} }, @args); } sub default_display { - my $searchfield = shift; - my $results; + my ($branchcode, $searchfield) = @_; + if ( $searchfield ) { $template->param( search => 1 ); $template->param( searchfield => $searchfield ); - $results = retrieve_letters($searchfield); - } else { - $results = retrieve_letters(); } + my $results = retrieve_letters($branchcode,$searchfield); + my $loop_data = []; my $protected_letters = protected_letters(); foreach my $row (@{$results}) { @@ -267,8 +328,27 @@ sub default_display { push @{$loop_data}, $row; } - $template->param( letter => $loop_data ); - return; + + $template->param( + letter => $loop_data, + branchloop => _branchloop($branchcode), + ); +} + +sub _branchloop { + my ($branchcode) = @_; + + my $branches = GetBranches(); + my @branchloop; + for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { + push @branchloop, { + value => $thisbranch, + selected => $branchcode && $thisbranch eq $branchcode, + branchname => $branches->{$thisbranch}->{'branchname'}, + }; + } + + return \@branchloop; } sub add_fields { -- 1.6.5 From Katrin.Fischer.83 at web.de Mon Nov 21 08:03:21 2011 From: Katrin.Fischer.83 at web.de (Katrin Fischer) Date: Mon, 21 Nov 2011 08:03:21 +0100 Subject: [Koha-patches] [PATCH] Bug 7250: stage_biblios_file.pl is missing options for encoding Message-ID: <1321859001-4751-1-git-send-email-Katrin.Fischer.83@web.de> - adds command line options for encoding, defaulting to utf8 - options match options availablen in the stage marc records form of the staff interface - activates warnings - adds copyright statement To test: Import records with diacritics using the stage_biblios_file.pl Records can be imported into the catalog using the staff interface or the commit_biblios_file.pl script. --- misc/stage_biblios_file.pl | 35 ++++++++++++++++++++++++++++++----- 1 files changed, 30 insertions(+), 5 deletions(-) diff --git a/misc/stage_biblios_file.pl b/misc/stage_biblios_file.pl index 3f18082..6e2b30c 100755 --- a/misc/stage_biblios_file.pl +++ b/misc/stage_biblios_file.pl @@ -1,7 +1,25 @@ #!/usr/bin/perl +# This file is part of Koha. +# +# Copyright (C) 2007 LibLime +# Parts Copyright BSZ 2011 +# +# 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 this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + use strict; -#use warnings; FIXME - Bug 2505 +use warnings; BEGIN { # find Koha's Perl modules # test carefully before changing this @@ -17,6 +35,7 @@ use Getopt::Long; $| = 1; # command-line parameters +my $encoding = ""; my $match_bibs = 0; my $add_items = 0; my $input_file = ""; @@ -25,14 +44,19 @@ my $want_help = 0; my $no_replace ; my $result = GetOptions( + 'encoding:s' => \$encoding, 'file:s' => \$input_file, - 'match-bibs:s' => \$match_bibs, + 'match-bibs:s' => \$match_bibs, 'add-items' => \$add_items, 'no-replace' => \$no_replace, 'comment:s' => \$batch_comment, 'h|help' => \$want_help ); +if ($encoding eq "") { + $encoding = "utf8"; +} + if (not $result or $input_file eq "" or $want_help) { print_usage(); exit 0; @@ -67,11 +91,9 @@ sub process_batch { } close IN; - my $marc_flavor = C4::Context->preference('marcflavour'); - print "... staging MARC records -- please wait\n"; my ($batch_id, $num_valid, $num_items, @import_errors) = - BatchStageMarcRecords($marc_flavor, $marc_records, $input_file, $batch_comment, '', $add_items, 0, + BatchStageMarcRecords($encoding, $marc_records, $input_file, $batch_comment, '', $add_items, 0, 100, \&print_progress_and_commit); print "... finished staging MARC records\n"; @@ -141,6 +163,9 @@ records into the main Koha database. Parameters: --file name of input MARC bib file + --encoding encoding of MARC records, default is utf8. + Other possible options are: MARC-8, + ISO_5426, ISO_6937, ISO_8859-1, EUC-KR --match-bibs use this option to match bibs in the file with bibs already in the database for future overlay. -- 1.7.5.4 From chrisc at catalyst.net.nz Mon Nov 21 08:32:48 2011 From: chrisc at catalyst.net.nz (Chris Cormack) Date: Mon, 21 Nov 2011 20:32:48 +1300 Subject: [Koha-patches] [PATCH 2/2] Bug 4330: Missing License Statement In-Reply-To: <1321860768-10566-1-git-send-email-chrisc@catalyst.net.nz> References: <1321860768-10566-1-git-send-email-chrisc@catalyst.net.nz> Message-ID: <1321860768-10566-2-git-send-email-chrisc@catalyst.net.nz> --- opac/sco/sco-main.pl | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 427d995..a1a3ce6 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -3,6 +3,22 @@ # This code has been modified by Trendsetters (originally from opac-user.pl) # This code has been modified by rch # Parts Copyright 2010-2011, ByWater Solutions (those related to username/password auth) +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + # We're going to authenticate a self-check user. we'll add a flag to borrowers 'selfcheck' # # We're in a controlled environment; we trust the user. -- 1.7.5.4 From chrisc at catalyst.net.nz Mon Nov 21 08:32:47 2011 From: chrisc at catalyst.net.nz (Chris Cormack) Date: Mon, 21 Nov 2011 20:32:47 +1300 Subject: [Koha-patches] [PATCH 1/2] Bug 4330: Wrong address for Free Software Foundation Message-ID: <1321860768-10566-1-git-send-email-chrisc@catalyst.net.nz> --- about.pl | 6 +++--- mainpage.pl | 7 +++---- opac/opac-export.pl | 7 +++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/about.pl b/about.pl index ae2d0dc..596637d 100755 --- a/about.pl +++ b/about.pl @@ -16,9 +16,9 @@ # 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 +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; diff --git a/mainpage.pl b/mainpage.pl index 25ee475..857bd7c 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -14,10 +14,9 @@ # 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 -# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; diff --git a/opac/opac-export.pl b/opac/opac-export.pl index 41bf81a..411fd3f 100755 --- a/opac/opac-export.pl +++ b/opac/opac-export.pl @@ -13,10 +13,9 @@ # 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 -# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; -- 1.7.5.4 From M.de.Rooy at rijksmuseum.nl Mon Nov 21 09:27:48 2011 From: M.de.Rooy at rijksmuseum.nl (Marcel de Rooy) Date: Mon, 21 Nov 2011 08:27:48 +0000 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 6303: Display Organisation and Parent Organisation names when viewing a borrower of type organisation Message-ID: <809BE39CD64BFD4EB9036172EBCCFA31378639@S-MAIL-1B.rijksmuseum.intra> From: Srdjan Jankovic Signed-off-by: Katrin Fischer Works as advertised, doesn't affect display for non-organisational patrons. Note: Display change in OPAC only affects the summary tab. It would be a little bit more consistent to make the name show the same on all tabs in OPAC patron account. Signed-off-by: Marcel de Rooy I repeated Katrin's signoff here (with permission). The patch only changed for some minor rebasing and cosmetic QA requests. Passed QA now. --- C4/Members.pm | 22 ++++++++++--------- circ/circulation.pl | 7 ++++- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 2 +- .../prog/en/includes/patron-title.inc | 6 +++++ .../prog/en/modules/circ/circulation.tt | 21 ++++++++++--------- .../prog/en/modules/members/boraccount.tt | 4 +- .../prog/en/modules/members/member.tt | 4 ++- .../prog/en/modules/members/moremember.tt | 10 +++++++- .../prog/en/modules/members/notices.tt | 6 ++-- .../prog/en/modules/members/readingrec.tt | 4 +- .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 17 +++++++++++--- .../opac-tmpl/prog/en/includes/patron-title.inc | 5 ++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 7 ++++- .../opac-tmpl/prog/en/modules/opac-userupdate.tt | 7 ++++- members/boraccount.pl | 3 +- members/moremember.pl | 6 ++-- members/readingrec.pl | 1 + opac/opac-user.pl | 2 + tools/viewlog.pl | 3 ++ 19 files changed, 92 insertions(+), 45 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/patron-title.inc diff --git a/C4/Members.pm b/C4/Members.pm index 56718f0..4f5a299 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -313,11 +313,11 @@ sub GetMemberDetails { my $query; my $sth; if ($borrowernumber) { - $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); + $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); $sth->execute($borrowernumber); } elsif ($cardnumber) { - $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); + $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); $sth->execute($cardnumber); } else { @@ -340,14 +340,16 @@ sub GetMemberDetails { $borrower->{'flags'} = $flags; $borrower->{'authflags'} = $accessflagshash; - # find out how long the membership lasts - $sth = - $dbh->prepare( - "select enrolmentperiod from categories where categorycode = ?"); - $sth->execute( $borrower->{'categorycode'} ); - my $enrolment = $sth->fetchrow; - $borrower->{'enrolmentperiod'} = $enrolment; - + # For the purposes of making templates easier, we'll define a + # 'showname' which is the alternate form the user's first name if + # 'other name' is defined. + if ($borrower->{category_type} eq 'I') { + $borrower->{'showname'} = $borrower->{'othernames'}; + $borrower->{'showname'} .= " $borrower->{'firstname'}" if $borrower->{'firstname'}; + } else { + $borrower->{'showname'} = $borrower->{'firstname'}; + } + return ($borrower); #, $flags, $accessflagshash); } diff --git a/circ/circulation.pl b/circ/circulation.pl index efb87da..378956e 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -629,9 +629,9 @@ my (undef, $roadttype_hashref) = &GetRoadTypes(); my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'}; my $fast_cataloging = 0; - if (defined getframeworkinfo('FA')) { +if (defined getframeworkinfo('FA')) { $fast_cataloging = 1 - } +} if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); @@ -654,6 +654,8 @@ $template->param( printername => $printer, firstname => $borrower->{'firstname'}, surname => $borrower->{'surname'}, + showname => $borrower->{'showname'}, + category_type => $borrower->{'category_type'}, dateexpiry => format_date($newexpiry), expiry => format_date($borrower->{'dateexpiry'}), categorycode => $borrower->{'categorycode'}, @@ -669,6 +671,7 @@ $template->param( country => $borrower->{'country'}, phone => $borrower->{'phone'} || $borrower->{'mobile'}, cardnumber => $borrower->{'cardnumber'}, + othernames => $borrower->{'othernames'}, amountold => $amountold, barcode => $barcode, stickyduedate => $stickyduedate, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 67300d5..6556562 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -1,5 +1,5 @@ [% IF ( borrowernumber ) %] -
    [% firstname %] [% surname %] ([% cardnumber %])
    +
    [% INCLUDE 'patron-title.inc' %]
    [% END %] - +
    + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt index 10f1d6d..05bdb47 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt @@ -16,8 +16,8 @@

    Patrons and circulation

    [% IF ( CAN_user_tools_moderate_comments ) %] -
    Comments
    -
    Moderate patron comments
    +
    Comments [% IF ( pendingcomments ) %][% pendingcomments %][% END %]
    +
    Moderate patron comments.
    [% END %] [% IF ( CAN_user_tools_import_patrons ) %] @@ -46,7 +46,7 @@ [% END %] [% IF ( CAN_user_tools_moderate_tags ) %] -
    Tags
    +
    Tags [% IF ( pendingtags ) %][% pendingtags %][% END %]
    Moderate patron tags
    [% END %] diff --git a/mainpage.pl b/mainpage.pl index 25ee475..ab3fce9 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -27,6 +27,9 @@ use C4::Auth; use C4::AuthoritiesMarc; use C4::Koha; use C4::NewsChannels; +use C4::Review qw/numberofreviews/; +use C4::Suggestions qw/CountSuggestion/; +use C4::Tags qw/get_count_by_tag_status/; my $query = new CGI; my $authtypes = getauthtypes; my @authtypesloop; @@ -67,4 +70,14 @@ $template->param( koha_news_count => $koha_news_count ); +my $pendingcomments = numberofreviews(0); +my $pendingtags = get_count_by_tag_status(0); +my $pendingsuggestions = CountSuggestion("ASKED"); + +$template->param( + pendingcomments => $pendingcomments, + pendingtags => $pendingtags, + pendingsuggestions => $pendingsuggestions +); + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index 3a74270..01ac0bd 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -73,7 +73,7 @@ if (!$@ and C4::Context->preference('ShowReviewer') and C4::Context->preference( my $reviews = getallreviews(1,$offset,$results_per_page); my $marcflavour = C4::Context->preference("marcflavour"); -my $hits = numberofreviews(); +my $hits = numberofreviews(1); my $i = 0; my $latest_comment_date; for my $result (@$reviews){ diff --git a/tools/tools-home.pl b/tools/tools-home.pl index 7028358..055f7f4 100755 --- a/tools/tools-home.pl +++ b/tools/tools-home.pl @@ -21,6 +21,8 @@ use warnings; use CGI; use C4::Auth; use C4::Output; +use C4::Review qw/numberofreviews/; +use C4::Tags qw/get_count_by_tag_status/; my $query = new CGI; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -34,4 +36,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); +my $pendingcomments = numberofreviews(0); +my $pendingtags = get_count_by_tag_status(0); + +$template->param( + pendingcomments => $pendingcomments, + pendingtags => $pendingtags +); + output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.3 From robin at catalyst.net.nz Thu Nov 24 01:37:53 2011 From: robin at catalyst.net.nz (Robin Sheat) Date: Thu, 24 Nov 2011 13:37:53 +1300 Subject: [Koha-patches] [PATCH] Bug 5373 - allow 'cardnumber' to appear on the patron import field list Message-ID: <1322095073-24430-1-git-send-email-robin@catalyst.net.nz> For some reason, it was explicitly removed, however you need it if you want to match up on cardnumber. --- tools/import_borrowers.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl index a7e9142..83db522 100755 --- a/tools/import_borrowers.pl +++ b/tools/import_borrowers.pl @@ -62,7 +62,7 @@ my @columnkeys = C4::Members->columns; if ($extended) { push @columnkeys, 'patron_attributes'; } -my $columnkeystpl = [ map { {'key' => $_} } grep {$_ ne 'borrowernumber' && $_ ne 'cardnumber'} @columnkeys ]; # ref. to array of hashrefs. +my $columnkeystpl = [ map { {'key' => $_} } grep {$_ ne 'borrowernumber' } @columnkeys ]; # ref. to array of hashrefs. my $input = CGI->new(); our $csv = Text::CSV->new({binary => 1}); # binary needed for non-ASCII Unicode -- 1.7.5.4 From M.de.Rooy at rijksmuseum.nl Thu Nov 24 11:51:04 2011 From: M.de.Rooy at rijksmuseum.nl (Marcel de Rooy) Date: Thu, 24 Nov 2011 10:51:04 +0000 Subject: [Koha-patches] [PATCH] 6916 follow up Message-ID: <809BE39CD64BFD4EB9036172EBCCFA3137911D@S-MAIL-1B.rijksmuseum.intra> Changed the SQL statement in GetOrderFromItemnumber so that it works also if syspref AcqCreateItem is not equal to placing an order. Returned hash now only includes fields from aqorders. This function is used in moredetail.pl and Items.pm (function MoveItemFromBiblio). Modified moredetail template so that label is shown always. Added nbsp to prevent mixup of columns when date is null. Test this by checking Items tab in normal view staff and by attaching an item in normal view staff (actually moving an item). Check moredetail again while changing syspref AcqCreateItem. --- C4/Acquisition.pm | 17 +++++++---------- .../prog/en/modules/catalogue/moredetail.tt | 11 ++++------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index a0dda42..3d16438 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -72,20 +72,17 @@ sub GetOrderFromItemnumber { my ($itemnumber) = @_; my $dbh = C4::Context->dbh; my $query = qq| - - SELECT * from aqorders LEFT JOIN aqorders_items - ON ( aqorders.ordernumber = aqorders_items.ordernumber ) - WHERE itemnumber = ? |; + SELECT ord.* from aqorders ord + LEFT JOIN items it ON it.biblionumber=ord.biblionumber + WHERE it.itemnumber=?|; + #Bugzilla 6916: query used join with aqorders_items, but this only + #worked if syspref AcqCreateItems == placing an order. Now we use items. + #It is not needed to return columns from tables other than aqorders. my $sth = $dbh->prepare($query); - -# $sth->trace(3); - $sth->execute($itemnumber); - my $order = $sth->fetchrow_hashref; - return ( $order ); - + return $order; } # Returns the itemnumber(s) associated with the ordernumber given in parameter diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 36e7149..5f30209 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -151,20 +151,17 @@

    History

      -
    1. +
    2. Accession Date: [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] - - Accession Date: [% IF ( ITEM_DAT.basketno ) %] - [% ITEM_DAT.dateaccessioned %] + [% ITEM_DAT.dateaccessioned %] [% ELSE %] - [% ITEM_DAT.dateaccessioned %] + [% ITEM_DAT.dateaccessioned %] [% END %] [% ELSE %] [% ITEM_DAT.dateaccessioned %] - [% END %]
    3. + [% END %]   -
    4. Total Checkouts:[% IF ( ITEM_DAT.issues ) %][% ITEM_DAT.issues %][% ELSE %]0[% END %] (View item's checkout history)
    5. Last seen: [% ITEM_DAT.datelastseen %] 
    6. -- 1.6.0.6 From juan.sieira at xercode.es Thu Nov 24 17:42:49 2011 From: juan.sieira at xercode.es (Juan Romay Sieira) Date: Thu, 24 Nov 2011 17:42:49 +0100 Subject: [Koha-patches] [PATCH] System Preference to select the first day of week (Sunday or Monday) to use in the calendar (OPAC and Intranet). Message-ID: <1322152969-16996-1-git-send-email-juan.sieira@xercode.es> --- C4/Auth.pm | 2 ++ installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 7 +++++++ .../intranet-tmpl/prog/en/includes/calendar.inc | 2 +- .../prog/en/lib/calendar/calendar-setup.js | 5 ++++- .../prog/en/modules/admin/preferences/admin.pref | 8 ++++++++ .../opac-tmpl/prog/en/modules/opac-reserve.tt | 6 ++++-- 7 files changed, 27 insertions(+), 5 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index e360e10..347d037 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -369,6 +369,7 @@ sub get_template_and_user { AmazonSimilarItems => C4::Context->preference("AmazonSimilarItems"), AutoLocation => C4::Context->preference("AutoLocation"), "BiblioDefaultView".C4::Context->preference("IntranetBiblioDefaultView") => 1, + CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1, CircAutocompl => C4::Context->preference("CircAutocompl"), FRBRizeEditions => C4::Context->preference("FRBRizeEditions"), IndependantBranches => C4::Context->preference("IndependantBranches"), @@ -426,6 +427,7 @@ sub get_template_and_user { AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"), BranchesLoop => GetBranchesLoop($opac_name), + CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Monday")?1:0, LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"", diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ae2c1cb..8ada5f5 100755 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -328,4 +328,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); - +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CalendarFirstDayOfWeek','Sunday','Select the first day of week to use in the calendar.','Sunday|Monday','Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 815a71d..9b69a4e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4550,6 +4550,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.06.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CalendarFirstDayOfWeek','Sunday','Select the first day of week to use in the calendar.','Sunday|Monday','Choice');"); + print "Upgrade to $DBversion done (Add syspref CalendarFirstDayOfWeek used to select the first day of week to use in the calendar. )\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc index 43ba022..d70716c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -7,7 +7,7 @@ Calendar._DN = new Array(_("Sunday"),_("Monday"),_("Tuesday"),_("Wednesday"),_(" Calendar._SDN = new Array(_("Sun"),_("Mon"),_("Tue"),_("Wed"),_("Thu"),_("Fri"),_("Sat"),_("Sun")); // First day of the week. "0" means display Sunday first, "1" means display // Monday first, etc. -Calendar._FD = 1; +Calendar._FD = [% CalendarFirstDayOfWeek %]; // full month names Calendar._MN = new Array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December")); // short month names diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js b/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js index 8b7fcdf..1d876b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js +++ b/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js @@ -69,7 +69,10 @@ Calendar.setup = function (params) { param_default("singleClick", true); param_default("disableFunc", 'dateStatusHandler'); param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined - param_default("firstDay", 0); // defaults to "Sunday" first + if (Calendar._FD) + param_default("firstDay", Calendar._FD); + else + param_default("firstDay", 0); // defaults to "Sunday" first param_default("align", "Br"); param_default("range", [1900, 2999]); param_default("weekNumbers", true); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref index f026c7e..e4f5502 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref @@ -40,6 +40,14 @@ Administration: yes: Allow no: "Don't allow" - staff and patrons to create and view saved lists of books. + - + - Use + - pref: CalendarFirstDayOfWeek + default: Sunday + choices: + Sunday: Sunday + Monday: Monday + - as the first day of week in the calendar. Login options: - - pref: insecure diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index ca49152..826effc 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -338,7 +338,8 @@ ifFormat : "[% DHTMLcalendar_dateformat %]", button : "CalendarReserveDate[% bibitemloo.biblionumber %]", disableFunc : validate[% bibitemloo.biblionumber %], - dateStatusFunc : validate[% bibitemloo.biblionumber %] + dateStatusFunc : validate[% bibitemloo.biblionumber %], + firstDay : [% CalendarFirstDayOfWeek %] } ); //]]> @@ -370,7 +371,8 @@ ifFormat : "[% DHTMLcalendar_dateformat %]", button : "CalendarExpirationDate_[% bibitemloo.biblionumber %]", disableFunc : validate1, - dateStatusFunc : validate1 + dateStatusFunc : validate1, + firstDay : [% CalendarFirstDayOfWeek %] } ); //]]> -- 1.7.1 From juan.sieira at xercode.es Thu Nov 24 17:52:31 2011 From: juan.sieira at xercode.es (Juan Romay Sieira) Date: Thu, 24 Nov 2011 17:52:31 +0100 Subject: [Koha-patches] [PATCH] Bug 7261 - System Preference to select the first day of week (Sunday or Monday) to use in the calendar (OPAC and Intranet). Message-ID: <1322153551-17536-1-git-send-email-juan.sieira@xercode.es> --- C4/Auth.pm | 2 ++ installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 7 +++++++ .../intranet-tmpl/prog/en/includes/calendar.inc | 2 +- .../prog/en/lib/calendar/calendar-setup.js | 5 ++++- .../prog/en/modules/admin/preferences/admin.pref | 8 ++++++++ .../opac-tmpl/prog/en/modules/opac-reserve.tt | 6 ++++-- 7 files changed, 27 insertions(+), 5 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index e360e10..347d037 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -369,6 +369,7 @@ sub get_template_and_user { AmazonSimilarItems => C4::Context->preference("AmazonSimilarItems"), AutoLocation => C4::Context->preference("AutoLocation"), "BiblioDefaultView".C4::Context->preference("IntranetBiblioDefaultView") => 1, + CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1, CircAutocompl => C4::Context->preference("CircAutocompl"), FRBRizeEditions => C4::Context->preference("FRBRizeEditions"), IndependantBranches => C4::Context->preference("IndependantBranches"), @@ -426,6 +427,7 @@ sub get_template_and_user { AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"), BranchesLoop => GetBranchesLoop($opac_name), + CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Monday")?1:0, LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"", diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ae2c1cb..8ada5f5 100755 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -328,4 +328,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); - +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CalendarFirstDayOfWeek','Sunday','Select the first day of week to use in the calendar.','Sunday|Monday','Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 815a71d..9b69a4e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4550,6 +4550,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.06.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CalendarFirstDayOfWeek','Sunday','Select the first day of week to use in the calendar.','Sunday|Monday','Choice');"); + print "Upgrade to $DBversion done (Add syspref CalendarFirstDayOfWeek used to select the first day of week to use in the calendar. )\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc index 43ba022..d70716c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -7,7 +7,7 @@ Calendar._DN = new Array(_("Sunday"),_("Monday"),_("Tuesday"),_("Wednesday"),_(" Calendar._SDN = new Array(_("Sun"),_("Mon"),_("Tue"),_("Wed"),_("Thu"),_("Fri"),_("Sat"),_("Sun")); // First day of the week. "0" means display Sunday first, "1" means display // Monday first, etc. -Calendar._FD = 1; +Calendar._FD = [% CalendarFirstDayOfWeek %]; // full month names Calendar._MN = new Array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December")); // short month names diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js b/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js index 8b7fcdf..1d876b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js +++ b/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js @@ -69,7 +69,10 @@ Calendar.setup = function (params) { param_default("singleClick", true); param_default("disableFunc", 'dateStatusHandler'); param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined - param_default("firstDay", 0); // defaults to "Sunday" first + if (Calendar._FD) + param_default("firstDay", Calendar._FD); + else + param_default("firstDay", 0); // defaults to "Sunday" first param_default("align", "Br"); param_default("range", [1900, 2999]); param_default("weekNumbers", true); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref index f026c7e..e4f5502 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref @@ -40,6 +40,14 @@ Administration: yes: Allow no: "Don't allow" - staff and patrons to create and view saved lists of books. + - + - Use + - pref: CalendarFirstDayOfWeek + default: Sunday + choices: + Sunday: Sunday + Monday: Monday + - as the first day of week in the calendar. Login options: - - pref: insecure diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index ca49152..826effc 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -338,7 +338,8 @@ ifFormat : "[% DHTMLcalendar_dateformat %]", button : "CalendarReserveDate[% bibitemloo.biblionumber %]", disableFunc : validate[% bibitemloo.biblionumber %], - dateStatusFunc : validate[% bibitemloo.biblionumber %] + dateStatusFunc : validate[% bibitemloo.biblionumber %], + firstDay : [% CalendarFirstDayOfWeek %] } ); //]]> @@ -370,7 +371,8 @@ ifFormat : "[% DHTMLcalendar_dateformat %]", button : "CalendarExpirationDate_[% bibitemloo.biblionumber %]", disableFunc : validate1, - dateStatusFunc : validate1 + dateStatusFunc : validate1, + firstDay : [% CalendarFirstDayOfWeek %] } ); //]]> -- 1.7.1 From juan.sieira at xercode.es Thu Nov 24 18:05:57 2011 From: juan.sieira at xercode.es (Juan Romay Sieira) Date: Thu, 24 Nov 2011 18:05:57 +0100 Subject: [Koha-patches] [PATCH] Bug 7262 - No calendar present in holidays module when there are quotes in title or description Message-ID: <1322154357-17924-1-git-send-email-juan.sieira@xercode.es> --- .../prog/en/modules/tools/holidays.tt | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt index ac867fe..51795f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt @@ -270,16 +270,16 @@ var day_month_holidays = new Array(); var hola= "[% code %]"; [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %] - week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% WEEK_DAYS_LOO.TITLE %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION %]"}; + week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') %]"}; [% END %] [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %] - holidays["[% HOLIDAYS_LOO.KEY %]"] = {title:"[% HOLIDAYS_LOO.TITLE %]", description:"[% HOLIDAYS_LOO.DESCRIPTION %]"}; + holidays["[% HOLIDAYS_LOO.KEY %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"}; [% END %] [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %] - exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION %]"}; + exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"}; [% END %] [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %] - day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION %]"}; + day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"}; [% END %] /* This function gives css clases to each kind of day */ -- 1.7.1 From juan.sieira at xercode.es Thu Nov 24 19:02:05 2011 From: juan.sieira at xercode.es (Juan Romay Sieira) Date: Thu, 24 Nov 2011 19:02:05 +0100 Subject: [Koha-patches] [PATCH] Bug 7263 - Determine maximum length of some fields or subfields when cataloguing a biblio or an item. Message-ID: <1322157725-21098-1-git-send-email-juan.sieira@xercode.es> --- C4/Biblio.pm | 7 ++++- admin/marc_subfields_structure.pl | 11 ++++++-- cataloguing/addbiblio.pl | 25 +++++++------------ cataloguing/additem.pl | 3 +- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 15 ++++++++++++ .../en/modules/admin/marc_subfields_structure.tt | 3 +- .../modules/help/admin/marc_subfields_structure.tt | 10 ++++++++ 8 files changed, 52 insertions(+), 23 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 52119ea..715c052 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -958,7 +958,7 @@ sub GetMarcStructure { } $sth = $dbh->prepare( - "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue + "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength FROM marc_subfield_structure WHERE frameworkcode=? ORDER BY tagfield,tagsubfield @@ -977,10 +977,12 @@ sub GetMarcStructure { my $isurl; my $link; my $defaultvalue; + my $maxlength; while ( ( $tag, $subfield, $liblibrarian, $libopac, $tab, $mandatory, $repeatable, $authorised_value, - $authtypecode, $value_builder, $kohafield, $seealso, $hidden, $isurl, $link, $defaultvalue + $authtypecode, $value_builder, $kohafield, $seealso, $hidden, $isurl, $link, $defaultvalue, + $maxlength ) = $sth->fetchrow ) { @@ -997,6 +999,7 @@ sub GetMarcStructure { $res->{$tag}->{$subfield}->{isurl} = $isurl; $res->{$tag}->{$subfield}->{'link'} = $link; $res->{$tag}->{$subfield}->{defaultvalue} = $defaultvalue; + $res->{$tag}->{$subfield}->{maxlength} = $maxlength; } $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res; diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index 2c69733..f837644 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -179,6 +179,7 @@ if ( $op eq 'add_form' ) { while ( $data = $sth->fetchrow_hashref ) { my %row_data; # get a fresh hash for the row data $row_data{defaultvalue} = $data->{defaultvalue}; + $row_data{maxlength} = $data->{maxlength}; $row_data{tab} = CGI::scrolling_list( -name => 'tab', -id => "tab$i", @@ -386,11 +387,11 @@ elsif ( $op eq 'add_validate' ) { # values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" # ); my $sth_insert = $dbh->prepare(qq{ - insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode, link,defaultvalue) - values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode, link,defaultvalue,maxlength) + values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) }); my $sth_update = $dbh->prepare(qq{ - update marc_subfield_structure set tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, authtypecode=?, value_builder=?, hidden=?, isurl=?, frameworkcode=?, link=?, defaultvalue=? + update marc_subfield_structure set tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, authtypecode=?, value_builder=?, hidden=?, isurl=?, frameworkcode=?, link=?, defaultvalue=?, maxlength=? where tagfield=? and tagsubfield=? and frameworkcode=? }); my @tagsubfield = $input->param('tagsubfield'); @@ -405,6 +406,7 @@ elsif ( $op eq 'add_validate' ) { my @value_builder = $input->param('value_builder'); my @link = $input->param('link'); my @defaultvalue = $input->param('defaultvalue'); + my @maxlength = $input->param('maxlength'); for ( my $i = 0 ; $i <= $#tagsubfield ; $i++ ) { my $tagfield = $input->param('tagfield'); @@ -425,6 +427,7 @@ elsif ( $op eq 'add_validate' ) { my $isurl = $input->param("isurl$i") ? 1 : 0; my $link = $link[$i]; my $defaultvalue = $defaultvalue[$i]; + my $maxlength = $maxlength[$i]; if (defined($liblibrarian) && $liblibrarian ne "") { unless ( C4::Context->config('demo') eq 1 ) { @@ -447,6 +450,7 @@ elsif ( $op eq 'add_validate' ) { $frameworkcode, $link, $defaultvalue, + $maxlength, ( $tagfield, $tagsubfield, @@ -472,6 +476,7 @@ elsif ( $op eq 'add_validate' ) { $frameworkcode, $link, $defaultvalue, + $maxlength, ); } } diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 1a82989..bea2c2b 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -293,14 +293,6 @@ sub create_input { $value =~ s/"/"/g; - # determine maximum length; 9999 bytes per ISO 2709 except for leader and MARC21 008 - my $max_length = 9999; - if ($tag eq '000') { - $max_length = 24; - } elsif ($tag eq '008' and C4::Context->preference('marcflavour') eq 'MARC21') { - $max_length = 40; - } - # if there is no value provided but a default value in parameters, get it if ( $value eq '' ) { $value = $tagslib->{$tag}->{$subfield}->{defaultvalue}; @@ -335,6 +327,7 @@ sub create_input { index => $index_tag, id => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield, value => $value, + maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, random => CreateKey(), ); @@ -374,7 +367,7 @@ sub create_input { class=\"input_marceditor readonly\" tabindex=\"1\" size=\"5\" - maxlength=\"$max_length\" + maxlength=\"".$subfield_data{maxlength}."\" readonly=\"readonly\" \/>"; @@ -390,7 +383,7 @@ sub create_input { class=\"input_marceditor readonly\" tabindex=\"1\" size=\"67\" - maxlength=\"$max_length\" + maxlength=\"".$subfield_data{maxlength}."\" \/> {$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\">\"Tag @@ -404,7 +397,7 @@ sub create_input { class=\"input_marceditor readonly\" tabindex=\"1\" size=\"67\" - maxlength=\"$max_length\" + maxlength=\"".$subfield_data{maxlength}."\" readonly=\"readonly\" \/>{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\">\"Tag @@ -435,7 +428,7 @@ sub create_input { class=\"input_marceditor\" onfocus=\"Focus$function_name($index_tag)\" size=\"67\" - maxlength=\"$max_length\" + maxlength=\"".$subfield_data{maxlength}."\" onblur=\"Blur$function_name($index_tag); \" \/> \"Tag $javascript"; @@ -449,7 +442,7 @@ sub create_input { value=\"$value\" tabindex=\"1\" size=\"67\" - maxlength=\"$max_length\" + maxlength=\"".$subfield_data{maxlength}."\" class=\"input_marceditor\" \/> "; @@ -463,7 +456,7 @@ sub create_input { id=\"".$subfield_data{id}."\" name=\"".$subfield_data{id}."\" size=\"67\" - maxlength=\"$max_length\" + maxlength=\"".$subfield_data{maxlength}."\" value=\"$value\" \/> "; } @@ -475,7 +468,7 @@ sub create_input { class=\"input_marceditor\" tabindex=\"1\" size=\"67\" - maxlength=\"$max_length\" + maxlength=\"".$subfield_data{maxlength}."\" value=\"$value\" \/>"; @@ -510,7 +503,7 @@ sub create_input { value=\"$value\" tabindex=\"1\" size=\"67\" - maxlength=\"$max_length\" + maxlength=\"".$subfield_data{maxlength}."\" class=\"input_marceditor\" \/> "; diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 4442ed3..736ab03 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -119,6 +119,7 @@ sub generate_subfield_form { $subfield_data{marc_lib} ="{lib}."\">".$subfieldlib->{lib}.""; $subfield_data{mandatory} = $subfieldlib->{mandatory}; $subfield_data{repeatable} = $subfieldlib->{repeatable}; + $subfield_data{maxlength} = $subfieldlib->{maxlength}; $value =~ s/"/"/g; if ( ! defined( $value ) || $value eq '') { @@ -149,7 +150,7 @@ sub generate_subfield_form { my $input = new CGI; $value = $input->param('barcode'); } - my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" ); + my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" ); my $attributes = qq($attributes_no_value value="$value" ); if ( $subfieldlib->{authorised_value} ) { diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e4388a4..d68c009 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1195,6 +1195,7 @@ CREATE TABLE `marc_subfield_structure` ( `seealso` varchar(1100) default NULL, `link` varchar(80) default NULL, `defaultvalue` text default NULL, + `maxlength` int(4) NOT NULL DEFAULT '9999', PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`), KEY `kohafield_2` (`kohafield`), KEY `tab` (`frameworkcode`,`tab`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 815a71d..3603e0c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4550,6 +4550,21 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.06.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(" + ALTER TABLE `marc_subfield_structure` ADD `maxlength` INT( 4 ) NOT NULL DEFAULT '9999'; + "); + $dbh->do(" + UPDATE `marc_subfield_structure` SET maxlength=24 WHERE tagfield='000'; + "); + $dbh->do(" + UPDATE `marc_subfield_structure` SET maxlength=40 WHERE tagfield='008'; + "); + print "Upgrade to $DBversion done (Add new field maxlength to marc_subfield_structure)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt index 18c1db3..8ea6640 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt @@ -108,7 +108,8 @@ Advanced constraints:
      1. -
      2. (see online help)
      3. +
      4. (see online help)
      5. +
      6. (see online help)
      7. [% loo.isurl %] (if checked, it means that the subfield is a url and can be clicked)
      8. (e.g., Title or Local-Number) NOTE: If you change this value you must ask your administrator to run misc/batchRebuildBiblioTables.pl.
      9. [% loo.kohafield %]
      10. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc_subfields_structure.tt index 2a8801c..c9b6567 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc_subfields_structure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc_subfields_structure.tt @@ -83,6 +83,15 @@ To edit the subfields associated with the tag, click 'Subfields' to the right of + +
          +
        • Max length +
            +
          • Define the max characters to fill.
          • +
          +
        • +
        +
        • Is a url
            @@ -90,6 +99,7 @@ To edit the subfields associated with the tag, click 'Subfields' to the right of
        +
        • Link
            -- 1.7.1 From dpavlin at rot13.org Thu Nov 24 22:37:44 2011 From: dpavlin at rot13.org (Dobrica Pavlinusic) Date: Thu, 24 Nov 2011 22:37:44 +0100 Subject: [Koha-patches] [PATCH] Bug 6997: Koha-remove leaves system in inconsistent state Message-ID: <1322170664-30087-1-git-send-email-dpavlin@rot13.org> From: Jared Camins-Esakov If you accidentally delete one of the files that koha-remove is supposed to remove, when koha-remove reaches that point in the script, it will die, leaving later removal steps undone. This patch fixes the problem by checking for the existence of each file prior to deleting it, so that short of an actual problem with removing the file, the script can continue. Note that the fix for bug 6929 is also needed to prevent any problems with stopping Zebra from killing koha-remove. Signed-off-by: Dobrica Pavlinusic --- debian/scripts/koha-remove | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-) diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove index 10a8b78..b9e5c2a 100755 --- a/debian/scripts/koha-remove +++ b/debian/scripts/koha-remove @@ -31,17 +31,27 @@ FLUSH PRIVILEGES; eof koha-stop-zebra $name - rm "/etc/apache2/sites-available/$name" - rm "/etc/koha/sites/$name/koha-conf.xml" - rm "/etc/koha/sites/$name/zebra-biblios.cfg" - rm "/etc/koha/sites/$name/zebra-authorities.cfg" - rm "/etc/koha/sites/$name/zebra-authorities-dom.cfg" - rm "/etc/koha/sites/$name/zebra.passwd" - rmdir "/etc/koha/sites/$name" - rm -r "/var/lock/koha/$name" - rm -r "/var/log/koha/$name" - rm -r "/var/run/koha/$name" - deluser --quiet "$name-koha" + [ -f "/etc/apache2/sites-available/$name" ] && \ + rm "/etc/apache2/sites-available/$name" + [ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \ + rm "/etc/koha/sites/$name/koha-conf.xml" + [ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \ + rm "/etc/koha/sites/$name/zebra-biblios.cfg" + [ -f "/etc/koha/sites/$name/zebra-authorities.cfg" ] && \ + rm "/etc/koha/sites/$name/zebra-authorities.cfg" + [ -f "/etc/koha/sites/$name/zebra-authorities-dom.cfg" ] && \ + rm "/etc/koha/sites/$name/zebra-authorities-dom.cfg" + [ -f "/etc/koha/sites/$name/zebra.passwd" ] && \ + rm "/etc/koha/sites/$name/zebra.passwd" + [ -d "/etc/koha/sites/$name" ] && \ + rmdir "/etc/koha/sites/$name" + [ -d "/var/lock/koha/$name" ] && \ + rm -r "/var/lock/koha/$name" + [ -d "/var/log/koha/$name" ] && \ + rm -r "/var/log/koha/$name" + [ -d "/var/run/koha/$name" ] && \ + rm -r "/var/run/koha/$name" + getent passwd "$name-koha" > /dev/null && deluser --quiet "$name-koha" a2dissite "$name" done -- 1.7.2.5 From robin at catalyst.net.nz Fri Nov 25 02:00:33 2011 From: robin at catalyst.net.nz (Robin Sheat) Date: Fri, 25 Nov 2011 14:00:33 +1300 Subject: [Koha-patches] [PATCH] Bug 7262 - No calendar present in holidays module when there are quotes in title or description In-Reply-To: <1322154357-17924-1-git-send-email-juan.sieira@xercode.es> References: <1322154357-17924-1-git-send-email-juan.sieira@xercode.es> Message-ID: <1322182833.21393.16.camel@zarathud> Juan Romay Sieira schreef op do 24-11-2011 om 18:05 [+0100]: > - week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% > WEEK_DAYS_LOO.TITLE %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION % > ]"}; > + week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% > WEEK_DAYS_LOO.TITLE | replace('"','\"') %]", description:"[% > WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') %]"}; I'm not 100% sure, but would a better solution be to run it through '| html' or similar? -- Robin Sheat Catalyst IT Ltd. ? +64 4 803 2204 GPG: 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part URL: From srdjan at catalyst.net.nz Fri Nov 25 03:27:26 2011 From: srdjan at catalyst.net.nz (Srdjan Jankovic) Date: Fri, 25 Nov 2011 15:27:26 +1300 Subject: [Koha-patches] [PATCH] bug_6504: Reintroduced shipping costs In-Reply-To: References: Message-ID: <1322188046-4419-1-git-send-email-srdjan@catalyst.net.nz> Shipping cost are per parcel, not per item. Enter shipping costs when receiving orders. Display and take in account shipping costs on order and budget pages. Replaced GetBudgetSpent() and GetBudgetOrdered() with a subquery. --- C4/Acquisition.pm | 4 +- C4/Budgets.pm | 69 ++++++------------- acqui/acqui-home.pl | 2 - acqui/addorder.pl | 3 + acqui/basket.pl | 41 ++++++++---- acqui/neworderempty.pl | 1 + acqui/parcel.pl | 49 ++++++-------- .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 6 ++ .../prog/en/modules/acqui/neworderempty.tt | 6 ++ .../prog/en/modules/acqui/orderreceive.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 21 +++---- .../intranet-tmpl/prog/en/modules/acqui/parcels.tt | 5 +- 12 files changed, 102 insertions(+), 107 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 7127f24..37c250b 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -712,7 +712,8 @@ sub GetPendingOrders { my $strsth = " SELECT ".($grouped?"count(*),":"")."aqbasket.basketno, surname,firstname,aqorders.*,biblio.*,biblioitems.isbn, - aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname + aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname, + (SELECT count(*) FROM aqorders_items WHERE aqorders_items.ordernumber=aqorders.ordernumber) AS items FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber @@ -1266,6 +1267,7 @@ sub GetParcel { aqorders.listprice, aqorders.rrp, aqorders.ecost, + aqorders.freight, biblio.title FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 7c867e0..86dd2e6 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -39,8 +39,6 @@ BEGIN { &AddBudget &ModBudget &DelBudget - &GetBudgetSpent - &GetBudgetOrdered &GetPeriodsCount &GetChildBudgetsSpent @@ -300,38 +298,6 @@ sub ModBudgetPlan { } # ------------------------------------------------------------------- -sub GetBudgetSpent { - my ($budget_id) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare(qq| - SELECT SUM( COALESCE(unitprice, ecost) * quantity ) AS sum FROM aqorders - WHERE budget_id = ? AND - quantityreceived > 0 AND - datecancellationprinted IS NULL - |); - - $sth->execute($budget_id); - my $sum = $sth->fetchrow_array; - return $sum; -} - -# ------------------------------------------------------------------- -sub GetBudgetOrdered { - my ($budget_id) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare(qq| - SELECT SUM(ecost * quantity) AS sum FROM aqorders - WHERE budget_id = ? AND - quantityreceived = 0 AND - datecancellationprinted IS NULL - |); - - $sth->execute($budget_id); - my $sum = $sth->fetchrow_array; - return $sum; -} - -# ------------------------------------------------------------------- sub GetBudgetAuthCats { my ($budget_period_id) = shift; # now, populate the auth_cats_loop used in the budget planning button @@ -431,14 +397,27 @@ sub ModBudgetPeriod { } # ------------------------------------------------------------------- +my $AQORDERS_CUMULATIVE_SUBQUERY = < 0 THEN COALESCE(freight, 0) + ELSE 0 + END ) AS budget_spent, + SUM( CASE WHEN quantityreceived > 0 THEN 0 + ELSE ecost * quantity + COALESCE(freight, 0) + END ) AS budget_ordered, + budget_id +FROM aqorders GROUP BY budget_id +EOQ sub GetBudgetHierarchy { my ( $budget_period_id, $branchcode, $owner ) = @_; my @bind_params; my $dbh = C4::Context->dbh; my $query = qq| - SELECT aqbudgets.*, aqbudgetperiods.budget_period_active + SELECT aqbudgets.*, aqbudgetperiods.budget_period_active, aqord.budget_spent, aqord.budget_ordered FROM aqbudgets - JOIN aqbudgetperiods USING (budget_period_id)|; + JOIN aqbudgetperiods USING (budget_period_id) + LEFT OUTER JOIN ( $AQORDERS_CUMULATIVE_SUBQUERY ) aqord USING (budget_id) + |; my @where_strings; # show only period X if requested @@ -548,18 +527,12 @@ sub GetBudgetHierarchy { $moo =~ s/\ /\ \;/g; $r->{'budget_name_indent'} = $moo; - $r->{'budget_spent'} = GetBudgetSpent( $r->{'budget_id'} ); - $r->{'budget_amount_total'} = $r->{'budget_amount'}; - # foreach sub-levels - my $unalloc_count ; - foreach my $sub (@subs_arr) { my $sub_budget = GetBudget($sub); - $r->{budget_spent_sublevel} += GetBudgetSpent( $sub_budget->{'budget_id'} ); - $unalloc_count += $sub_budget->{'budget_amount'}; + $r->{budget_spent_sublevel} += $sub_budget->{'budget_spent'}; } } return \@sort; @@ -603,6 +576,7 @@ sub GetBudget { my $query = " SELECT * FROM aqbudgets + LEFT OUTER JOIN ( $AQORDERS_CUMULATIVE_SUBQUERY ) aqord USING (budget_id) WHERE budget_id=? "; my $sth = $dbh->prepare($query); @@ -626,14 +600,15 @@ sub GetChildBudgetsSpent { my $query = " SELECT * FROM aqbudgets - WHERE budget_parent_id=? + LEFT OUTER JOIN ( $AQORDERS_CUMULATIVE_SUBQUERY ) aqord USING (budget_id) + WHERE budget_id=? OR budget_parent_id=? "; my $sth = $dbh->prepare($query); - $sth->execute( $budget_id ); + $sth->execute( $budget_id, $budget_id, ); my $result = $sth->fetchall_arrayref({}); - my $total_spent = GetBudgetSpent($budget_id); + my $total_spent = 0; if ($result){ - $total_spent += GetChildBudgetsSpent($_->{"budget_id"}) foreach @$result; + $total_spent += $_->{"budget_spent"} foreach @$result; } return $total_spent; } diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 69482a8..96a747e 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -110,8 +110,6 @@ foreach my $budget ( @{$budget_arr} ) { $budget->{budget_amount} = 0; } - $budget->{'budget_ordered'} = GetBudgetOrdered( $budget->{'budget_id'} ); - $budget->{'budget_spent'} = GetBudgetSpent( $budget->{'budget_id'} ); if ( !defined $budget->{budget_spent} ) { $budget->{budget_spent} = 0; } diff --git a/acqui/addorder.pl b/acqui/addorder.pl index d7f7e96..bab1ea9 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -103,6 +103,8 @@ budget_id used to pay this order. =item C +=item C + =item C =item C @@ -174,6 +176,7 @@ $orderinfo->{'uncertainprice'} ||= 0; #my $gst = $input->param('GST'); #my $budget = $input->param('budget'); #my $cost = $input->param('cost'); +#my $freight = $input->param('freight'); #my $sub = $input->param('sub'); #my $purchaseorder = $input->param('purchaseordernumber'); #my $invoice = $input->param('invoice'); diff --git a/acqui/basket.pl b/acqui/basket.pl index b836280..d34c744 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -234,12 +234,15 @@ if ( $op eq 'delete_confirm' ) { my $total_rrp_gste; # RRP Total, GST excluded my $gist_rrp; my $total_rrp_est; + my $total_freight; + my $total_freight_gsti; # Freight Total, GST included + my $total_freight_gste; # Freight Total, GST excluded + my $gist_freight; my $qty_total; my @books_loop; for my $order ( @results ) { - my $rrp = $order->{'listprice'} || 0; my $qty = $order->{'quantity'} || 0; if (!defined $order->{quantityreceived}) { $order->{quantityreceived} = 0; @@ -251,10 +254,10 @@ if ( $op eq 'delete_confirm' ) { } my $budget = GetBudget( $order->{'budget_id'} ); - $rrp = ConvertCurrency( $order->{'currency'}, $rrp ); $total_rrp += $qty * $order->{'rrp'}; - my $line_total = $qty * $order->{'ecost'}; + $total_freight += $order->{'freight'} || 0; + my $line_total = $qty * $order->{'ecost'} + $order->{'freight'} || 0; $total_rrp_est += $qty * $order->{'ecost'}; # FIXME: what about the "actual cost" field? $qty_total += $qty; @@ -285,11 +288,12 @@ if ( $op eq 'delete_confirm' ) { $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); $line{holds} = $holds; $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; - $line{order_received} = ( $qty == $order->{'quantityreceived'} ); + $line{order_received} = ( $qty == $order->{quantityreceived} ); $line{basketno} = $basketno; $line{budget_name} = $budget->{budget_name}; - $line{rrp} = sprintf( "%.2f", $line{'rrp'} ); - $line{ecost} = sprintf( "%.2f", $line{'ecost'} ); + $line{rrp} = sprintf( "%.2f", $line{rrp} ); + $line{ecost} = sprintf( "%.2f", $line{ecost} ); + $line{freight} = sprintf( "%.2f", $line{freight} ); $line{line_total} = sprintf( "%.2f", $line_total ); if ($line{uncertainprice}) { $template->param( uncertainprices => 1 ); @@ -314,19 +318,26 @@ my $total_est_gste; $total_rrp_gsti = $total_rrp; # we know $total_rrp_gsti $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); # and can reverse compute other values $gist_rrp = $total_rrp_gsti - $total_rrp_gste; # - $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); - $total_est_gsti = $total_rrp_est; + $total_freight_gsti = $total_freight; + $total_freight_gste = $total_freight_gsti / ( $gist + 1 ); + $gist_freight = $total_freight_gsti - $total_freight_gste; # + $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ) + $total_freight_gste; + $total_est_gsti = $total_rrp_est + $total_freight_gsti; } else { # if prices does not include GST $total_rrp_gste = $total_rrp; # then we use the common way to compute other values $gist_rrp = $total_rrp_gste * $gist; # $total_rrp_gsti = $total_rrp_gste + $gist_rrp; # - $total_est_gste = $total_rrp_est; - $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); + $total_freight_gste = $total_freight; + $gist_freight = $total_freight_gste * $gist; + $total_freight_gsti = $total_freight_gste + $gist_freight; + $total_est_gste = $total_rrp_est + $total_freight_gste; + $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ) + $total_freight_gsti; } - $gist_est = $gist_rrp - ( $gist_rrp * $discount ); + $gist_est = $gist_rrp - ( $gist_rrp * $discount ) + $gist_freight; } else { $total_rrp_gsti = $total_rrp; - $total_est_gsti = $total_rrp_est; + $total_freight_gsti = $total_freight; + $total_est_gsti = $total_rrp_est + $total_freight_gsti; } my $contract = &GetContract($basket->{contractnumber}); @@ -361,13 +372,15 @@ my $total_est_gste; books_loop => \@books_loop, gist_rate => sprintf( "%.2f", $gist * 100 ) . '%', total_rrp_gste => sprintf( "%.2f", $total_rrp_gste ), + total_freight_gste => sprintf( "%.2f", $total_freight_gste ), total_est_gste => sprintf( "%.2f", $total_est_gste ), gist_est => sprintf( "%.2f", $gist_est ), gist_rrp => sprintf( "%.2f", $gist_rrp ), + gist_freight => sprintf( "%.2f", $gist_freight ), total_rrp_gsti => sprintf( "%.2f", $total_rrp_gsti ), + total_freight_gsti => sprintf( "%.2f", $total_freight_gsti ), total_est_gsti => sprintf( "%.2f", $total_est_gsti ), -# currency => $bookseller->{'listprice'}, - currency => $cur->{'currency'}, + currency => $cur->{'currency'}, qty_total => $qty_total, GST => $gist, basketgroups => $basketgroups, diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 459dfe8..f3cd048 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -384,6 +384,7 @@ $template->param( quantityrec => $data->{'quantity'}, rrp => $data->{'rrp'}, listprice => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice), + freight => sprintf("%.2f", $data->{'freight'}||0), total => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ), ecost => $data->{'ecost'}, unitprice => sprintf("%.2f", $data->{'unitprice'}), diff --git a/acqui/parcel.pl b/acqui/parcel.pl index c256c60..104ec80 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -166,39 +166,38 @@ my @loop_received = (); for (my $i = 0 ; $i < $countlines ; $i++) { #$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) - $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) + $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'} + $parcelitems[$i]->{'freight'}; $parcelitems[$i]->{'unitprice'} += 0; my %line; %line = %{ $parcelitems[$i] }; $line{invoice} = $invoice; $line{gst} = $gst; + $line{freight} = sprintf($cfstr, $line{freight}); $line{total} = sprintf($cfstr, $total); $line{supplierid} = $supplierid; push @loop_received, \%line; $totalprice += $parcelitems[$i]->{'unitprice'}; $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'}); - #double FIXME - totalfreight is redefined later. - -# FIXME - each order in a parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget.. - if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) { - warn "FREIGHT CHARGE MISMATCH!!"; - } - $totalfreight = $parcelitems[$i]->{'freight'}; + $totalfreight += $parcelitems[$i]->{'freight'}; $totalquantity += $parcelitems[$i]->{'quantityreceived'}; $tototal += $total; } my $pendingorders = GetPendingOrders($supplierid); -my $countpendings = scalar @$pendingorders; +my $countpendingitems = 0; +if ($pendingorders) { + $countpendingitems += $_->{items} || 1 foreach @$pendingorders; +} +my $freight_per_item = $freight && $countpendingitems ? $freight/$countpendingitems : 0; # pending orders totals my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd); my $ordergrandtotal; my @loop_orders = (); -for (my $i = 0 ; $i < $countpendings ; $i++) { - my %line; - %line = %{$pendingorders->[$i]}; +for (my $i = $startfrom; $i < $startfrom + $resultsperpage; $i++) { + last unless $pendingorders->[$i]; + my %line = %{$pendingorders->[$i]}; $line{quantity}+=0; $line{quantityreceived}+=0; @@ -210,11 +209,12 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $line{ecost} = sprintf("%.2f",$line{ecost}); $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); $line{unitprice} = sprintf("%.2f",$line{unitprice}); + $line{freight} = sprintf("%.2f",$line{freight}); $line{invoice} = $invoice; $line{gst} = $gst; $line{total} = $total; $line{supplierid} = $supplierid; - $ordergrandtotal += $line{ecost} * $line{quantity}; + $ordergrandtotal += $line{ecost} * $line{quantity} + $line{freight} || 0; my $biblionumber = $line{'biblionumber'}; my $countbiblio = CountBiblioInOrders($biblionumber); @@ -244,22 +244,20 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $line{holds} = $holds; $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; - - push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); + push @loop_orders, \%line; } -$freight = $totalfreight unless $freight; -my $count = $countpendings; +my $countpendings = $pendingorders ? scalar (@$pendingorders) : 0; -if ($count>$resultsperpage){ +if ($countpendings>$resultsperpage){ my $displaynext=0; my $displayprev=$startfrom; - if(($count - ($startfrom+$resultsperpage)) > 0 ) { + if(($countpendings - ($startfrom+$resultsperpage)) > 0 ) { $displaynext = 1; } my @numbers = (); - for (my $i=1; $i<$count/$resultsperpage+1; $i++) { + for (my $i=1; $i<$countpendings/$resultsperpage+1; $i++) { my $highlight=0; ($startfrom/$resultsperpage==($i-1)) && ($highlight=1); push @numbers, { number => $i, @@ -269,22 +267,19 @@ if ($count>$resultsperpage){ my $from = $startfrom*$resultsperpage+1; my $to; - if($count < (($startfrom+1)*$resultsperpage)){ - $to = $count; + if($countpendings < (($startfrom+1)*$resultsperpage)){ + $to = $countpendings; } else { $to = (($startfrom+1)*$resultsperpage); } $template->param(numbers=>\@numbers, displaynext=>$displaynext, displayprev=>$displayprev, - nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count), + nextstartfrom=>(($startfrom+$resultsperpage<$countpendings)?$startfrom+$resultsperpage:$countpendings), prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0) ); } -#$totalfreight=$freight; -$tototal = $tototal + $freight; - $template->param( invoice => $invoice, datereceived => $datereceived->output('iso'), @@ -300,7 +295,7 @@ $template->param( countpending => $countpendings, loop_orders => \@loop_orders, totalprice => sprintf($cfstr, $totalprice), - totalfreight => $totalfreight, + totalfreight => sprintf($cfstr, $totalfreight), totalquantity => $totalquantity, tototal => sprintf($cfstr, $tototal), ordergrandtotal => sprintf($cfstr, $ordergrandtotal), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index c0b62f2..d0bd241 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -203,6 +203,7 @@
    + [% IF ( active ) %] @@ -220,6 +221,7 @@ + [% IF ( active ) %] [% IF ( closedate ) %] @@ -234,6 +236,7 @@ + @@ -241,6 +244,7 @@ + [% ELSE %] @@ -249,6 +253,7 @@ + [% END %] @@ -269,6 +274,7 @@ + [% IF ( active ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 68c290a..cf8e019 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -464,6 +464,12 @@ $(document).ready(function() [% END %] + [% IF ( quantityrec ) %] +
  • + + +
  • + [% END %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 7147b19..ce41f6e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -82,7 +82,6 @@ -
    @@ -127,6 +126,7 @@ [% ELSE %] [% END %]
  • +
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index 45eb591..784767e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -213,6 +213,7 @@ + @@ -222,6 +223,7 @@ + @@ -245,6 +247,7 @@ + + @@ -318,18 +322,10 @@ + - - [% IF ( totalfreight ) %] - - - - - - [% END %] - [% IF ( gst ) %] + [% IF ( gst ) %] - [% END %] + [% END %] - + @@ -366,6 +362,7 @@ + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt index a7d704d..4478f34 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt @@ -96,11 +96,10 @@ [% END %] - +
  • Show Calendar -- 1.6.5 From Katrin.Fischer.83 at web.de Sun Nov 27 16:18:52 2011 From: Katrin.Fischer.83 at web.de (Katrin Fischer) Date: Sun, 27 Nov 2011 16:18:52 +0100 Subject: [Koha-patches] [PATCH] Bug 5974: Fix broken toolbar on paton checkout tab Message-ID: <1322407132-6627-1-git-send-email-Katrin.Fischer.83@web.de> Fixed a couple of errors: - [% CAN_user_staffaccess %] should be [% IF ( CAN_user_staffaccess ) %] - added missing [% END %] - added missing line new YAHOO.widget.Button("duplicate"); To test: 1) Open patron account 2) Go through tabs, especially 'Check out' 3) Check toolbars are correct and buttons work --- .../prog/en/includes/circ-toolbar.inc | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc index 2933544..913076f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc @@ -94,6 +94,7 @@ function update_child() { new YAHOO.widget.Button("editpatron"); new YAHOO.widget.Button("addnote"); [% IF CAN_user_staffaccess %] new YAHOO.widget.Button("changepassword"); [% END %] + new YAHOO.widget.Button("duplicate"); new YAHOO.widget.Button("printslip"); new YAHOO.widget.Button("printpage"); } @@ -117,9 +118,10 @@ function update_child() { [% END %] [% END %] [% IF ( CAN_user_borrowers ) %] - [% IF ( adultborrower ) %]
  • Add child
  • [% END %] - [% CAN_user_staffaccess %]
  • Change Password
  • [% END %] -
  • Duplicate
  • + [% IF ( adultborrower ) %]
  • Add child
  • [% END %] + [% IF ( CAN_user_staffaccess ) %]
  • Change Password
  • [% END %] + [% END %] +
  • Duplicate
  • Print Page
  • Print Slip
  • Search to hold
  • -- 1.7.5.4 From M.de.Rooy at rijksmuseum.nl Mon Nov 28 14:04:53 2011 From: M.de.Rooy at rijksmuseum.nl (Marcel de Rooy) Date: Mon, 28 Nov 2011 13:04:53 +0000 Subject: [Koha-patches] [PATCH] Bug 7270: Removing double itemtype on shelve contents page Message-ID: <809BE39CD64BFD4EB9036172EBCCFA3137A0E5@S-MAIL-1B.rijksmuseum.intra> Patch initializes template variable noItemTypeImages now. Corrects the template so that description is not listed twice. --- .../prog/en/modules/virtualshelves/shelves.tt | 2 +- virtualshelves/shelves.pl | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index d7a34a1..09a40bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -194,7 +194,7 @@ function placeHold () { [% END %] [% UNLESS ( item_level_itypes ) %][% END %]
    RRP Est. Qty.Shipping Total Fund[% total_rrp_gste %]   [% qty_total %][% total_freight_gste %] [% total_est_gste %][% gist_rrp %]    [% gist_freight %] [% gist_est %]
    [% total_rrp_gsti %]   [% qty_total %][% total_freight_gsti %] [% total_est_gsti %]
    [% total_rrp_gsti %]   [% qty_total %][% total_freight_gsti %] [% total_est_gsti %]
    [% books_loo.rrp %] [% books_loo.ecost %] [% books_loo.quantity %][% books_loo.freight %] [% books_loo.line_total %] [% books_loo.budget_name %] View Record Quantity Unit costShipping Order cost    
    TOTAL [% totalPquantity %]    [% ordergrandtotal %]    MARC | Card [% loop_order.quantity %] [% loop_order.ecost %][% loop_order.freight %] [% loop_order.ordertotal %] Receive @@ -310,6 +313,7 @@ Quantity Est cost Actual costShipping TOTAL
    SUBTOTAL   [% totalprice %][% totalfreight %] [% tototal %]
      - Shipping[% totalfreight %]

    @@ -340,11 +336,11 @@

    Tax rate [% gst %]
    TOTAL [% totalquantity %]   [% grandtot %]
    [% loop_receive.quantityreceived %] [% loop_receive.ecost %] [% loop_receive.unitprice %][% loop_receive.freight %] [% loop_receive.total %]
    - [% UNLESS ( noItemTypeImages ) %][% itemsloo.description %][% END %][% itemsloo.description %] + [% UNLESS ( noItemTypeImages ) %][% itemsloo.description %][% ELSE %][% itemsloo.description %][% END %] [% INCLUDE 'biblio-default-view.inc' biblionumber = itemsloo.biblionumber %] diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index 0b208a9..62e1bb4 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -35,4 +35,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( flagsrequired => { catalogue => 1 }, } ); +$template->param( + noItemTypeImages => C4::Context->preference('noItemTypeImages'), +); shelfpage('intranet', $query, $template, $loggedinuser, $cookie); -- 1.6.0.6 From mglavica at ffzg.hr Thu Nov 24 16:17:41 2011 From: mglavica at ffzg.hr (Marijana Glavica) Date: Thu, 24 Nov 2011 16:17:41 +0100 Subject: [Koha-patches] [PATCH] Bug 6022: Auth_with_ldap check if categorycode is valid Message-ID: <1322147861-3287-1-git-send-email-mglavica@ffzg.hr> From: Dobrica Pavlinusic When importing users from LDAP, Auth_with_ldap.pm doesn't check if value for categorycode is present in categories table in Koha resulting in referential integrity error instead of using default value from koha-conf.xml Test scenario: 1. enable LDAP in koha-conf.xml using 1 and add configuration with DefaultCategoryCode 2. select/create LDAP user with category in SomeLDAPField which isn't in Koha 3. try logging in and ensure that assigned category to new user is DefaultCategoryCode Signed-off-by: Marijana Glavica --- C4/Auth_with_ldap.pm | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 7f56d9c..6ecf509 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -228,6 +228,17 @@ sub ldap_entry_2_hash ($$) { ( substr($borrower{'firstname'},0,1) . substr($borrower{ 'surname' },0,1) . " "); + + # check if categorycode exists, if not, fallback to default from koha-conf.xml + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?"); + $sth->execute( uc($borrower{'categorycode'}) ); + unless ( my $row = $sth->fetchrow_hashref ) { + my $default = $mapping{'categorycode'}->{content}; + $debug && warn "Can't find ", $borrower{'categorycode'}, " default to: $default for ", $borrower{userid}; + $borrower{'categorycode'} = $default + } + return %borrower; } -- 1.7.2.5 From oleonard at myacpl.org Mon Nov 28 18:59:49 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Mon, 28 Nov 2011 12:59:49 -0500 Subject: [Koha-patches] [PATCH] Bug 1623 - Provide view of approved comments Message-ID: <1322503189-19254-1-git-send-email-oleonard@myacpl.org> This patch creates two tabs on the comments administration page: one for approved comments and one for unapproved comments. Each display is paginated according to the numSearchResults preference. The list of approved comments has, instead of a link to approve, a link to unapprove. The JavaScript table sorter has been removed since it doesn't make sense to sort individual pages of a multi-page result set. --- C4/Review.pm | 23 ++++++++++++- .../prog/en/modules/reviews/reviewswaiting.tt | 35 ++++++++----------- reviews/reviewswaiting.pl | 17 ++++++++- 3 files changed, 51 insertions(+), 24 deletions(-) diff --git a/C4/Review.pm b/C4/Review.pm index f94dbc8..3009b34 100644 --- a/C4/Review.pm +++ b/C4/Review.pm @@ -30,7 +30,7 @@ BEGIN { require Exporter; @ISA = qw(Exporter); @EXPORT = qw(getreview savereview updatereview numberofreviews numberofreviewsbybiblionumber - getreviews getallreviews approvereview deletereview); + getreviews getallreviews approvereview unapprovereview deletereview); } =head1 NAME @@ -91,11 +91,12 @@ sub updatereview { } sub numberofreviews { + my ($status) = @_; my $dbh = C4::Context->dbh; my $query = "SELECT count(*) FROM reviews WHERE approved=?"; my $sth = $dbh->prepare($query); - $sth->execute( 1 ); + $sth->execute( $status ); return $sth->fetchrow; } @@ -148,6 +149,24 @@ sub approvereview { $sth->execute( 1, $reviewid ); } +=head2 unapprovereview + + unapprovereview($reviewid); + +Takes a reviewid and marks that review as not approved + +=cut + +sub unapprovereview { + my ($reviewid) = @_; + my $dbh = C4::Context->dbh(); + my $query = "UPDATE reviews + SET approved=? + WHERE reviewid=?"; + my $sth = $dbh->prepare($query); + $sth->execute( 0, $reviewid ); +} + =head2 deletereview deletereview($reviewid); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt index 3d7bb22..a1dabbd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt @@ -1,29 +1,13 @@ [% INCLUDE 'doc-head-open.inc' %] -Koha › Tools › Comments waiting for Approval +Koha › Tools › Comments › [% IF ( status ) %] Approved comments[% ELSE %] Comments awaiting moderation[% END %] [% INCLUDE 'doc-head-close.inc' %] - - [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] +› Comments ›[% IF ( status ) %] Approved comments[% ELSE %] Comments awaiting moderation[% END %]
    @@ -33,6 +17,14 @@ $.tablesorter.addParser({

    Comments

    + +
    + +
    + [% IF ( reviews ) %] @@ -61,15 +53,18 @@ $.tablesorter.addParser({ [% review.review |html %] [% END %]
    - Approve | + [% IF ( status ) %]Unapprove[% ELSE %]Approve[% END %] | Delete
    +
    [% pagination_bar %]
    [% ELSE %] -No comments to moderate +[% IF ( status ) %]

    No comments have been approved.

    [% ELSE %]

    No comments to moderate.

    [% END %] [% END %] +
    +
    diff --git a/reviews/reviewswaiting.pl b/reviews/reviewswaiting.pl index 4d28a96..7107216 100755 --- a/reviews/reviewswaiting.pl +++ b/reviews/reviewswaiting.pl @@ -39,16 +39,23 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); my $op = $query->param('op') || ''; +my $status = $query->param('status') || 0; my $reviewid = $query->param('reviewid'); +my $offset = $query->param('offset') || 0; +my $count = C4::Context->preference('numSearchResults') || 20; +my $total = numberofreviews($status); if ( $op eq 'approve' ) { approvereview($reviewid); } +elsif ( $op eq 'unapprove' ) { + unapprovereview($reviewid); +} elsif ( $op eq 'delete' ) { deletereview($reviewid); } -my $reviews = getallreviews(0); +my $reviews = getallreviews($status,$offset,$count); foreach ( @$reviews ) { my $borrowernumber = $_->{borrowernumber}; @@ -60,6 +67,12 @@ foreach ( @$reviews ) { $_->{firstname} = $borrowerData->{'firstname'}; } -$template->param( reviews => $reviews ); +my $url = "/cgi-bin/koha/reviews/reviewswaiting.pl?status=$status"; + +$template->param( + status => $status, + reviews => $reviews, + pagination_bar => pagination_bar( $url, ( int( $total / $count ) ) + ( ( $total % $count ) > 0 ? 1 : 0 ), $offset, "offset" ) +); output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.3 From Katrin.Fischer.83 at web.de Mon Nov 28 21:01:06 2011 From: Katrin.Fischer.83 at web.de (Katrin Fischer) Date: Mon, 28 Nov 2011 21:01:06 +0100 Subject: [Koha-patches] [PATCH] Bug 5369: se queries with paranthesis fail Message-ID: <1322510466-5172-1-git-send-email-Katrin.Fischer.83@web.de> This patch does several things to make the search work better: 1) Adding "" around search terms for queries on index se. 2) Make links for 8xx obey the UseControlNumber system preference 3) Fix the indexing for 8xx fields, as they were not included in the se index before Note: Make sure you copy the new record.abs into your koha-dev directory and reindex before testing. To test: 1) Add records using the following fields: 440$a 490$a ind. 1 = empty or 0 490$a ind. 1 = 1 800$a, 810$a, 811$a or 830$a Example value taken form bug description, should only work after applying the patch: DHEW publication no. (HSM) 73-1804 Please also test with other examples. --- etc/zebradb/marc_defs/marc21/biblios/record.abs | 16 ++++++++-------- .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 12 ++++++------ .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/etc/zebradb/marc_defs/marc21/biblios/record.abs b/etc/zebradb/marc_defs/marc21/biblios/record.abs index 92467ab..6983230 100755 --- a/etc/zebradb/marc_defs/marc21/biblios/record.abs +++ b/etc/zebradb/marc_defs/marc21/biblios/record.abs @@ -241,27 +241,27 @@ melm 785$w Record-control-number melm 785 Title,Title:p,Title-later,Related-periodical melm 787$w Record-control-number -melm 800$a Name-and-title +melm 800$a Name-and-title,Title-series:w,Title-series:p #melm 800$t author,Author-title,Name-and-title,Title,Title-series -melm 800$t Author-title,Name-and-title,Title,Title-series +melm 800$t Author-title,Name-and-title,Title,Title-series:w,Title-series:p melm 800$9 Koha-Auth-Number melm 800$w Record-control-number melm 800 Author,Author-name-personal,Name,Personal-name -melm 810$a Name-and-title -melm 810$t Author-title,Name-and-title,Title,Title-series +melm 810$a Name-and-title,Title-series:w,Title-series:p +melm 810$t Author-title,Name-and-title,Title,Title-series:w,Title-series:p melm 810$w Record-control-number melm 810$9 Koha-Auth-Number melm 810 Author,Corporate-name,Author-name-corporate,Name -melm 811$a Name-and-title +melm 811$a Name-and-title,Title-series:w,Title-series:p melm 811$9 Koha-Auth-Number #melm 811$t author,Author-title,Name-and-title,Title,Title-series -melm 811$t Author-title,Name-and-title,Title,Title-series +melm 811$t Author-title,Name-and-title,Title,Title-series:w,Title-series:p melm 811$w Record-control-number melm 811 Author,Author-name-corporate,Name,Conference-name melm 830$w Record-control-number melm 830$9 Koha-Auth-Number -melm 830 Title,Title-series -melm 840 Title,Title-series +melm 830 Title,Title-series:w,Title-series:p +melm 840 Title,Title-series:w,Title-series:p ############################### # Koha Local-Use Biblio Indexes diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl index b0de609..b84db99 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -152,7 +152,7 @@ Series: - + /cgi-bin/koha/catalogue/search.pl?q=se:" @@ -167,7 +167,7 @@ - + /cgi-bin/koha/catalogue/search.pl?q=se:" @@ -183,23 +183,23 @@ - + - at + a_t - + /cgi-bin/koha/catalogue/search.pl?q=se:"" - at + a_t diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index e16db73..3fdcb19 100755 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -210,7 +210,7 @@ Series: - + /cgi-bin/koha/opac-search.pl?q=se:" @@ -225,7 +225,7 @@ - + /cgi-bin/koha/opac-search.pl?q=se:" @@ -241,7 +241,7 @@ - + @@ -253,7 +253,7 @@ - + /cgi-bin/koha/opac-search.pl?q=se:"" -- 1.7.5.4 From juan.sieira at xercode.es Tue Nov 29 10:21:16 2011 From: juan.sieira at xercode.es (Juan Romay Sieira) Date: Tue, 29 Nov 2011 10:21:16 +0100 Subject: [Koha-patches] [PATCH] Bug 7275 - Pagination lost when click in the option "Show more" of facets column Message-ID: <1322558476-5305-1-git-send-email-juan.sieira@xercode.es> --- .../intranet-tmpl/prog/en/includes/facets.inc | 2 +- .../prog/en/modules/catalogue/results.tt | 2 +- .../opac-tmpl/prog/en/includes/opac-facets.inc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc index 7647755..a72b586 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc @@ -18,7 +18,7 @@ [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 2bed51c..6ed3506 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -404,7 +404,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () { [% END %] [% IF ( facets_loo.expandable ) %]
  • - + Show More
  • diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc index 4e6c935..ccb37b0 100755 --- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc @@ -19,7 +19,7 @@ [% END %] [% END %] -- 1.7.1 From stephane.delaune at biblibre.com Tue Nov 29 11:34:10 2011 From: stephane.delaune at biblibre.com (=?UTF-8?q?St=C3=A9phane=20Delaune?=) Date: Tue, 29 Nov 2011 11:34:10 +0100 Subject: [Koha-patches] [PATCH] member entry Performance improvement Message-ID: <1322562850-4957-1-git-send-email-stephane.delaune@biblibre.com> From: Henri-Damien LAURENT Before this patch : 9619 borrowers added in 31 Minutes, After : 68 seconds. This adds Hashref to table structure in C4::SQLHelper to speed up bulk edits. Signed-off-by: St?phane Delaune --- C4/SQLHelper.pm | 39 +++++++++++++++++++++++++++++++++------ 1 files changed, 33 insertions(+), 6 deletions(-) diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm index cf425fd..900e40d 100644 --- a/C4/SQLHelper.pm +++ b/C4/SQLHelper.pm @@ -27,6 +27,22 @@ use C4::Debug; require Exporter; use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); +eval { + my $servers = C4::Context->config('memcached_servers'); + if ($servers) { + require Memoize::Memcached; + import Memoize::Memcached qw(memoize_memcached); + + my $memcached = { + servers => [$servers], + key_prefix => C4::Context->config('memcached_namespace') || 'koha', + }; + + memoize_memcached( '_get_columns', memcached => $memcached, expire_time => 600000 ); #cache for 10 minutes + memoize_memcached( 'GetPrimaryKeys', memcached => $memcached, expire_time => 600000 ); #cache for 10 minutes + } +}; + BEGIN { # set the version for version checking $VERSION = 0.5; @@ -43,6 +59,9 @@ BEGIN { ); } +my $tablename; +my $hashref; + =head1 NAME C4::SQLHelper - Perl Module containing convenience functions for SQL Handling @@ -247,16 +266,24 @@ With =cut sub _get_columns($) { - my ($tablename)=@_; - my $dbh=C4::Context->dbh; - my $sth=$dbh->prepare_cached(qq{SHOW COLUMNS FROM $tablename }); - $sth->execute; - my $columns= $sth->fetchall_hashref(qw(Field)); + my ($tablename) = @_; + unless ( exists( $hashref->{$tablename} ) ) { + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare_cached(qq{SHOW COLUMNS FROM $tablename }); + $sth->execute; + my $columns = $sth->fetchall_hashref(qw(Field)); + $hashref->{$tablename} = $columns; + } + return $hashref->{$tablename}; } =head2 _filter_columns - _filter_columns($tablename,$research, $filtercolumns) +=over 4 + +_filter_columns($tablename,$research, $filtercolumns) + +=back Given - a tablename -- 1.7.0.4 From jcamins at cpbibliography.com Tue Nov 29 13:10:34 2011 From: jcamins at cpbibliography.com (Jared Camins-Esakov) Date: Tue, 29 Nov 2011 07:10:34 -0500 Subject: [Koha-patches] [Koha] Barcode generation in koha 2.2.9 Windows Version In-Reply-To: <1322551960.90561.YahooMailNeo@web137308.mail.in.yahoo.com> References: <1322481105.78563.YahooMailNeo@web137316.mail.in.yahoo.com> <1322551960.90561.YahooMailNeo@web137308.mail.in.yahoo.com> Message-ID: Dilip, Please respond to the list. I cannot respond to personal messages in the future. You will need to migrate to a recent version of Koha, or make do without support. Regards, Jared On Tue, Nov 29, 2011 at 2:32 AM, Dilip Vala wrote: > Dear Sir, > Thanks for the prompt reply. > I'm not familiar with Linux and I had already installed Koha 2.2.9 in > Windows and I'm at completion of 15000 records entry. > I'm using normal PC as Koha server. > Kindly suggest. > Dilip > ------------------------------ > *From:* Jared Camins-Esakov > *To:* Dilip Vala > *Cc:* "koha at lists.katipo.co.nz" > *Sent:* Tuesday, 29 November 2011 12:52 AM > *Subject:* Re: [Koha] Barcode generation in koha 2.2.9 Windows Version > > Dilip, > > Koha 2.2.9 is a very old version, and no one supports it anymore. You'd > probably be much better off upgrading to a more recent version, and using a > Linux server. The latest stable version is 3.6.0. Good luck. > > Regards, > Jared > > 2011/11/28 Dilip Vala > > Dear Sir, > Kindly inform me Barcode generation in koha 2.2.9 Windows Version. > Thanks > > Dilip > > _______________________________________________ > Koha mailing list http://koha-community.org > Koha at lists.katipo.co.nz > http://lists.katipo.co.nz/mailman/listinfo/koha > > > > > -- > Jared Camins-Esakov > Bibliographer, C & P Bibliography Services, LLC > (phone) +1 (917) 727-3445 > (e-mail) jcamins at cpbibliography.com > (web) http://www.cpbibliography.com/ > > > > -- Jared Camins-Esakov Bibliographer, C & P Bibliography Services, LLC (phone) +1 (917) 727-3445 (e-mail) jcamins at cpbibliography.com (web) http://www.cpbibliography.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From Katrin.Fischer.83 at web.de Wed Nov 30 08:16:57 2011 From: Katrin.Fischer.83 at web.de (Katrin Fischer) Date: Wed, 30 Nov 2011 08:16:57 +0100 Subject: [Koha-patches] [PATCH] Bug 6935: Correct XISBNDailyLimit for new installations Message-ID: <1322637417-8323-1-git-send-email-Katrin.Fischer.83@web.de> This corrects the value of XISBNDailyLimit in the system preferences installation file to 999 instead of 499. The file was missed in an earlier update, so new installations have different values than older installations that were updated. Another patch with a database update is needed. Sending this patch first, until it's clear how database updates will work for 3.8. To test: 1) Recreate your database from scratch 2) Check your system preference XISBNDailyLimit shows 999 instead of 499, matching the description of the system preference. --- installer/data/mysql/sysprefs.sql | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ae2c1cb..128c9b2 100755 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -135,7 +135,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFRBRizeEditions',0,'If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('XISBN',0,'Use with FRBRizeEditions. If ON, Koha will use the OCLC xISBN web service in the Editions tab on the detail pages. See: http://www.worldcat.org/affiliate/webservices/xisbn/app.jsp','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OCLCAffiliateID','','Use with FRBRizeEditions and XISBN. You can sign up for an AffiliateID here: http://www.worldcat.org/wcpa/do/AffiliateUserServices?method=initSelfRegister','','free'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('XISBNDailyLimit',499,'The xISBN Web service is free for non-commercial use when usage does not exceed 500 requests per day','','Integer'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('XISBNDailyLimit',999,'The xISBN Web service is free for non-commercial use when usage does not exceed 1000 requests per day','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ThingISBN',0,'Use with FRBRizeEditions. If ON, Koha will use the ThingISBN web service in the Editions tab on the detail pages.','','YesNo'); -- I18N/L10N -- 1.7.5.4 From oleonard at myacpl.org Wed Nov 30 18:52:46 2011 From: oleonard at myacpl.org (Owen Leonard) Date: Wed, 30 Nov 2011 12:52:46 -0500 Subject: [Koha-patches] [PATCH] Bug 7280 - can't place hold without selecting on list Message-ID: <1322675566-3340-1-git-send-email-oleonard@myacpl.org> JavaScript was looking for clicks on links with class "hold," and incorrectly triggering the check for checked checkboxes. Making the selection stricter lets the JS function as it should while allowing people to place individual holds directly. --- .../opac-tmpl/prog/en/modules/opac-shelves.tt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt index 528b8a7..709a444 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt @@ -70,7 +70,7 @@ $(function() { $("a.print").show(); [% IF ( opacuserlogin ) %][% IF ( RequestOnOpac ) %]$("#placehold").html(""+_('Place Hold')+"<\/a>"); - $("a.hold").click(function(){ + $("#toolbar a.hold").click(function(){ holdSelections(); return false; });[% END %][% END %] -- 1.7.3