From b8e9829be5a59c84ba699fc015820cd4eb3fbc0a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 2 Dec 2011 14:03:50 +0100 Subject: [PATCH] Bug 5347: Adds columns claims_count and claimed_date in aqorders This patch adds 2 columns in the aqorders table : - claims_count : number of claims for an orders - claimed_date : date of the lastest claim In the lateorders.pl table, you can not select orders from different supplier because there is just one letter sent after clicking the "Claim order" button. So, it's logic that you want to select only orders from this supplier. Modification in C4/Letters.pm: refactoring code for claimacquisition and claimissues letter type. Now, fields for theses letters check the table name. It's not possible to chooce aqorders.title, this field doesn't exist ! Furthermore, you can add a tag around your item fields, like this : -- Begin example <> <> <> <> <> <> <> Library : <> In your possesssion : <>. <>. <>, <>. Callnumber : <>. doc type : <> Barcode : <> Date for the return : <>. <> -- End example Signed-off-by: Katrin Fischer --- C4/Acquisition.pm | 31 +++ C4/Letters.pm | 198 +++++++----------- acqui/lateorders.pl | 19 +- .../mysql/de-DE/mandatory/sample_notices.sql | 2 +- .../mysql/en/mandatory/sample_notices.sql | 2 +- .../mysql/es-ES/mandatory/sample_notices.sql | 2 +- .../fr-FR/1-Obligatoire/sample_notices.sql | 2 +- .../data/mysql/it-IT/necessari/notices.sql | 2 +- installer/data/mysql/kohastructure.sql | 2 + .../nb-NO/1-Obligatorisk/sample_notices.sql | 2 +- .../mysql/pl-PL/mandatory/sample_notices.sql | 2 +- .../mysql/ru-RU/mandatory/sample_notices.sql | 2 +- .../mysql/ru-RU/optional/sample_notices.sql | 2 +- .../mysql/uk-UA/mandatory/sample_notices.sql | 2 +- .../mysql/uk-UA/optional/sample_notices.sql | 2 +- installer/data/mysql/updatedatabase.pl | 6 + .../prog/en/css/staff-global.css | 7 + .../prog/en/modules/acqui/lateorders.tt | 41 +++- tools/letter.pl | 2 +- 19 files changed, 192 insertions(+), 136 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 2814977575..5cf88ec089 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -62,6 +62,8 @@ BEGIN { &GetContracts &GetContract &GetItemnumbersFromOrder + + &AddClaim ); } @@ -1453,9 +1455,12 @@ sub GetLateOrders { DATE(aqbasket.closedate) AS orderdate, aqorders.rrp AS unitpricesupplier, aqorders.ecost AS unitpricelib, + aqorders.claims_count AS claims_count, + aqorders.claimed_date AS claimed_date, aqbudgets.budget_name AS budget, borrowers.branchcode AS branch, aqbooksellers.name AS supplier, + aqbooksellers.id AS supplierid, biblio.author, biblio.title, biblioitems.publishercode AS publisher, biblioitems.publicationyear, @@ -1517,6 +1522,7 @@ sub GetLateOrders { my @results; while (my $data = $sth->fetchrow_hashref) { $data->{orderdate} = format_date($data->{orderdate}); + $data->{claimed_date} = format_date($data->{claimed_date}); push @results, $data; } return @results; @@ -1779,6 +1785,31 @@ sub GetContract { return $result; } +=head3 AddClaim + +=over 4 + +&AddClaim($ordernumber); + +Add a claim for an order + +=back + +=cut +sub AddClaim { + my ($ordernumber) = @_; + my $dbh = C4::Context->dbh; + my $query = " + UPDATE aqorders SET + claims_count = claims_count + 1, + claimed_date = CURDATE() + WHERE ordernumber = ? + "; + my $sth = $dbh->prepare($query); + $sth->execute($ordernumber); + +} + 1; __END__ diff --git a/C4/Letters.pm b/C4/Letters.pm index 2420e4a0ec..205064242d 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -243,6 +243,7 @@ sub findrelatedto ($$) { sub SendAlerts { my ( $type, $externalid, $letter ) = @_; my $dbh = C4::Context->dbh; + my $strsth; if ( $type eq 'issue' ) { # warn "sending issues..."; @@ -290,99 +291,56 @@ sub SendAlerts { ); 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 ); + $letter = getletter( 'claimacquisition', $letter ); # prepare the letter... # search the biblionumber - my $strsth = -"select aqorders.*,aqbasket.*,biblio.*,biblioitems.* from aqorders LEFT JOIN aqbasket on aqbasket.basketno=aqorders.basketno LEFT JOIN biblio on aqorders.biblionumber=biblio.biblionumber LEFT JOIN biblioitems on aqorders.biblioitemnumber=biblioitems.biblioitemnumber where aqorders.ordernumber IN (" - . join( ",", @$externalid ) . ")"; - 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/; - } - } - $letter->{content} =~ s/<<[^>]*>>//g; - my $innerletter = $letter; - - # ... 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; - } - if ( C4::Context->preference("LetterLog") ) { - logaction( - "ACQUISITION", - "Send Acquisition claim letter", - "", - "order list : " - . join( ",", @$externalid ) - . "\n$innerletter->{title}\n$innerletter->{content}" - ); + $strsth = qq{ + SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*,aqbooksellers.* + FROM aqorders + LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno + LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber + LEFT JOIN biblioitems ON aqorders.biblioitemnumber=biblioitems.biblioitemnumber + LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id + WHERE aqorders.ordernumber IN ( } + . join( ",", @$externalid ) . ")"; } elsif ( $type eq 'claimissues' ) { - # warn "sending issues..."; - my $letter = getletter( 'claimissues', $letter ); + $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 (" + $strsth = qq{ + SELECT serial.*,subscription.*, biblio.*, aqbooksellers.* + FROM serial + LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid + LEFT JOIN biblio ON serial.biblionumber=biblio.biblionumber + LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id + WHERE serial.serialid IN ( + } . join( ",", @$externalid ) . ")"; + } + + if ( $type eq 'claimacquisition' or $type eq 'claimissues' ) { my $sthorders = $dbh->prepare($strsth); $sthorders->execute; - my $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; + my @fields = map { + $sthorders->{mysql_table}[$_] . "." . $sthorders->{NAME}[$_] } + (0 .. $#{$sthorders->{NAME}} ) ; + + my @orders_infos; + while ( my $row = $sthorders->fetchrow_arrayref() ) { + my %rec = (); + @rec{@fields} = @$row; + push @orders_infos, \%rec; + } # parsing branch info my $userenv = C4::Context->userenv; @@ -391,59 +349,65 @@ sub SendAlerts { # 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/<>/$userenv->{emailaddress}/g; + + # Get Fields remplacement + my $order_format = $1 if ( $letter->{content} =~ m/(.*<\/order>)/xms ); + + # Foreach field to remplace + while ( $letter->{content} =~ m/<<([^>]*)>>/g ) { + my $field = $1; + my $value = $orders_infos[0]->{$field} || ""; + $value = sprintf("%.2f", $value) if $field =~ /price/; + $letter->{content} =~ s/<<$field>>/$value/g; + } + + if ( $order_format ) { + # For each order + foreach my $infos ( @orders_infos ) { + my $order_content = $order_format; + # We replace by value + while ( $order_content =~ m/<<([^>]*)>>/g ) { + my $field = $1; + my $value = $infos->{$field} || ""; + $value = sprintf("%.2f", $value) if $field =~ /price/; + $order_content =~ s/(<<$field>>)/$value/g; } - $letter->{content} =~ s/(<<.*>>)/$line\n$1/; + $order_content =~ s/<\/{0,1}?order>//g; + $letter->{content} =~ s/.*<\/order>/$order_content\n$order_format/xms; } + $letter->{content} =~ s/.*<\/order>//xms; } - $letter->{content} =~ s/<<[^>]*>>//g; + my $innerletter = $letter; # ... 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{}; - + if ( $orders_infos[0]->{'aqbooksellers.bookselleremail'} + || $orders_infos[0]->{'aqbooksellers.contemail'} ) { + my $to = $orders_infos[0]->{'aqbooksellers.bookselleremail'}; + $to .= ", " if $to; + $to .= $orders_infos[0]->{'aqbooksellers.contemail'} || ""; my %mail = ( - To => $mail_to, - From => $userenv->{emailaddress}, - Subject => $mail_subj, - Message => $mail_msg, + To => $to, + From => $userenv->{emailaddress}, + Subject => "" . $innerletter->{title}, + Message => "" . $innerletter->{content}, '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"); + warn "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}"; + if ( C4::Context->preference("LetterLog") ) { + logaction( "ACQUISITION", "Send Acquisition claim letter", "", "order list : " . join( ",", @$externalid ) . "\n$innerletter->{title}\n$innerletter->{content}" ) if $type eq 'claimacquisition'; + logaction( "ACQUISITION", "CLAIM ISSUE", undef, "To=" . $mail{To} . " Title=" . $innerletter->{title} . " Content=" . $innerletter->{content} ) if $type eq 'claimissues'; + } + } else { + die "This bookseller has no email\n"; } - } - # send an "account details" notice to a newly created user + + warn "sending to From $userenv->{emailaddress} subj $innerletter->{title} Mess $innerletter->{content}"; + } + + # 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; diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl index 810f665b87..2482ffb88f 100755 --- a/acqui/lateorders.pl +++ b/acqui/lateorders.pl @@ -76,6 +76,19 @@ unless ($delay =~ /^\d{1,3}$/) { $delay = 30; #default value for delay } +if ($op and $op eq "send_alert"){ + my @ordernums = $input->param("claim_for");# FIXME: Fallback values? + eval { + SendAlerts( 'claimacquisition', \@ordernums, $input->param("letter_code") ); # FIXME: Fallback value? + AddClaim ( $_ ) for @ordernums; + }; + if ( $@ ) { + $template->param(error_claim => $@); + } else { + $template->param(info_claim => "Emails have been sent"); + } +} + my %supplierlist = GetBooksellersWithLateOrders($delay); my (@sloopy); # supplier loop foreach (keys %supplierlist){ @@ -85,6 +98,7 @@ foreach (keys %supplierlist){ } $template->param(SUPPLIER_LOOP => \@sloopy); $template->param(Supplier=>$supplierlist{$supplierid}) if ($supplierid); +$template->param(SupplierId=>$supplierid) if ($supplierid); my @lateorders = GetLateOrders($delay,$supplierid,$branch); @@ -100,11 +114,6 @@ foreach (keys %$letters){ } $template->param(letters=>\@letters) if (@letters); -if ($op and $op eq "send_alert"){ - my @ordernums = $input->param("claim_for"); # FIXME: Fallback values? - SendAlerts('claimacquisition',\@ordernums,$input->param("letter_code")); # FIXME: Fallback value? -} - $template->param(ERROR_LOOP => \@errors) if (@errors); $template->param( lateorders => \@lateorders, diff --git a/installer/data/mysql/de-DE/mandatory/sample_notices.sql b/installer/data/mysql/de-DE/mandatory/sample_notices.sql index 166c36d89d..0d172dbd95 100644 --- a/installer/data/mysql/de-DE/mandatory/sample_notices.sql +++ b/installer/data/mysql/de-DE/mandatory/sample_notices.sql @@ -1,6 +1,6 @@ INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Mahnung','Mahnung','Liebe/r <> <>,\n\nNach unseren Unterlagen haben Sie Medien entliehen, die nun überfällig geworden sind. Unsere Bibliothek erhebt keine Mahngebühren, bitte geben Sie die entliehenen Medien schnellstmöglich zurück.\n\n<>\n<>\n<> <>\nTelefon: <>\nFax: <>\nEmail: <>\n\nSie können die überfälligen Medien soweit möglich auch direkt über Ihr Benutzerkonto online verlängern. Wenn ein Medium länger als 30 Tage überfällig ist, wird Ihr Benutzeraccount gesperrt und Sie können keine Medien mehr entleihen.\n\nDie folgenden Medien sind zur Zeit überfällig:\n\n"<>" by <>, <>, Barcode: <> Gebühr: EUR\n\nVielen Dank für die schnelle Erledigung.\n\n<> Ihr Bibliotheksteam\n'), -('claimacquisition','ACQCLAIM','Reklamation (Erwerbung)','Titel nicht eingetroffen','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> bestellt) (je $<> €) sind nicht eingetroffen.'), +('claimacquisition','ACQCLAIM','Reklamation (Erwerbung)','Titel nicht eingetroffen','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> bestellt) (je $<> €) sind nicht eingetroffen.'), ('serial','RLIST','Umlaufliste','Zeitschrift ist jetzt verfügbar','<> <>,\r\n\r\nDas folgende Heft ist jetzt verfügbar:\r\n\r\n<>, <> (<>)\r\n\r\nBitte holen Sie es sobald möglich ab.'), ('members','ACCTDETAILS','Kontoinformationen - Standard','Ihr neues Benutzerkonto','Liebe/r <> <> <>.\r\n\r\nDie Daten Ihres neuen Benutzerkontos sind:\r\n\r\nBenutzer: <>\r\nPasswort: <>\r\n\r\nWenn Sie Probleme in Hinsicht auf Ihr Benutzerkonto haben, wenden Sie sich bitte an die Bibliothek.\r\n\r\nVielen Dank,\r\nIhr Bibliotheksteam'), ('circulation','DUE','Fälligkeitsbenachrichtigung','Fälligkeitsbenachrichtigung','Liebe/r <> <>,\r\n\r\nDie folgenden Medien sind ab heute fällig:\r\n\r\n<>, <> (<>)'), diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql index 689fa0fec7..5ca7eaff86 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ b/installer/data/mysql/en/mandatory/sample_notices.sql @@ -1,6 +1,6 @@ INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nAccording to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.\n\n<>\n<>\n<> <>\nPhone: <>\nFax: <>\nEmail: <>\n\nIf you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.\n\nThe following item(s) is/are currently overdue:\n\n"<>" by <>, <>, Barcode: <> Fine: GBP\n\nThank-you for your prompt attention to this matter.\n\n<> Staff\n'), -('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), +('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), ('serial','RLIST','Routing List','Serial is now available','<> <>,\r\n\r\nThe following issue is now available:\r\n\r\n<>, <> (<>)\r\n\r\nPlease pick it up at your convenience.'), ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <> <> <>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser: <>\r\nPassword: <>\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.\r\n\r\nThank you,\r\nKoha Administrator\r\nkohaadmin@yoursite.org'), ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <> <>,\r\n\r\nThe following item is now due:\r\n\r\n<>, <> (<>)'), diff --git a/installer/data/mysql/es-ES/mandatory/sample_notices.sql b/installer/data/mysql/es-ES/mandatory/sample_notices.sql index 689fa0fec7..78b80fa49c 100644 --- a/installer/data/mysql/es-ES/mandatory/sample_notices.sql +++ b/installer/data/mysql/es-ES/mandatory/sample_notices.sql @@ -1,6 +1,6 @@ INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nAccording to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.\n\n<>\n<>\n<> <>\nPhone: <>\nFax: <>\nEmail: <>\n\nIf you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.\n\nThe following item(s) is/are currently overdue:\n\n"<>" by <>, <>, Barcode: <> Fine: GBP\n\nThank-you for your prompt attention to this matter.\n\n<> Staff\n'), -('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), +('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), ('serial','RLIST','Routing List','Serial is now available','<> <>,\r\n\r\nThe following issue is now available:\r\n\r\n<>, <> (<>)\r\n\r\nPlease pick it up at your convenience.'), ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <> <> <>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser: <>\r\nPassword: <>\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.\r\n\r\nThank you,\r\nKoha Administrator\r\nkohaadmin@yoursite.org'), ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <> <>,\r\n\r\nThe following item is now due:\r\n\r\n<>, <> (<>)'), 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 977e59df5a..9e9f66d614 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql @@ -2,7 +2,7 @@ INSERT IGNORE INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nAccording to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.\n\n<>\n<>\n<> <>\nPhone: <>\nFax: <>\nEmail: <>\n\nIf you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.\n\nThe following item(s) is/are currently overdue:\n\n"<>" by <>, <>, Barcode: <> Fine: GBP\n\nThank-you for your prompt attention to this matter.\n\n<> Staff\n'), -('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), +('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), ('serial','RLIST','Routing List','Serial is now available','<> <>,\r\n\r\nThe following issue is now available:\r\n\r\n<>, <> (<>)\r\n\r\nPlease pick it up at your convenience.'), ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <> <> <>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser: <>\r\nPassword: <>\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.\r\n\r\nThank you,\r\nKoha Administrator\r\nkohaadmin@yoursite.org'), ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <> <>,\r\n\r\nThe following item is now due:\r\n\r\n<>, <> (<>)'), diff --git a/installer/data/mysql/it-IT/necessari/notices.sql b/installer/data/mysql/it-IT/necessari/notices.sql index 689fa0fec7..78b80fa49c 100644 --- a/installer/data/mysql/it-IT/necessari/notices.sql +++ b/installer/data/mysql/it-IT/necessari/notices.sql @@ -1,6 +1,6 @@ INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nAccording to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.\n\n<>\n<>\n<> <>\nPhone: <>\nFax: <>\nEmail: <>\n\nIf you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.\n\nThe following item(s) is/are currently overdue:\n\n"<>" by <>, <>, Barcode: <> Fine: GBP\n\nThank-you for your prompt attention to this matter.\n\n<> Staff\n'), -('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), +('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), ('serial','RLIST','Routing List','Serial is now available','<> <>,\r\n\r\nThe following issue is now available:\r\n\r\n<>, <> (<>)\r\n\r\nPlease pick it up at your convenience.'), ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <> <> <>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser: <>\r\nPassword: <>\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.\r\n\r\nThank you,\r\nKoha Administrator\r\nkohaadmin@yoursite.org'), ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <> <>,\r\n\r\nThe following item is now due:\r\n\r\n<>, <> (<>)'), diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 4fd4106c20..5673e35200 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2632,6 +2632,8 @@ CREATE TABLE `aqorders` ( `sort1_authcat` varchar(10) default NULL, `sort2_authcat` varchar(10) default NULL, `uncertainprice` tinyint(1), + `claims_count` int(11) default 0, + `claimed_date` date default NULL, PRIMARY KEY (`ordernumber`), KEY `basketno` (`basketno`), KEY `biblionumber` (`biblionumber`), 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 cdb5529c02..762da91bff 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql @@ -21,7 +21,7 @@ INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Purring','Purring pÃ¥ dokument','<> <>,\n\nDu har lÃ¥n som skulle vært levert. Biblioteket krever ikke inn gebyrer, men vennligst lever eller forny lÃ¥net/lÃ¥nene ved biblioteket.\n\n<>\n<>\n<> <>\nTelefon: <>\nFax: <>\nE-post: <>\n\nDersom du har et passord og lÃ¥net/lÃ¥nene kan fornyes kan du gjøre dette pÃ¥ nettet. Dersom du overskrider lÃ¥netiden med mer enn 30 dager vil lÃ¥nekortet bli sperret.\n\nFølgende lÃ¥n har gÃ¥tt over tiden:\n\n"<>" av <>, <>, Strekkode: <> Gebyr: GBP\n\nPÃ¥ forhÃ¥nd takk.\n\n<>\n'), -('claimacquisition','ACQCLAIM','Periodikapurring','Eksemplar ikke mottatt','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nBestillingsnummer <> (<>) (<> ordered) ($<> each) har ikke blitt mottatt.'), +('claimacquisition','ACQCLAIM','Periodikapurring','Eksemplar ikke mottatt','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nBestillingsnummer <> (<>) (<> ordered) ($<> each) har ikke blitt mottatt.'), ('serial','RLIST','Sirkulasjon','Et dokument er nÃ¥ tilgjengelig','<> <>,\r\n\r\nDette dokumentet er tilgjengelig:\r\n\r\n<>, <> (<>)\r\n\r\nVennligst kom og hent det nÃ¥r det passer.'), ('members','ACCTDETAILS','Mal for kontodetaljer - STANDARD','Dine nye kontodetaljer i Koha.','Hei <> <> <>.\r\n\r\nDine nye detaljer er:\r\n\r\nBruker: <>\r\nPassord: <>\r\n\r\nDersom det oppstÃ¥r problemer, vennligst kontakt biblioteket.\r\n\r\nVennlig hilsen,\r\nBiblioteket\r\nkohaadmin@yoursite.org'), ('circulation','DUE','InnleveringspÃ¥minnelse','InnleveringspÃ¥minnelse','<> <>,\r\n\r\nDette dokumentet mÃ¥ nÃ¥ leveres:\r\n\r\n<>, <> (<>)'), diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql index 6be2eb8ceb..c101b0ba3a 100644 --- a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql +++ b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql @@ -2,7 +2,7 @@ INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Overdue Notice', 'Item Overdue','Dear <> <>,\n\nAccording to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.\n\n<>\n<>\n<> <>\nPhone: <>\nFax: <>\nEmail: <>\n\nIf you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.\n\nThe following item(s) is/are currently overdue:\n\n"<>" by <>, <>, Barcode: <> Fine: GBP\n\nThank-you for your prompt attention to this matter.\n\n<> Staff\n'), -('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), +('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), ('serial','RLIST','Routing List','Serial is now available','<> <>,\r\n\r\nThe following issue is now available:\r\n\r\n<>, <> (<>)\r\n\r\nPlease pick it up at your convenience.'), ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <> <> <>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser: <>\r\nPassword: <>\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.\r\n\r\nThank you,\r\nKoha Administrator\r\nkohaadmin@yoursite.org'), ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <> <>,\r\n\r\nThe following item is now due:\r\n\r\n<>, <> (<>)'), diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql index 689fa0fec7..5ca7eaff86 100644 --- a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql +++ b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql @@ -1,6 +1,6 @@ INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nAccording to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.\n\n<>\n<>\n<> <>\nPhone: <>\nFax: <>\nEmail: <>\n\nIf you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.\n\nThe following item(s) is/are currently overdue:\n\n"<>" by <>, <>, Barcode: <> Fine: GBP\n\nThank-you for your prompt attention to this matter.\n\n<> Staff\n'), -('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), +('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), ('serial','RLIST','Routing List','Serial is now available','<> <>,\r\n\r\nThe following issue is now available:\r\n\r\n<>, <> (<>)\r\n\r\nPlease pick it up at your convenience.'), ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <> <> <>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser: <>\r\nPassword: <>\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.\r\n\r\nThank you,\r\nKoha Administrator\r\nkohaadmin@yoursite.org'), ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <> <>,\r\n\r\nThe following item is now due:\r\n\r\n<>, <> (<>)'), diff --git a/installer/data/mysql/ru-RU/optional/sample_notices.sql b/installer/data/mysql/ru-RU/optional/sample_notices.sql index 4f2001e965..e2d6d995cd 100644 --- a/installer/data/mysql/ru-RU/optional/sample_notices.sql +++ b/installer/data/mysql/ru-RU/optional/sample_notices.sql @@ -5,7 +5,7 @@ INSERT INTO `letter` VALUES ('circulation','ODUE','Уведомление о просрочке','Единица прострочена','Любезный <> <>,\r\n\r\nПо нашим нынешним записям, у Вас есть простроченные экземпляры. Ваша библиотека не взимает штрафы за опоздание, но, пожалуйста, поверните или обновите их как можно скорее.\r\n\r\n<><><><><><><>Если Вы зарегистрировали пароль в библиотеке, вы можете использовать его с вашим номером библиотечного билета для продолжения онлайн. Если экземпляр имеет просрочки более чем на 30 дней, Вы не сможете использовать Ваш читательский билет пока не вернете экземпляр. Следующий экземпляр в настоящее время является просроченным:\r\n\r\n<>'), -('claimacquisition','ACQCLAIM','Требование приобретения','Экземпляр не получено','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nНомер заказа <> (<>) (<> каждый) получено не было.'), +('claimacquisition','ACQCLAIM','Требование приобретения','Экземпляр не получено','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nНомер заказа <> (<>) (<> каждый) получено не было.'), ('serial','RLIST','Список скерування','Сериальные издания уже доступное','<> <>,\r\n\r\nСледующий выпуск уже доступен:\r\n\r\n<>\r\n\r\nПросьба забрать его в любое удобное для Вас время.'), diff --git a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql index 358205b316..6ab0e1889a 100644 --- a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql +++ b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql @@ -1,6 +1,6 @@ INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nAccording to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.\n\n<>\n<>\n<> <>\nPhone: <>\nFax: <>\nEmail: <>\n\nIf you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.\n\nThe following item(s) is/are currently overdue:\n\n"<>" by <>, <>, Barcode: <> Fine: GBP\n\nThank-you for your prompt attention to this matter.\n\n<> Staff\n'), -('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), +('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nOrdernumber <> (<>) (<> ordered) ($<> each) has not been received.'), ('serial','RLIST','Routing List','Serial is now available','<> <>,\r\n\r\nThe following issue is now available:\r\n\r\n<>, <> (<>)\r\n\r\nPlease pick it up at your convenience.'), ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <> <> <>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser: <>\r\nPassword: <>\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.\r\n\r\nThank you,\r\nKoha Administrator\r\nkohaadmin@yoursite.org'), ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <> <>,\r\n\r\nThe following item is now due:\r\n\r\n<>, <> (<>)'), diff --git a/installer/data/mysql/uk-UA/optional/sample_notices.sql b/installer/data/mysql/uk-UA/optional/sample_notices.sql index 6df324b048..790ea5da48 100644 --- a/installer/data/mysql/uk-UA/optional/sample_notices.sql +++ b/installer/data/mysql/uk-UA/optional/sample_notices.sql @@ -5,7 +5,7 @@ INSERT INTO `letter` VALUES ('circulation','ODUE','Повідомлення про прострочення','Одиниця прострочена','Добродію <> <>,\r\n\r\nПо нашим нинішнім записам, у Вас є прострочені екземпляри. Ваша бібліотека не стягує штрафи за запізнення, але, будь ласка, поверніть або оновіть їх як можна швидше.\r\n\r\n<><><><><><><>Якщо Ви зареєстрували пароль у бібліотеці, ви можете використовувати його з Вашим номером бібліотечного квитка для продовження онлайн. Якщо примірник має прострочення більш ніж на 30 днів, Ви не зможете використовувати Ваш читацький квиток доки не повернете примірник. Наступний примірник в даний час є простроченим:\r\n\r\n<>'), -('claimacquisition','ACQCLAIM','Вимога придбання','Примірник не отримано','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nНомер замовлення <> (<>) (<> замовлено) (<> кожний) отримано не було.'), +('claimacquisition','ACQCLAIM','Вимога придбання','Примірник не отримано','<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n<>\r\n\r\nНомер замовлення <> (<>) (<> замовлено) (<> кожний) отримано не було.'), ('serial','RLIST','Список направления','Серіальне видання вже доступне','<> <>,\r\n\r\nНаступний випуск вже доступний:\r\n\r\n<>\r\n\r\nПрохання забрати його в будь-який зручний для Вас час.'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 0a3603dbaa..b12196c00d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4619,6 +4619,12 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.07.00.009"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("ALTER TABLE `aqorders` ADD COLUMN `claims_count` INT(11) DEFAULT 0, ADD COLUMN `claimed_date` DATE DEFAULT NULL AFTER `claims_count`"); + print "Upgrade to $DBversion done (Add claims_count and claimed_date fields in aqorders table)\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index 4c3da8cb73..ceeffd60df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -2137,3 +2137,10 @@ div.pager input.pagedisplay { font-weight: bold; text-align : center; } + +div.info { + border : 2px dashed #990000; + background-color : #99FFCC; + padding : .5em; + margin : 1em; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index 1e64e1fa23..82277225b2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -1,6 +1,20 @@ [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Late orders [% INCLUDE 'doc-head-close.inc' %] + [% INCLUDE 'header.inc' %] @@ -17,9 +31,17 @@

