View | Details | Raw Unified | Return to bug 17698
Collapse All | Expand All

(-)a/Koha/Issue.pm (-1 / +1 lines)
Lines 108-114 sub SetIssueNote { Link Here
108
        return;
108
        return;
109
    }
109
    }
110
110
111
    my $query = "UPDATE issues SET notedate=NOW(),note=? WHERE issue_id=?";
111
    my $query = "UPDATE issues SET notedate=NOW(),note=?,noteseen=0 WHERE issue_id=?";
112
    my $sth = $dbh->prepare($query);
112
    my $sth = $dbh->prepare($query);
113
    return $sth->execute( $note, $issue_id );
113
    return $sth->execute( $note, $issue_id );
114
}
114
}
(-)a/installer/data/mysql/atomicupdate/bug-17698_add-noteseen-column-to-issues.sql (+1 lines)
Line 0 Link Here
1
ALTER IGNORE TABLE issues ADD `noteseen` int(1) default NULL;
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 861-866 CREATE TABLE `issues` ( -- information related to check outs or issues Link Here
861
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
861
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
862
  `note` mediumtext default NULL, -- issue note text
862
  `note` mediumtext default NULL, -- issue note text
863
  `notedate` datetime default NULL, -- datetime of issue note (yyyy-mm-dd hh:mm::ss)
863
  `notedate` datetime default NULL, -- datetime of issue note (yyyy-mm-dd hh:mm::ss)
864
  `noteseen` int(1) default NULL, -- describes whether issue note has been seen 1, not been seen 0 or doesn't exist null
864
  PRIMARY KEY (`issue_id`),
865
  PRIMARY KEY (`issue_id`),
865
  KEY `issuesborridx` (`borrowernumber`),
866
  KEY `issuesborridx` (`borrowernumber`),
866
  KEY `itemnumber_idx` (`itemnumber`),
867
  KEY `itemnumber_idx` (`itemnumber`),
(-)a/issue_notes/issue-notes.pl (+113 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2016 Aleisha Amohia <aleisha@catalyst.net.nz>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use strict;
23
use warnings;
24
25
use CGI qw ( -utf8 );
26
use CGI::Cookie; # need to check cookies before having CGI parse the POST request
27
use C4::Koha;
28
use C4::Context;
29
use C4::Biblio;
30
use C4::Output qw(:DEFAULT :ajax);
31
use C4::Auth;
32
33
sub ajax_auth_cgi {     # returns CGI object
34
    my $needed_flags = shift;
35
    my %cookies = fetch CGI::Cookie;
36
    my $input = CGI->new;
37
    my $sessid = $cookies{'CGISESSID'}->value;
38
    my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
39
    if ($auth_status ne "ok") {
40
        output_with_http_headers $input, undef,
41
        "window.alert('Your CGI session cookie ($sessid) is not current.  " .
42
        "Please refresh the page and try again.');\n", 'js';
43
        exit 0;
44
    }
45
    return $input;
46
}
47
48
if (is_ajax()) {
49
    my $input = &ajax_auth_cgi({}) || CGI->new();
50
    my ($note, $js_reply);
51
    if ($note = $input->param('seen')) {
52
        $js_reply = ( markseen($note) ? 'success' : 'failure') . "_seen('$note');\n";
53
    }
54
    output_with_http_headers $input, undef, $js_reply, 'js';
55
    exit;
56
}
57
58
my $query = new CGI;
59
60
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
61
    {
62
        template_name   => "issue_notes/issue-notes.tt",
63
        query           => $query,
64
        type            => "intranet",
65
        authnotrequired => 0,
66
        flagsrequired   => { circulation => 1 },
67
        debug           => 1,
68
    }
69
);
70
71
my @notes = get_notes();
72
my $pending_notes = Koha::Issues->search({ noteseen => 0 });
73
#my $borrower = C4::Members::GetMember( borrowernumber => $notes->{'borrowernumber'} );
74
#my $itemnumber = $notes->{'itemnumber'};
75
#my $biblio = GetBiblioFromItemNumber($itemnumber);
76
$template->param(
77
    notes     => @notes,
78
    pending   => $pending_notes,
79
#    title     => $biblio->{'title'},
80
#    issuenote => $notes->{'note'},
81
#    barcode   => $biblio->{'barcode'},
82
#    borrower  => $borrower,
83
#    date      => $notes->{'notedate'},
84
);
85
86
87
sub get_notes {
88
    my $dbh = C4::Context->dbh;
89
    my $q = "SELECT issues.borrowernumber AS borrowernumber,
90
                    issues.itemnumber     AS itemnumber,
91
                    issues.note           AS note,
92
                    issues.notedate       AS notedate,
93
                    issues.noteseen       AS noteseen,
94
                    borrowers.firstname   AS firstname,
95
                    borrowers.surname     AS surname,
96
                    items.barcode         AS barcode,
97
                    biblio.title          AS title,
98
                    biblio.author         AS author
99
             FROM issues
100
             JOIN borrowers
101
             ON issues.borrowernumber = borrowers.borrowernumber
102
             JOIN items
103
             ON issues.itemnumber     = items.itemnumber
104
             JOIN biblio
105
             ON items.biblionumber    = biblio.biblionumber
106
             WHERE issues.note IS NOT NULL";
107
    my $sth = $dbh->prepare($q);
108
    $sth->execute();
109
    return $sth->fetchall_arrayref({});
110
}
111
112
113
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt (+1 lines)
Lines 30-35 Link Here
30
		<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA">Fast cataloging</a></li>
30
		<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA">Fast cataloging</a></li>
31
	    [% END %]
31
	    [% END %]
32
	[% END %]
32
	[% END %]
33
        <li><a href="/cgi-bin/koha/issue_notes/issue-notes.pl">Issue notes</a></li>
33
	</ul>
34
	</ul>
34
	</div>
35
	</div>
35
36
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (+7 lines)
Lines 172-177 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This Link Here
172
                    </div>
172
                    </div>
173
                    [% END %]
173
                    [% END %]
174
174
175
                    [% IF Koha.Preference('AllowIssueNotes') && pending_issue_notes %]
176
                    <div class="pending-info" id="issue_notes_pending">
177
                        <a href="/cgi-bin/koha/issue_notes/issue-notes.pl">Issue notes pending</a>:
178
                        <span class="pending-number-link">[% pending_issue_notes %]</span>
179
                    </div>
180
                    [% END %]
181
175
                </div>
182
                </div>
176
183
177
            [% END %]
184
            [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/issue_notes/issue-notes.tt (+57 lines)
Line 0 Link Here
1
[% USE Koha %]
2
[% USE KohaDates %]
3
[% USE Branches %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Home &rsaquo; Circulation &rsaquo; Issue Notes &rsaquo; Review Issue Notes</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
8
[% INCLUDE 'datatables.inc' %]
9
[% INCLUDE 'calendar.inc' %]
10
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
11
</head>
12
[% INCLUDE 'header.inc' %]
13
[% INCLUDE 'circ-search.inc' %]
14
<div id="breadcrumbs">
15
    <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; 
16
    <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo;
17
    <a href="/cgi-bin/koha/issue_notes/issue-notes.pl">Issue notes</a> &rsaquo; Issue notes management
18
</div>
19
20
<div id="doc3" class="yui-t7"> <!-- <div id="doc3" class="yui-t2" -->
21
    <div id="bd">
22
        <div id="yui-main">
23
24
            <h1>Issue notes</h1>
25
26
            [% IF ( notes ) %]
27
            <table id="notestable">
28
                <thead>
29
                    <tr>
30
                        <th>Note</th>
31
                        <th>Title</th>
32
                        <th>Barcode</th>
33
                        <th>Date</th>
34
                        <th>Set by</th>
35
                        <th>Seen</th>
36
                    </tr>
37
                </thead>
38
                <tbody>
39
                [% FOREACH note in notes %]
40
                    <tr>
41
                        <td>[% note.note %]</td>
42
                        <td>[% note.title %]</td>
43
                        <td>[% note.barcode %]</td>
44
                        <td>[% note.date %]</td>
45
                        <td>[% note.firstname %] [% note.surname %] ([% note.borrowernumber %])</td>
46
                        <td>[% IF ( pending ) %]<button class="btn btn-mini">Not seen</button>[% ELSE %]<button class="btn btn-mini">Seen</button>[% END %]</td>
47
                    </tr>
48
                [% END %]
49
                </tbody>
50
            </table>
51
            [% END %]
52
53
        </div> <!-- yui-main -->
54
    </div> <!-- bd -->
55
</div> <!-- doc3 -->
56
57
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/mainpage.pl (-1 / +3 lines)
Lines 31-36 use Koha::Patron::Modifications; Link Here
31
use Koha::Patron::Discharge;
31
use Koha::Patron::Discharge;
32
use Koha::Reviews;
32
use Koha::Reviews;
33
use Koha::ArticleRequests;
33
use Koha::ArticleRequests;
34
use Koha::Issues;
34
35
35
my $query = new CGI;
36
my $query = new CGI;
36
37
Lines 74-79 my $pending_article_requests = Koha::ArticleRequests->count( Link Here
74
        $branch ? ( branchcode => $branch ) : (),
75
        $branch ? ( branchcode => $branch ) : (),
75
    }
76
    }
76
);
77
);
78
my $pending_issue_notes = Koha::Issues->search({ noteseen => 0 })->count;
77
79
78
$template->param(
80
$template->param(
79
    pendingcomments                => $pendingcomments,
81
    pendingcomments                => $pendingcomments,
Lines 82-87 $template->param( Link Here
82
    pending_borrower_modifications => $pending_borrower_modifications,
84
    pending_borrower_modifications => $pending_borrower_modifications,
83
    pending_discharge_requests     => $pending_discharge_requests,
85
    pending_discharge_requests     => $pending_discharge_requests,
84
    pending_article_requests       => $pending_article_requests,
86
    pending_article_requests       => $pending_article_requests,
87
    pending_issue_notes            => $pending_issue_notes,
85
);
88
);
86
89
87
#
90
#
88
- 

Return to bug 17698