Bugzilla – Attachment 8910 Details for
Bug 5342
Serial claiming improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5342: Followup : DataTables server-side processing
0001-Bug-5342-Followup-DataTables-server-side-processing.patch (text/plain), 32.22 KB, created by
Jonathan Druart
on 2012-04-05 11:44:08 UTC
(
hide
)
Description:
Bug 5342: Followup : DataTables server-side processing
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-04-05 11:44:08 UTC
Size:
32.22 KB
patch
obsolete
>From 4283cb47572da2c78e53f99e35c486eb6993eb81 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 5 Apr 2012 11:24:40 +0200 >Subject: [PATCH 1/1] Bug 5342: Followup : DataTables server-side processing > >original author is Julian Maurice >--- > C4/Letters.pm | 6 +- > koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 2 +- > .../prog/en/modules/serials/claims.tt | 486 ++++++++------------ > .../prog/en/modules/serials/tables/claims.tt | 38 ++ > serials/claims.pl | 57 +-- > serials/tables/claims.pl | 107 +++++ > 6 files changed, 354 insertions(+), 342 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/serials/tables/claims.tt > create mode 100755 serials/tables/claims.pl > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 5a929d0..3e021df 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -330,14 +330,14 @@ sub SendAlerts { > > my $sthbookseller = > $dbh->prepare("select * from aqbooksellers where id=?"); >- $sthbookseller->execute( $dataorders->[0]->{booksellerid} ); >+ $sthbookseller->execute( $dataorders->[0]->{aqbooksellerid} ); > my $databookseller = $sthbookseller->fetchrow_hashref; > > my @email; > push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail}; > push @email, $databookseller->{contemail} if $databookseller->{contemail}; > unless (@email) { >- warn "Bookseller $dataorders->[0]->{booksellerid} without emails"; >+ warn "Bookseller $dataorders->[0]->{aqbooksellerid} without emails"; > return { error => "no_email" }; > } > >@@ -356,7 +356,7 @@ sub SendAlerts { > > # ... then send mail > my %mail = ( >- To => join( ','. @email), >+ To => join( ',', @email), > From => $userenv->{emailaddress}, > Subject => Encode::encode( "utf8", "" . $letter->{title} ), > Message => Encode::encode( "utf8", "" . $letter->{content} ), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >index e0cc888..21e03e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >@@ -23,7 +23,7 @@ var dataTablesDefaults = { > "sSearch" : window.MSG_DT_SEARCH || "Search:", > "sZeroRecords" : window.MSG_DT_ZERO_RECORDS || "No matching records found" > }, >- "sDom": '<"top pager"ilpf>t<"bottom pager"ip>' >+ "sDom": '<"top pager"ilpf>rt<"bottom pager"ip>' > }; > > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >index 78b8eb9..1ab14d5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >@@ -1,337 +1,223 @@ > [% INCLUDE 'doc-head-open.inc' %] >- <title>Koha › Serials › Claims</title> >- [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> >-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.uitablefilter.js"></script> >-<script type="text/JavaScript" language="JavaScript"> >-//<![CDATA[ >- $(document).ready(function() { >- $("#claimst").tablesorter({[% IF ( dateformat == 'metric' ) %] >- dateFormat: 'uk',[% END %] >- headers: { 0: { sorter: false },1:{sorter:false}} >- }); >- $('#supplierid').change(function() { >- $('#claims').submit(); >- }); >- >- // Case-insensitive version of jquery's contains function >- jQuery.extend( >- jQuery.expr[':'], { >- icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0" >- } >- ); >- >+<title>Koha › Serials › Claims</title> >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> > >- // Checkboxes : Select All / None >- $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>"); >- $("span.exportSelected").html("<a id=\"ExportSelected\" href=\"/cgi-bin/koha/serials/claims.pl\"> "+_("Export selected items data") +"<\/a>"); >+<script type="text/JavaScript" language="javascript"> >+//<![CDATA[ >+ $(document).ready(function() { >+ // 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("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>"); >+ $("span.exportSelected").html("<a id=\"ExportSelected\" href=\"/cgi-bin/koha/serials/claims.pl\"> "+_("Export selected items data") +"<\/a>"); > > $("#CheckAll").click(function() { > $("#claimst tr:visible :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; >- }); >- >- $("#titlefilter").keyup(function() { >- $.uiTableFilter($("#claimst"), $("#titlefilter").val()) >- }); >- >- $("#branchfilter").keyup(function() { >- $.uiTableFilter($("#claimst"), $("#branchfilter").val()) >- }); >- }); >- >- // 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 branch >- function filterByBranch() { >- selectedBranch = $("#branchfilter").val(); >- if (selectedBranch == "all") { >- clearFilters(); >- } else { >- $("table#claimst tbody tr").hide(); >- $("table#claimst tbody tr:contains(" + selectedBranch + ")").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; >- } >+ // 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 ending date is valid >- if (!parseInt(endDate)) { >- alert(_('The ending date is missing or invalid.')); >- return false; >- } >+ $("span.replace_me").each(function(){ >+ replace_html(this); >+ }); > >- // 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(); >+ var claimst = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "bAutoWidth": false, >+ "bProcessing": true, >+ "bServerSide": true, >+ "sAjaxSource": "/cgi-bin/koha/serials/tables/claims.pl", >+ 'fnServerData': function(sSource, aoData, fnCallback) { >+ aoData.push( >+ { >+ 'name': 'planneddate_from', >+ 'value': $("#planneddatefrom").val() >+ }, >+ { >+ 'name': 'planneddate_to', >+ 'value': $("#planneddateto").val() >+ }, >+ { >+ 'name': 'claimdatefrom', >+ 'value': $("#claimdatefrom").val() >+ }, >+ { >+ 'name': 'claimdateto', >+ 'value': $("#claimdateto").val() >+ } >+ ); >+ $.ajax({ >+ 'dataType': 'json', >+ 'type': 'POST', >+ 'url': sSource, >+ 'data': aoData, >+ 'success': fnCallback >+ }); >+ }, >+ "oLanguage": { >+ "sSearch": _("Search all columns:"), >+ }, >+ "aaSorting": [ [3, 'asc'] ], // sorting on title by default >+ "aoColumnDefs": [ >+ { "aTargets": [ 0 ], "mDataProp": "dt_checkbox", "bSortable":false, "bSearchable":false }, // No sorting on first column >+ { "aTargets": [ 1 ], "mDataProp": "dt_suppliername" }, >+ { "aTargets": [ 2 ], "mDataProp": "dt_branchname" }, >+ { "aTargets": [ 3 ], "mDataProp": "dt_title" }, >+ { "aTargets": [ 4 ], "mDataProp": "dt_serialseq" }, >+ { "aTargets": [ 5 ], "mDataProp": "dt_status", "bSortable":false, "bSearchable":false }, >+ { "aTargets": [ 6 ], "mDataProp": "dt_planneddate" }, >+ { "aTargets": [ 7 ], "mDataProp": "dt_claims_count" }, >+ { "aTargets": [ 8 ], "mDataProp": "dt_claimdate" }, >+ { "aTargets": [ '_all' ], "bSortable": true } >+ ], >+ "sPaginationType": "full_numbers", >+ }) ); >+ >+ claimst.fnAddFilters("filter", 750); >+ >+ >+ $("#status_filter").change(function() { >+ claimst.fnFilter($(this).val(), 5); >+ }); > >- // 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(); >+ $('#planneddatefrom').change( function() {claimst.fnDraw(); } ); >+ $('#planneddateto').change( function() { claimst.fnDraw(); } ); >+ $('#claimdatefrom').change( function() {claimst.fnDraw(); } ); >+ $('#claimdateto').change( function() {claimst.fnDraw(); } ); > >- // 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(); >- } >+ }); > >- }); >- } >+ function clearDate(nodeid) { >+ $("#"+nodeid).val(""); >+ $("#"+nodeid).change(); >+ } > >- // Clears filters : shows everything >- function clearFilters() { >- $("table#claimst tbody tr").show(); >- } >+ // 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; >+ } >+ } > > //]]> >+ > </script> >-[% INCLUDE 'calendar.inc' %] > </head> >-<body id="ser_claims" class="ser"> >+<body> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'serials-search.inc' %] > > <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> › Claims</div> > > <div id="doc3" class="yui-t2"> >- >- <div id="bd"> >- <div id="yui-main"> >- <div class="yui-b"> > >- <h1>Claims</h1> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> > >- [% IF error_claim %] >- [% IF ( error_claim == "no_email" ) %] >- <div class="error">This vendor has no email</div> >- [% ELSE %] >- <div class="error">[% error_claim %]</div> >- [% END %] >+ <h1>Claims</h1> >+ [% IF ( error_claim ) %] >+ <div class='error'>[% error_claim %]</div> > [% END %] >- [% IF info_claim %] >+ [% IF ( info_claim ) %] > <div class="dialog message">Email has been sent.</div> > [% END %] >+ [% UNLESS ( letter ) %] >+ <div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a></div> >+ [% END %] > >-[% IF ( letter ) %][% UNLESS ( missingissues ) %][% IF ( supplierid ) %] <div class="dialog alert">No missing issues found.</div>[% ELSE %]<div class="dialog message">Please choose a vendor.</div>[% END %][% END %][% END %] >- >- [% IF ( SHOWCONFIRMATION ) %] >- <div class="dialog alert">Your notification has been sent.</div> >- [% END %] >-[% UNLESS ( letter ) %]<div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div>[% END %] >- <form id="claims" name="claims" action="claims.pl" method="post"> >- <fieldset> >- <label for="supplierid">Vendor: </label> >- <select id="supplierid" name="supplierid"> >- [% FOREACH suploo IN suploop %] >- [% IF ( suploo.selected ) %] >- <option value="[% suploo.id %]" selected="selected" > >- [% ELSE %] >- <option value="[% suploo.id %]"> >- [% END %] >- [% suploo.name %] >- ([% suploo.count %]) >- </option> >- [% END %] >- </select> >- <input type="submit" value="OK" /> >- [% IF ( phone ) %]Phone: [% phone %][% END %] >- [% IF ( booksellerfax ) %]Fax: [% booksellerfax %][% END %] >- [% IF ( bookselleremail ) %]</p><p><a href="mailto:[% bookselleremail %]">[% bookselleremail %]</a>[% END %] >- </fieldset> >-</form> >- >- [% IF ( missingissues ) %] > <h3>Missing Issues</h3> >- <form action="claims.pl" onsubmit="return false;"> >- <fieldset class="rows"> >- <legend>Filters :</legend> >- >- <ol> >- <li> >- <label for="statusfilter">Status : </label> >- <select id="statusfilter" onchange="filterByStatus();"> >- <option value="all" selected="selected">(All)</option> >- <option>Expected</option> >- <option>Arrived</option> >- <option>Late</option> >- <option>Missing</option> >- <option>Claimed</option> >- </select> >- </li> >- >- <li> >- <label for="titlefilter">Title : </label> >- <input id="titlefilter" type="text" /> >- <label for="branchfilter">Library: </label> >- <select id="branchfilter" onchange="filterByBranch();"> >- [% FOREACH branchloo IN branchloop %] >- [% IF ( branchloo.selected ) %] >- <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option> >- [% ELSE %] >- <option value="[% branchloo.value %]">[% branchloo.branchname %]</option> >- [% END %] >- [% END %] >- </select> >- </li> >- >- <li> >- <label for="begindate">From</label> >- <img src="[% themelang %]/lib/calendar/cal.gif" id="begindatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" /> >- <input type="text" name="begindate" id="begindate" value="[% begindate %]" size="10" maxlength="10" /> >- <script type="text/javascript"> >- //<![CDATA[ >- Calendar.setup({ >- inputField : "begindate", >- button : "begindatebutton", >- ifFormat : "[% DHTMLcalendar_dateformat %]" >- }); >- //]]> >- </script> > >- <label for="enddate" style="float:none;">To</label> >- <img src="[% themelang %]/lib/calendar/cal.gif" id="enddatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" /> >- <input type="text" name="enddate" id="enddate" value="[% enddate %]" size="10" maxlength="10" /> >- <script type="text/javascript"> >- //<![CDATA[ >- Calendar.setup({ >- inputField : "enddate", >- button : "enddatebutton", >- ifFormat : "[% DHTMLcalendar_dateformat %]" >- }); >- //]]> >- </script> <span class="hint">[% INCLUDE 'date-format.inc' %]</span> >- <input type="button" value="OK" onclick="filterByDate();" /> >- </li> >- >- <li> >- <input type="reset" value="Clear Filters" onclick="clearFilters();" /> >- </li> >- </ol> >- </fieldset> >+ <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()"> >+ <fieldset> >+ <input type="hidden" name="order" value="[% order %]" /> >+ <table id="claimst" class="display"> >+ <thead><tr> >+ <th><input type="checkbox" id="CheckAll"></th> >+ <th>Vendor</th> >+ <th>Branch</th> >+ <th>Title</th> >+ <th>Issue number</th> >+ <th>Status</th> >+ <th>Since</th> >+ <th>Claims count</th> >+ <th>Claim Date</th> >+ </tr></thead> >+ <tbody></tbody> >+ <tfoot> >+ <tr> >+ <th></th> >+ <th><input type="text" class="filter" id="suppliername_filter" data-column_num="1" placeholder="Search vendor" /></th> >+ <th><input type="text" class="filter" id="branchname_filter" data-column_num="2" placeholder="Search branch" /></th> >+ <th><input type="text" class="filter" id="title_filter" data-column_num="3" placeholder="Search title" /></th> >+ <th><input type="text" class="filter" id="serialseq_filter" data-column_num="4" placeholder="Search issue number" /></th> >+ <th> >+ <select id="status_filter" data-column_num="5"> >+ <option value="">All</option> >+ <option value="1">Expected</option> >+ <option value="2">Arrived</option> >+ <option value="3">Late</option> >+ <option value="4">Missing</option> >+ <option value="7">Claimed</option> >+ </select> >+ </th> >+ <th> >+ <span class="replace_me" data-id="planneddate" data-type="range_dates" data-format="[% DHTMLcalendar_dateformat %]"></span> >+ </th> >+ <th><input type="text" class="filter" id="claimscount_filter" data-column_num="7" placeholder="Search claims count" /></th> >+ <th><span class="replace_me" data-type="range_dates" data-id="claimdate" data-format="[% DHTMLcalendar_dateformat %]"></span></th> >+ </tfoot> >+ </table> >+ >+ <div class="spacer"></div> >+ <p style="display:block;"><span class="exportSelected"></span></p> >+ >+ [% IF ( letter ) %] >+ <fieldset class="action"> >+ <label for="letter_code">Select notice:</label> >+ <select name="letter_code" id="letter_code"> >+ [% FOREACH letter IN letters %] >+ <option value="[% letter.code %]">[% letter.name %]</option> >+ [% END %] >+ </select> >+ <input type="hidden" name="op" value="send_alert" /><input type="submit" name="submit" class="button" value="Send notification" /></fieldset> >+ </fieldset> >+ [% END %] >+ </fieldset> > </form> > >- <fieldset> >- <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()"> >- <input type="hidden" name="order" value="[% order %]" /> >- <table id="claimst"> >- <thead> >- <tr> >- [% IF ( letter ) %] >- <th><input type="checkbox" id="CheckAll"></th> >- [% END %] >- <th>Vendor</th> >- <th>Library</th> >- <th>Title</th> >- <th>Issue number</th> >- <th>Status</th> >- <th>Since</th> >- <th>Claims count</th> >- <th>Claim date</th> >- </tr> >- </thead> >- <tbody>[% FOREACH missingissue IN missingissues %] >- <tr> >- [% IF ( letter ) %] >- <td> >- <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" /> >- </td> >- [% END %] >- <td>[% missingissue.name %]</td> >- <td>[% missingissue.branchcode %]</td> >- <td> >- <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a> >- </td> >- <td>[% missingissue.serialseq %]</td> >- <td> >- [% IF ( missingissue.status1 ) %]Expected[% END %] >- [% IF ( missingissue.status2 ) %]Arrived[% END %] >- [% IF ( missingissue.status3 ) %]Late[% END %] >- [% IF ( missingissue.status4 ) %]Missing[% END %] >- [% IF ( missingissue.status7 ) %]Claimed[% END %] >- </td> >- <td class="planneddate">[% missingissue.planneddate %]</td> >- <td>[% missingissue.claims_count %]</td> >- <td>[% missingissue.claimdate %]</td> >- </tr> >- [% END %]</tbody> >- </table> >- <p><span class="exportSelected"></span></p> >- >- [% IF ( letter ) %] >- <fieldset class="action"> >- <label for="letter_code">Select notice:</label> >- <select name="letter_code" id="letter_code"> >- [% FOREACH letter IN letters %] >- <option value="[% letter.code %]">[% letter.name %]</option> >- [% END %] >- </select> >- <input type="hidden" name="op" value="send_alert" /> >- <input type="submit" name="submit" class="button" value="Send notification" /> >- </fieldset> >- [% END %] >- </form> >- </fieldset> >-[% END %] >- >-</div> >-</div> >- >-<div class="yui-b"> >+ </div> >+ </div> >+ <div class="yui-b"> > [% INCLUDE 'serials-menu.inc' %] > </div> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/tables/claims.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/tables/claims.tt >new file mode 100644 >index 0000000..f9778d4 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/tables/claims.tt >@@ -0,0 +1,38 @@ >+[% USE KohaDates %] >+{ >+ 'sEcho': '[% sEcho %]', >+ 'iTotalRecords': '[% iTotalRecords %]', >+ 'iTotalDisplayRecords': '[% iTotalDisplayRecords %]', >+ 'aaData': [ >+ [% FOREACH data IN aaData %] >+ { >+ 'dt_checkbox': >+ '[% UNLESS ( data.cannot_claim ) %]<input type="checkbox" name="serialid" value="[% data.serialid %]" />[% END %]', >+ >+ 'dt_suppliername': >+ '[% data.suppliername |html %]', >+ >+ 'dt_title': >+ '<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% data.subscriptionid %]">[% data.title |html %]</a>', >+ >+ 'dt_branchname': >+ '[% data.branchname %]', >+ >+ 'dt_serialseq': >+ '[% data.serialseq %]', >+ >+ 'dt_status': >+ '[% IF ( data.status == 1 ) %]Expected[% END %][% IF ( data.status == 2 ) %]Arrived[% END %][% IF ( data.status == 3 ) %]Late[% END %][% IF ( data.status == 4 ) %]Missing[% END %][% IF ( data.status == 7 ) %]Claimed[% END %]', >+ >+ 'dt_planneddate': >+ '[% data.planneddate|$KohaDates %]', >+ >+ 'dt_claims_count': >+ '[% data.claims_count %]', >+ >+ 'dt_claimdate': >+ '[% data.claimdate|$KohaDates %]' >+ }, >+ [% END %] >+ ] >+} >diff --git a/serials/claims.pl b/serials/claims.pl >index e65d827..2ea2fe1 100755 >--- a/serials/claims.pl >+++ b/serials/claims.pl >@@ -1,6 +1,6 @@ > #!/usr/bin/perl > >-# Parts Copyright 2010 Biblibre >+# Parts Copyright 2012 Biblibre > > # This file is part of Koha. > # >@@ -17,8 +17,7 @@ > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use strict; >-use warnings; >+use Modern::Perl; > use CGI; > use C4::Auth; > use C4::Serials; >@@ -50,58 +49,40 @@ my ($template, $loggedinuser, $cookie) > > # supplierlist is returned in name order > my $supplierlist = GetSuppliersWithLateIssues(); >-for my $s (@{$supplierlist} ) { >- $s->{count} = scalar GetLateOrMissingIssues($s->{id}, q{}, $order); >- if ($supplierid && $s->{id} == $supplierid) { >- $s->{selected} = 1; >- } >-} > >-my $letters = GetLetters('claimissues'); >-my @letters; >-foreach (keys %{$letters}){ >- push @letters ,{code=>$_,name=> $letters->{$_}}; >+my @suploop; >+foreach my $s ( @{$supplierlist} ) { >+ push @suploop, { %$s }; > } > >-my $letter=((scalar(@letters)>1) || ($letters[0]->{name}||$letters[0]->{code})); >-my @missingissues; >-my @supplierinfo; >-if ($supplierid) { >- @missingissues = GetLateOrMissingIssues($supplierid,$serialid,$order); >- @supplierinfo=GetBookSeller($supplierid); >+my $letters = GetLetters("claimissues"); >+my @letters; >+foreach ( keys %{$letters} ) { >+ push @letters, { code => $_, name => $letters->{$_} }; > } > >-my $branchloop = GetBranchesLoop(); >-unshift @$branchloop, {value=> 'all',name=>''}; >+my $letter = ( ( scalar(@letters) > 1 ) || ( $letters[0]->{name} || $letters[0]->{code} ) ); > > my @serialnums=$input->param('serialid'); > if (@serialnums) { # i.e. they have been flagged to generate claims > my $err; > eval { >- SendAlerts('claimissues',\@serialnums,$input->param("letter_code")); >+ $err = SendAlerts('claimissues',\@serialnums,$input->param("letter_code")); > UpdateClaimdateIssues(\@serialnums); > }; > if ( $@ ) { >- $template->param(error_claim => $@); >- } elsif ( defined $err->{error} and $err->{error} eq "no_email" ) { >+ $template->{VARS}->{'error_claim'} = $@; >+ } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) { > $template->{VARS}->{'error_claim'} = "no_email"; > } else { > $template->{VARS}->{'info_claim'} = 1; > } > } >-$template->param('letters'=>\@letters,'letter'=>$letter); >+ > $template->param( >- order =>$order, >- suploop => $supplierlist, >- phone => $supplierinfo[0]->{phone}, >- booksellerfax => $supplierinfo[0]->{booksellerfax}, >- bookselleremail => $supplierinfo[0]->{bookselleremail}, >- missingissues => \@missingissues, >- supplierid => $supplierid, >- claimletter => $claimletter, >- supplierloop => \@supplierinfo, >- branchloop => $branchloop, >- dateformat => C4::Context->preference("dateformat"), >- DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >- ); >+ letters => \@letters, >+ letter => $letter, >+ order => $order, >+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >+); > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/serials/tables/claims.pl b/serials/tables/claims.pl >new file mode 100755 >index 0000000..c5fa521 >--- /dev/null >+++ b/serials/tables/claims.pl >@@ -0,0 +1,107 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+use CGI; >+use JSON; >+ >+use C4::Auth; >+use C4::Circulation qw/CanBookBeRenewed/; >+use C4::Context; >+use C4::Koha qw/getitemtypeimagelocation/; >+use C4::Reserves qw/CheckReserves/; >+use C4::Utils::DataTables; >+use C4::Output; >+ >+my $input = new CGI; >+ >+my $planneddate_to = $input->param('planneddate_to'); >+my $planneddate_from = $input->param('planneddate_from'); >+my $claimdatefrom = $input->param('claimdatefrom'); >+my $claimdateto = $input->param('claimdateto'); >+ >+ >+my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user({ >+ template_name => 'serials/tables/claims.tmpl', >+ query => $input, >+ type => 'intranet', >+ authnotrequired => 0, >+ flagsrequired => { circulate => 'circulate_remaining_permission' }, >+}); >+ >+# Fetch DataTables parameters >+my %dtparam = dt_get_params( $input ); >+ >+while ( my ( $k, $v ) = each %dtparam ) { >+ $v =~ s/^dt_(.+)/$1/; >+ $dtparam{$k} = $v; >+} >+ >+my $branchcode; >+unless( $flags->{'superlibrarian'} == 1 >+ || $template->{'param_map'}->{'CAN_user_serials_superserials'} ){ >+ $branchcode = C4::Context->userenv->{'branch'}; >+} >+ >+my $dbh = C4::Context->dbh; >+ >+# Build the query >+my $select = <<EOQ; >+ SELECT SQL_CALC_FOUND_ROWS >+ serialid, aqbooksellerid, name AS suppliername, biblio.title, planneddate, serialseq, >+ serial.status, serial.subscriptionid, claimdate, claims_count, >+ branches.branchname >+EOQ >+my $from = <<EOQ; >+ FROM serial >+ LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid >+ LEFT JOIN biblio ON subscription.biblionumber=biblio.biblionumber >+ LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id >+ LEFT JOIN branches ON branches.branchcode = subscription.branchcode >+EOQ >+my $where = <<EOQ; >+ WHERE (serial.STATUS = 4 OR ((planneddate < now() AND serial.STATUS =1) OR serial.STATUS = 3 OR serial.STATUS = 7)) >+EOQ >+ >+my @bind_params; >+$where .= qq{ AND subscription.branchcode = ?} if $branchcode; >+push @bind_params, $branchcode ? $branchcode : (); >+my ( $planneddate_q , $planneddate_f ) = dt_build_query( 'range_dates', $planneddate_from, $planneddate_to, 'planneddate' ); >+my ( $claimdate_q, $claimdate_f ) = dt_build_query('range_dates', $claimdatefrom, $claimdateto, 'claimdate'); >+ >+my $where_filters; >+$where_filters .= ( $planneddate_q ? $planneddate_q : '' ); >+push @bind_params, scalar( @$planneddate_f ) > 0 ? @$planneddate_f : (); >+ >+$where_filters .= ( $claimdate_q ? $claimdate_q : '' ); >+push @bind_params, scalar( @$claimdate_f ) > 0 ? @$claimdate_f : (); >+ >+my ($filters, $filter_params) = dt_build_having(\%dtparam); >+my $having = @$filters ? " HAVING ". join(" AND ", @$filters) : ''; >+my $order_by = dt_build_orderby(\%dtparam); >+my $limit .= " LIMIT ?,? "; >+ >+my $query = $select . $from . $where . $where_filters . ( $having || '' ) . $order_by . $limit; >+push @bind_params, @$filter_params, $dtparam{'iDisplayStart'}, $dtparam{'iDisplayLength'}; >+my $sth = $dbh->prepare($query); >+$sth->execute(@bind_params); >+my $results = $sth->fetchall_arrayref({}); >+ >+$sth = $dbh->prepare("SELECT FOUND_ROWS()"); >+$sth->execute; >+my ($iTotalDisplayRecords) = $sth->fetchrow_array; >+ >+# This is mandatory for DataTables to show the total number of results >+my $select_total_count = "SELECT COUNT(*) "; >+$sth = $dbh->prepare($select_total_count.$from.$where); >+$sth->execute($branchcode ? $branchcode : ()); >+my ($iTotalRecords) = $sth->fetchrow_array; >+ >+$template->param( >+ sEcho => $dtparam{'sEcho'}, >+ iTotalRecords => $iTotalRecords, >+ iTotalDisplayRecords => $iTotalDisplayRecords, >+ aaData => $results, >+); >+ >+output_with_http_headers $input, $cookie, $template->output, "json"; >-- >1.7.7.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5342
:
8115
|
8116
|
8309
|
8334
|
8335
|
8611
|
8682
|
8683
|
8900
|
8910
|
9168
|
9169
|
9976
|
9977
|
10211
|
10212
|
10245
|
10258
|
14444
|
14445
|
14446
|
16217
|
16218
|
16219
|
19512
|
31277
|
31375
|
31454
|
31694
|
31902
|
32171
|
32172