[% IF ( Supplier ) %][% Supplier %] : [% END %]Late orders

+[% IF error_claim %] +
[% error_claim %]
+[% END %] +[% IF info_claim %] +
[% info_claim %]
+[% END %] [% IF ( lateorders ) %]
+ + [% IF ( letters ) %]

+ [% ELSE %] + + [% END %] [% FOREACH lateorder IN lateorders %] [% UNLESS ( loop.odd ) %] [% ELSE %][% END %] + ([% lateorder.supplierid %]) [% lateorder.orderdate %] ([% lateorder.latesince %] days) @@ -69,8 +99,13 @@

[% lateorder.branch %]

+ [% lateorder.claims_count %] + [% lateorder.claimed_date %] - + [% UNLESS lateorder.budget_lock %] + + [% END %] + [% END %] @@ -79,6 +114,8 @@   [% total %]   +   +   diff --git a/tools/letter.pl b/tools/letter.pl index f5dc0c6004..04cd7d2a43 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -152,7 +152,7 @@ sub add_form { push @{$field_selection}, add_fields('borrowers', 'reserves', 'biblio', 'items'); } elsif ($module eq 'claimacquisition') { - push @{$field_selection}, add_fields('aqbooksellers', 'aqorders'); + push @{$field_selection}, add_fields('aqbooksellers', 'aqorders', 'biblio', 'biblioitems'); } elsif ($module eq 'claimissues') { push @{$field_selection}, add_fields('aqbooksellers', 'serial', 'subscription'); -- 2.39.2