[Patches] [PATCH] [SIGNED-OFF] Bug 5347: Adds columns claims_count and

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Fri Dec 30 14:10:03 NZDT 2011


From: Jonathan Druart <jonathan.druart at biblibre.com>
Date: Fri, 2 Dec 2011 14:03:50 +0100
Subject: [PATCH] [SIGNED-OFF] 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 <order> tag around your item fields, like
this :

-- Begin example
<<LibrarianFirstname>>
<<LibrarianSurname>>

<<aqbooksellers.contact>>
<<aqbooksellers.address1>>
<<aqbooksellers.phone>>
<<aqbasket.basketno>>
<<aqbooksellers.phone>>
<order>Library : <<items.homebranch>>
In your possesssion : <<biblio.author>>. <<biblio.title>>.
<<biblioitems.publishercode>>, <<biblioitems.publicationyear>>.
Callnumber : <<items.itemcallnumber>>. doc type : <<items.itype>>
Barcode : <<items.barcode>>
Date for the return : <<items.onloan>>.</order>

<<LibrarianSurname>>
-- End example

Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
---
 C4/Acquisition.pm                                  |   31 +++
 C4/Letters.pm                                      |  198 ++++++++------------
 acqui/lateorders.pl                                |   19 ++-
 .../data/mysql/de-DE/mandatory/sample_notices.sql  |    2 +-
 .../data/mysql/en/mandatory/sample_notices.sql     |    2 +-
 .../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             |    2 +
 .../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 +-
 .../data/mysql/ru-RU/optional/sample_notices.sql   |    2 +-
 .../data/mysql/uk-UA/mandatory/sample_notices.sql  |    2 +-
 .../data/mysql/uk-UA/optional/sample_notices.sql   |    2 +-
 installer/data/mysql/updatedatabase.pl             |    7 +
 .../intranet-tmpl/prog/en/css/staff-global.css     |    7 +
 .../prog/en/modules/acqui/lateorders.tt            |   41 ++++-
 tools/letter.pl                                    |    2 +-
 19 files changed, 193 insertions(+), 136 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 7127f24..6fe4804 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -61,6 +61,8 @@ BEGIN {
         &GetContracts &GetContract
 
         &GetItemnumbersFromOrder
+
+        &AddClaim
     );
 }
 
@@ -1416,9 +1418,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,
@@ -1480,6 +1485,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;
@@ -1742,6 +1748,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 2420e4a..2050642 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/<<LibrarianFirstname>>/$userenv->{firstname}/g;
-        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
-        $letter->{content} =~
-          s/<<LibrarianEmailaddress>>/$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/<<LibrarianFirstname>>/$userenv->{firstname}/g;
         $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
