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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc (+1 lines)
Lines 83-88 Link Here
83
    [% IF EnableBorrowerFiles %]
83
    [% IF EnableBorrowerFiles %]
84
        [% IF ( borrower_files ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/files.pl?borrowernumber=[% borrowernumber %]">Files</a></li>
84
        [% IF ( borrower_files ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/files.pl?borrowernumber=[% borrowernumber %]">Files</a></li>
85
    [% END %]
85
    [% END %]
86
    [% IF (  suggestions ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/purchase-suggestions.pl?borrowernumber=[% borrowernumber %]">Purchase suggestions</a></li>
86
</ul></div>
87
</ul></div>
87
[% END %]
88
[% END %]
88
89
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt (+107 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Patrons &rsaquo;
3
[% IF ( unknowuser ) %]
4
    Patron does not exist
5
[% ELSE %]
6
    Purchase suggestions for [% INCLUDE 'patron-title.inc' %]
7
[% END %]
8
</title>
9
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
10
[% INCLUDE 'doc-head-close.inc' %]
11
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
12
[% INCLUDE 'datatables-strings.inc' %]
13
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
14
[% INCLUDE 'calendar.inc' %]
15
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
16
<script type="text/javascript">
17
    $(document).ready(function() {
18
        $("#suggestions").dataTable($.extend(true, {}, dataTablesDefaults, {
19
            'bPaginate': false,
20
            'bFilter': false,
21
            'bInfo': false,
22
        } ));
23
24
        new YAHOO.widget.Button("newsuggestion");
25
    });
26
</script>
27
</head>
28
29
<body>
30
[% INCLUDE 'header.inc' %]
31
[% INCLUDE 'patron-search.inc' %]
32
33
<div id="breadcrumbs">
34
         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
35
&rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
36
&rsaquo; [% IF ( unknowuser ) %]Patron does not exist[% ELSE %]Purchase suggestions for [% firstname %] [% surname %] ([% cardnumber %])[% END %]
37
</div>
38
39
<div id="doc3" class="yui-t1">
40
41
   <div id="bd">
42
    <div id="yui-main">
43
        <div class="yui-b">
44
            <div class="yui-g">
45
                <h2>Purchase suggestions</h2>
46
47
                <div id="toolbar">
48
                    <ul class="toolbar">
49
                        <li><a id="newsuggestion" href="/cgi-bin/koha/suggestion/suggestion.pl?op=add&suggestedby=[% borrowernumber %]&redirect=[% borrowernumber %]">New purchase suggestion</a></li>
50
                    </ul>
51
                </div>
52
53
                <table id="suggestions">
54
                    <thead>
55
                        <tr>
56
                          <th>Summary</th>
57
                          <th>Note</th>
58
                          <th>Managed by</th>
59
                          <th>Status</th>
60
                        </tr>
61
                    </thead>
62
63
                    <tbody>
64
                        [% FOREACH s IN suggestions %]
65
                            <tr>
66
                                <td>
67
                                    <p><strong>[% s.title |html %]</strong></p>
68
                                    <p>
69
                                        [% IF ( s.author ) %][% s.author %],[% END %]
70
                                        [% IF ( s.copyrightdate ) %] - [% s.copyrightdate %],[% END %]
71
                                        [% IF ( s.publishercode ) %] - [% s.publishercode %][% END %]
72
                                        [% IF ( s.place ) %]([% s.place %])[% END %]
73
                                        [% IF ( s.collectiontitle ) %] , [% s.collectiontitle %][% END %]
74
                                        [% IF ( s.itemtype ) %] - [% s.itemtype %][% END %]
75
                                    </p>
76
                                </td>
77
                                <td>[% s.note %]
78
                                <td>
79
                                    [% IF ( s.surnamemanagedby ) %]
80
                                        [% s.surnamemanagedby %]
81
                                        [% IF ( s.firstnamemanagedby ) %],[% END %]
82
                                        [% s.firstnamemanagedby %]
83
                                    [% ELSE %]
84
                                        &nbsp;
85
                                    [% END %]
86
                                </td>
87
                                <td>
88
                                    [% IF ( s.ASKED ) %]Requested[% END %]
89
                                    [% IF ( s.CHECKED ) %]Checked by the library[% END %]
90
                                    [% IF ( s.ACCEPTED ) %]Accepted by the library[% END %]
91
                                    [% IF ( s.ORDERED ) %]Ordered by the library[% END %]
92
                                    [% IF ( s.REJECTED ) %]Suggestion declined [% END %]
93
                                    [% IF ( s.AVAILABLE ) %]Available in the library[% END %]
94
                                    [% IF ( s.reason ) %]([% s.reason %])[% END %]
95
                                </td>
96
                            </tr>
97
                        [% END %]
98
                    </tbody>
99
                </table>
100
            </div>
101
        </div>
102
    </div>
103
<div class="yui-b">
104
[% INCLUDE 'circ-menu.inc' %]
105
</div>
106
</div>
107
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (+1 lines)
Lines 296-301 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
296
    <div class="yui-b">
296
    <div class="yui-b">
297
[% IF ( op_save ) %]
297
[% IF ( op_save ) %]
298
    <form id="add_edit" action="suggestion.pl" method="post">
298
    <form id="add_edit" action="suggestion.pl" method="post">
299
    <input type="hidden" name="redirect" id="redirect" value="[% redirect %]" />
299
    [% IF ( suggestionid ) %]
300
    [% IF ( suggestionid ) %]
300
        <h1>Edit purchase suggestion #[% suggestionid %]</h1>
301
        <h1>Edit purchase suggestion #[% suggestionid %]</h1>
301
        <input type="hidden" name="suggestionid" value="[% suggestionid %]"/>
302
        <input type="hidden" name="suggestionid" value="[% suggestionid %]"/>
(-)a/members/purchase-suggestions.pl (+58 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2012 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along with
17
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18
# Suite 330, Boston, MA  02111-1307 USA
19
20
use Modern::Perl;
21
22
use CGI;
23
use C4::Auth;
24
use C4::Context;
25
use C4::Output;
26
use C4::Branch;
27
use C4::Members;
28
use C4::Suggestions;
29
30
my $input = new CGI;
31
32
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
33
    {   template_name   => "members/purchase-suggestions.tmpl",
34
        query           => $input,
35
        type            => "intranet",
36
        authnotrequired => 0,
37
        flagsrequired   => { borrowers => 1 },
38
        debug           => 1,
39
    }
40
);
41
42
my $borrowernumber = $input->param('borrowernumber');
43
44
# Set informations for the patron
45
my $borrower = GetMemberDetails( $borrowernumber, 0 );
46
foreach my $key ( keys %$borrower ) {
47
    $template->param( $key => $borrower->{$key} );
48
}
49
$template->param(
50
    categoryname => $borrower->{'description'},
51
    branchname   => GetBranchName( $borrower->{'branchcode'} ),
52
);
53
54
my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } );
55
56
$template->param( suggestions => $suggestions );
57
58
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/suggestion/suggestion.pl (-4 / +11 lines)
Lines 77-82 sub GetCriteriumDesc{ Link Here
77
}
77
}
78
78
79
my $input           = CGI->new;
79
my $input           = CGI->new;
80
my $redirect  = $input->param('redirect');
80
my $suggestedbyme   = (defined $input->param('suggestedbyme')? $input->param('suggestedbyme'):1);
81
my $suggestedbyme   = (defined $input->param('suggestedbyme')? $input->param('suggestedbyme'):1);
81
my $op              = $input->param('op')||'else';
82
my $op              = $input->param('op')||'else';
82
my @editsuggestions = $input->param('edit_field');
83
my @editsuggestions = $input->param('edit_field');
Lines 132-137 if ( $op =~ /save/i ) { Link Here
132
    }  
133
    }  
133
    map{delete $$suggestion_ref{$_}} keys %$suggestion_ref;
134
    map{delete $$suggestion_ref{$_}} keys %$suggestion_ref;
134
    $op = 'else';
135
    $op = 'else';
136
137
    if( $redirect ) {
138
        print $input->redirect("/cgi-bin/koha/members/purchase-suggestions.pl?borrowernumber=$redirect");
139
    }
140
135
}
141
}
136
elsif ($op=~/add/) {
142
elsif ($op=~/add/) {
137
    #Adds suggestion  
143
    #Adds suggestion  
Lines 362-371 for ( my $i = 0 ; $i < $count ; $i++ ) { Link Here
362
	$line{selected} = 1 if ($line{'currcode'} eq $selected_currency);
368
	$line{selected} = 1 if ($line{'currcode'} eq $selected_currency);
363
    push @loop_currency, \%line;
369
    push @loop_currency, \%line;
364
}
370
}
365
366
$template->param(loop_currency => \@loop_currency);
367
368
$template->param(
371
$template->param(
372
        loop_currency => \@loop_currency,
369
	price        => sprintf("%.2f", $$suggestion_ref{'price'}||0),
373
	price        => sprintf("%.2f", $$suggestion_ref{'price'}||0),
370
	total            => sprintf("%.2f", $$suggestion_ref{'total'}||0),
374
	total            => sprintf("%.2f", $$suggestion_ref{'total'}||0),
371
);
375
);
Lines 386-392 foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) { Link Here
386
    $hashlists{ lc($field) . "_loop" } = \@codes_list;
390
    $hashlists{ lc($field) . "_loop" } = \@codes_list;
387
}
391
}
388
$template->param(%hashlists);
392
$template->param(%hashlists);
393
389
$template->param(
394
$template->param(
395
    %hashlists,
396
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
397
    borrowernumber           => $input->param('borrowernumber'),
390
    SuggestionStatuses       => GetAuthorisedValues('SUGGEST_STATUS'),
398
    SuggestionStatuses       => GetAuthorisedValues('SUGGEST_STATUS'),
391
);
399
);
392
output_html_with_http_headers $input, $cookie, $template->output;
400
output_html_with_http_headers $input, $cookie, $template->output;
393
- 

Return to bug 9261