From fbe215e6c6ecf1f4c45ed152a733fe6e77cc0e15 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 25 Aug 2009 23:56:21 +0200 Subject: [PATCH] Claims management enhancement Signed-off-by: Galen Charlton --- .../prog/en/modules/serials/claims.tmpl | 204 +++++++++++++++++- serials/claims.pl | 20 +- 2 files changed, 204 insertions(+), 20 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tmpl index 8ee9aed982..dc482a4c7f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tmpl @@ -1,4 +1,5 @@ + Koha › Serials › Claims @@ -8,16 +9,134 @@ $(document).ready(function() { $("#claimst").tablesorter({ dateFormat: 'uk', - headers: { 0: { sorter: false },1:{sorter:false},2: { sorter: false },3:{sorter:false},6:{sorter:false}} + headers: { 0: { sorter: false },1:{sorter:false}} }); $('#supplierid').change(function() { $('#claims').submit(); }); - }); - function popup(supplierid,serialid){ - window.open('claims.pl?supplierid='+ supplierid +'&serialid='+ serialid +'&op=preview' ,'popup', 'width=600,height=400,toolbar=no,scrollbars=yes'); + // Case-insensitive version of jquery's contains function + jQuery.extend( + jQuery.expr[':'], { + icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0" + } + ); + + + // Checkboxes : Select All / None + $("span.checkall").html(" "+_("Check All")); + $("span.exportSelected").html("Export selected items data<\/a>"); + + + $("#CheckAll").click(function(){ + $("#claimst :checkbox").attr('checked', $("#CheckAll").is(':checked')); + }); + + + // Generates a dynamic link for exporting the selection's data as CSV + $("#ExportSelected").click(function() { + // We use input:checked because it's faster, but if there must new checkboxes + // used for other purpose on this page, please use [name=serialid]:checked instead + var selected = $("input:checked"); + + if (selected.length == 0) { + alert(_('Please select at least one item to export.')); + return false; + } + + // Building the url from currently checked boxes + var url = '/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=&op=claims'; + for (var i = 0; i < selected.length; i++) { + url += '&serialid=' + selected[i].value; } + // And redirecting to the CSV page + location.href = url; + return false; + }); + + + }); + + // Checks if the form can be sent (at least one checkbox must be checked) + function checkForm() { + if ($("input:checked").length == 0) { + alert(_('Please select at least one item.')); + return false; + } + } + + // Filter by status + function filterByStatus() { + selectedStatus = $("#statusfilter").val(); + if (selectedStatus == "all") { + clearFilters(); + } else { + $("table#claimst tbody tr").hide(); + $("table#claimst tbody tr:contains(" + selectedStatus + ")").show(); + } + } + + // Filter by title + function filterByTitle() { + var title = $("#titlefilter").val(); + $("table#claimst tbody tr").hide(); + $("table#claimst tbody tr:icontains(" + title + ")").show(); + + } + + // Filter by date + function filterByDate() { + var beginDate = Date_from_syspref($("#begindate").val()).getTime(); + var endDate = Date_from_syspref($("#enddate").val()).getTime(); + + // Checks if the beginning date is valid + if (!parseInt(beginDate)) { + alert(_('The beginning date is missing or invalid.')); + return false; + } + + // Checks if the ending date is valid + if (!parseInt(endDate)) { + alert(_('The ending date is missing or invalid.')); + return false; + } + + // Checks if beginning date is before ending date + if (beginDate > endDate) { + // If not, we swap them + var tmpDate = endDate; + endDate = beginDate; + beginDate = tmpDate; + } + + // We hide everything + $("table#claimst tbody tr").hide(); + + // For each date in the table + $(".planneddate").each(function() { + + // We make a JS Date Object, according to the locale + var pdate = Date_from_syspref($(this).text()).getTime(); + + // And checks if the date is between the beginning and ending dates + if (pdate > beginDate && + pdate < endDate) { + // If so, we can show the row + $(this).parent().show(); + } + + }); + } + + // Clears filters : shows everything + function clearFilters() { + $("table#claimst tbody tr").show(); + } + + function popup(supplierid,serialid){ + window.open('claims.pl?supplierid='+ supplierid +'&serialid='+ serialid +'&op=preview' ,'popup', 'width=600,height=400,toolbar=no,scrollbars=yes'); + } + //]]> @@ -41,7 +160,10 @@
No missing issues found.
Please choose a supplier.
-
+ +
Your notification has been sent.
+ +
No claims notice defined. Please define one.
@@ -53,10 +175,70 @@ -
+

Missing Issues

+ +
+ Filters : + +
    +
  1. + + +
  2. + +
  3. + + + +
  4. + +
  5. + + /lib/calendar/cal.gif" id="begindatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" /> + " size="10" maxlength="10" /> + + + + /lib/calendar/cal.gif" id="enddatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" /> + " size="10" maxlength="10" /> + + +
  6. + +
  7. + +
  8. +
+
+
+ +
" /> -

Missing Issues

- +

+
@@ -92,7 +274,7 @@ MissingClaimed -
Claim + @@ -104,6 +286,7 @@
+

" /> &op=preview" onclick="popup(,''); return false" class="button">Supplier Group Claim Notice

--> @@ -115,7 +298,8 @@ -
+ + diff --git a/serials/claims.pl b/serials/claims.pl index cbb6fd686b..6d9f172ac9 100755 --- a/serials/claims.pl +++ b/serials/claims.pl @@ -10,13 +10,13 @@ use C4::Output; use C4::Bookseller; use C4::Context; use C4::Letters; - my $input = new CGI; my $serialid = $input->param('serialid'); my $op = $input->param('op'); my $claimletter = $input->param('claimletter'); my $supplierid = $input->param('supplierid'); +my $suppliername = $input->param('suppliername'); my $order = $input->param('order'); my %supplierlist = GetSuppliersWithLateIssues; my @select_supplier; @@ -30,14 +30,12 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {serials => 1}, debug => 1, }); - foreach my $supplierid (sort {$supplierlist{$a} cmp $supplierlist{$b} } keys %supplierlist){ my ($count, @dummy) = GetLateOrMissingIssues($supplierid,"",$order); my $counting = $count; $supplierlist{$supplierid} = $supplierlist{$supplierid}." ($counting)"; push @select_supplier, $supplierid } - my $letters = GetLetters("claimissues"); my @letters; foreach (keys %$letters){ @@ -70,13 +68,14 @@ if($supplierid){ my $preview=0; if($op && $op eq 'preview'){ $preview = 1; -} else { - my @serialnums=$input->param('serialid'); - if (@serialnums) { # i.e. they have been flagged to generate claims - SendAlerts('claimissues',\@serialnums,$input->param("letter_code")); - my $cntupdate=UpdateClaimdateIssues(\@serialnums); - ### $cntupdate SHOULD be equal to scalar(@$serialnums) TODO so what do we do about it?? - } +} +if ($op eq "send_alert"){ + my @serialnums=$input->param("serialid"); + SendAlerts('claimissues',\@serialnums,$input->param("letter_code")); + my $cntupdate=UpdateClaimdateIssues(\@serialnums); + ### $cntupdate SHOULD be equal to scalar(@$serialnums) + $template->param('SHOWCONFIRMATION' => 1); + $template->param('suppliername' => $suppliername); } $template->param('letters'=>\@letters,'letter'=>$letter); @@ -93,5 +92,6 @@ $template->param( singlesupplier => $singlesupplier, supplierloop => \@supplierinfo, dateformat => C4::Context->preference("dateformat"), + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5