-        $letter->{content} =~
-          s/<<LibrarianEmailaddress>>/$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/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
+
+        # Get Fields remplacement
+        my $order_format = $1 if ( $letter->{content} =~ m/(<order>.*<\/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>/$order_content\n$order_format/xms;
             }
+            $letter->{content} =~ s/<order>.*<\/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/<<borrowers.password>>/$externalid->{'password'}/g;
diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl
index 810f665..2482ffb 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 166c36d..0d172db 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 <<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nTelefon: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nEmail: <<branches.branchemail>>\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<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Gebühr: <fine>EUR</fine></item>\n\nVielen Dank für die schnelle Erledigung.\
-('claimacquisition','ACQCLAIM','Reklamation (Erwerbung)','Titel nicht eingetroffen','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> bestellt) (je $<<aqorders.listprice>> €) sind nicht eingetroffen.'),
+('claimacquisition','ACQCLAIM','Reklamation (Erwerbung)','Titel nicht eingetroffen','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Ordernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> bestellt) (je $<<aqorders.listprice>> €) sind nicht eingetroffen.</order>'),
 ('serial','RLIST','Umlaufliste','Zeitschrift ist jetzt verfügbar','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nDas folgende Heft ist jetzt verfügbar:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nBitte holen Sie es sobald möglich ab.'),
 ('members','ACCTDETAILS','Kontoinformationen - Standard','Ihr neues Benutzerkonto','Liebe/r <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nDie Daten Ihres neuen Benutzerkontos sind:\r\n\r\nBenutzer:  <<borrowers.userid>>\r\nPasswort: <<borrowers.password>>\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 <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nDie folgenden Medien sind ab heute fällig:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'), 
diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql
index 689fa0f..5ca7eaf 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 <<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nPhone: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nEmail: <<branches.branchemail>>\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<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <fine>GBP</fine></item>\n\nThank-you for your prompt attention to this matter.\n\n<<branches.branchname
-('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.'),
+('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.</order>'),
 ('serial','RLIST','Routing List','Serial is now available','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following issue is now available:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nPlease pick it up at your convenience.'),
 ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser:  <<borrowers.userid>>\r\nPassword: <<borrowers.password>>\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 at yoursite.org'), 
 ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item is now due:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'), 
diff --git a/installer/data/mysql/es-ES/mandatory/sample_notices.sql b/installer/data/mysql/es-ES/mandatory/sample_notices.sql
index 689fa0f..78b80fa 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 <<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nPhone: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nEmail: <<branches.branchemail>>\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<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <fine>GBP</fine></item>\n\nThank-you for your prompt attention to this matter.\n\n<<branches.branchname
-('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.'),
+('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Ordernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.</order>'),
 ('serial','RLIST','Routing List','Serial is now available','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following issue is now available:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nPlease pick it up at your convenience.'),
 ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser:  <<borrowers.userid>>\r\nPassword: <<borrowers.password>>\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 at yoursite.org'), 
 ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item is now due:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'), 
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..9e9f66d 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 <<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nPhone: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nEmail: <<branches.branchemail>>\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<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <fine>GBP</fine></item>\n\nThank-you for your prompt attention to this matter.\n\n<<branches.branchname>> Staf
-('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.'),
+('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.</order>'),
 ('serial','RLIST','Routing List','Serial is now available','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following issue is now available:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nPlease pick it up at your convenience.'),
 ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser:  <<borrowers.userid>>\r\nPassword: <<borrowers.password>>\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 at yoursite.org'),
 ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item is now due:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'),
diff --git a/installer/data/mysql/it-IT/necessari/notices.sql b/installer/data/mysql/it-IT/necessari/notices.sql
index 689fa0f..78b80fa 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 <<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nPhone: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nEmail: <<branches.branchemail>>\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<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <fine>GBP</fine></item>\n\nThank-you for your prompt attention to this matter.\n\n<<branches.branchname
-('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.'),
+('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Ordernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.</order>'),
 ('serial','RLIST','Routing List','Serial is now available','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following issue is now available:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nPlease pick it up at your convenience.'),
 ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser:  <<borrowers.userid>>\r\nPassword: <<borrowers.password>>\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 at yoursite.org'), 
 ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item is now due:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'), 
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 5287d9f..7610526 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 cdb5529..762da91 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','<<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nTelefon: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nE-post: <<branches.branchemail>>\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<item>"<<biblio.title>>" av <<biblio.author>>, <<items.itemcallnumber>>, Strekkode: <<items.barcode>> Gebyr: <fine>GBP</fine></item>\n\nPå forhånd takk.\n\n<<branches.branchname>>\n'),
-('claimacquisition','ACQCLAIM','Periodikapurring','Eksemplar ikke mottatt','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nBestillingsnummer <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) har ikke blitt mottatt.'),
+('claimacquisition','ACQCLAIM','Periodikapurring','Eksemplar ikke mottatt','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Bestillingsnummer <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) har ikke blitt mottatt.</order>'),
 ('serial','RLIST','Sirkulasjon','Et dokument er nå tilgjengelig','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nDette dokumentet er tilgjengelig:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nVennligst kom og hent det når det passer.'),
 ('members','ACCTDETAILS','Mal for kontodetaljer - STANDARD','Dine nye kontodetaljer i Koha.','Hei <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nDine nye detaljer er:\r\n\r\nBruker:  <<borrowers.userid>>\r\nPassord: <<borrowers.password>>\r\n\r\nDersom det oppstår problemer, vennligst kontakt biblioteket.\r\n\r\nVennlig hilsen,\r\nBiblioteket\r\nkohaadmin at yoursite.org'), 
 ('circulation','DUE','Innleveringspåminnelse','Innleveringspåminnelse','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nDette dokumentet må nå leveres:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'), 
diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql
index 6be2eb8..c101b0b 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 <<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nPhone: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nEmail: <<branches.branchemail>>\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<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <fine>GBP</fine></item>\n\nThank-you for your prompt attention to this matter.\n\n<<branches.branchname>> Staff\n'),
-('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.'),
+('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.</order>'),
 ('serial','RLIST','Routing List','Serial is now available','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following issue is now available:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nPlease pick it up at your convenience.'),
 ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser:  <<borrowers.userid>>\r\nPassword: <<borrowers.password>>\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 at yoursite.org'), 
 ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item is now due:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'), 
diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql
index 689fa0f..5ca7eaf 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 <<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nPhone: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nEmail: <<branches.branchemail>>\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<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <fine>GBP</fine></item>\n\nThank-you for your prompt attention to this matter.\n\n<<branches.branchname
-('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.'),
+('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.</order>'),
 ('serial','RLIST','Routing List','Serial is now available','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following issue is now available:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nPlease pick it up at your convenience.'),
 ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser:  <<borrowers.userid>>\r\nPassword: <<borrowers.password>>\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 at yoursite.org'), 
 ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item is now due:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'), 
diff --git a/installer/data/mysql/ru-RU/optional/sample_notices.sql b/installer/data/mysql/ru-RU/optional/sample_notices.sql
index 4f2001e..e2d6d99 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','Уведомление о просрочке','Единица прострочена','Любезный <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nПо нашим нынешним записям, у Вас есть простроченные экземпляры. Ваша библиотека не взимает штрафы за опоздание, но, пожалуйста, поверните или обновите их как можно скорее.\r\n\r\n<<branches.branchname>><<branches.branchaddress1>><<branches.branchaddress2>><<branches.branchaddress3>><<branches.branchphone>><<branches.branchfax>><<branches.branchemail>>Если Ð’Ñ‹ зарегистрировали пароль в библиотеке, вы можете использовать его с вашим номером библиотечного билета для продолжения онлайн. Если экземпляр имеет просрочки более чеÐ
 
-('claimacquisition','ACQCLAIM','Требование приобретения','Экземпляр не получено','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nНомер заказа <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> каждый) получено не было.'),
+('claimacquisition','ACQCLAIM','Требование приобретения','Экземпляр не получено','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Номер заказа <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> каждый) получено не было.</order>'),
 
 ('serial','RLIST','Список скерування','Сериальные издания уже доступное','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nСледующий выпуск уже доступен:\r\n\r\n<<items.content>>\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 358205b..6ab0e18 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 <<borrowers.firstname>> <<borrowers.surname>>,\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<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>> <<branches.branchaddress3>>\nPhone: <<branches.branchphone>>\nFax: <<branches.branchfax>>\nEmail: <<branches.branchemail>>\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<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <fine>GBP</fine></item>\n\nThank-you for your prompt attention to this matter.\n\n<<branches.branchname
-('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.'),
+('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.</order>'),
 ('serial','RLIST','Routing List','Serial is now available','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following issue is now available:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)\r\n\r\nPlease pick it up at your convenience.'),
 ('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser:  <<borrowers.userid>>\r\nPassword: <<borrowers.password>>\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 at yoursite.org'), 
 ('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item is now due:\r\n\r\n<<biblio.title>>, <<biblio.author>> (<<items.barcode>>)'), 
diff --git a/installer/data/mysql/uk-UA/optional/sample_notices.sql b/installer/data/mysql/uk-UA/optional/sample_notices.sql
index 6df324b..790ea5d 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','Повідомлення про прострочення','Одиниця прострочена','Добродію <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nПо нашим нинішнім записам, у Вас є прострочені екземпляри. Ваша бібліотека не стягує штрафи за запізнення, але, будь ласка, поверніть або оновіть їх як можна швидше.\r\n\r\n<<branches.branchname>><<branches.branchaddress1>><<branches.branchaddress2>><<branches.branchaddress3>><<branches.branchphone>><<branches.branchfax>><<branches.branchemail>>Якщо Ви зареєстрували пароль у бібліотеці, ви можете використовувати його з Вашим номером бібліотечного квитка для продовження онлайн. Якщо примірник має прострочення більш н
 
-('claimacquisition','ACQCLAIM','Вимога придбання','Примірник не отримано','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nНомер замовлення <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> замовлено) (<<aqorders.listprice>> кожний) отримано не було.'),
+('claimacquisition','ACQCLAIM','Вимога придбання','Примірник не отримано','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\n<order>Номер замовлення <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> замовлено) (<<aqorders.listprice>> кожний) отримано не було.</order>'),
 
 ('serial','RLIST','Список направления','Серіальне видання вже доступне','<<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nНаступний випуск вже доступний:\r\n\r\n<<items.content>>\r\n\r\nПрохання забрати його в будь-який зручний для Вас час.'),
 
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 67708fa..bf70d82 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4585,6 +4585,13 @@ 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 `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
 
 =head2 DropAllForeignKeys($table)
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 9eb7fa2..ec2c097 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -2133,3 +2133,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 1e64e1f..8227722 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' %]
 <title>Koha › Acquisitions › Late orders</title>
 [% INCLUDE 'doc-head-close.inc' %]
+<script type="text/javascript">
+//<![CDATA[
+$(document).ready(function() {
+    $("input:checkbox[name=claim_for]").click(function(){
+        var supplierid = $(this).attr('supplierid');
+        if ( $("input:checkbox[name=claim_for]:checked").length > 0) {
+            $("input:checkbox[name=claim_for][supplierid!="+supplierid+"]").attr('disabled', true);
+        } else {
+            $("input:checkbox[name=claim_for]").attr('disabled', false);
+        }
+    });
+});
+//]]>
+</script>
 </head>
 <body>
 [% INCLUDE 'header.inc' %]
@@ -17,9 +31,17 @@
 <h1>[% IF ( Supplier ) %][% Supplier %] : [% END %]Late orders</h1>
 <div id="acqui_lateorders">
 
+[% IF error_claim %]
+    <div class="error">[% error_claim %]</div>
+[% END %]
+[% IF info_claim %]
+    <div class="info">[% info_claim %]</div>
+[% END %]
 [% IF ( lateorders ) %]
 <form action="lateorders.pl" name="claim" method="post">
   <input type="hidden" name="op" value="send_alert" />
+  <input type="hidden" name="delay" value="[% delay %]" />
+  <input type="hidden" name="supplierid" value="[% SupplierId %]" />
 	[% IF ( letters ) %]
 	<p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
 	  [% FOREACH letter IN letters %]
@@ -35,12 +57,20 @@
             <th>Information</th>
             <th>Total cost</th>
             <th>Basket</th>
-            <th> </th>
+            <th>Claims count</th>
+            <th>Claimed date</th>
+            <!-- TMPL_IF name="Supplier" -->
+            [% IF Supplier %]
+                <th><input type="checkbox" id="checkAll"></th>
+            [% ELSE %]
+                <th></th>
+            [% END %]
         </tr>
     [% FOREACH lateorder IN lateorders %]
         [% UNLESS ( loop.odd ) %]<tr class="highlight">
         [% ELSE %]<tr>[% END %]
             <td>
+                ([% lateorder.supplierid %])
                 [% lateorder.orderdate %]
                 ([% lateorder.latesince %] days)
             </td>
@@ -69,8 +99,13 @@
                  </p>
                  <p title="branch">[% lateorder.branch %]</p>
             </td>
+            <td>[% lateorder.claims_count %]</td>
+            <td>[% lateorder.claimed_date %]</td>
             <td>
-                <input type="checkbox" name="claim_for" value="[% lateorder.ordernumber %]" />
+                [% UNLESS lateorder.budget_lock %]
+                    <input type="checkbox" name="claim_for" value="[% lateorder.ordernumber %]"  supplierid="[% lateorder.supplierid %]"/>
+                [% END %]
+             </td>
             </td>
         </tr>
         [% END %]
@@ -79,6 +114,8 @@
             <th colspan="2"> </th>
             <th>[% total %]</th>
             <th> </th>
+            <th> </th>
+            <th> </th>
             <td>
                 <input type="submit" value="Claim Order" />
             </td>
diff --git a/tools/letter.pl b/tools/letter.pl
index f5dc0c6..04cd7d2 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');
-- 
1.7.5.4


More information about the Patches mailing list