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

(-)a/acqui/invoice.pl (-1 / +7 lines)
Lines 52-57 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( Link Here
52
    }
52
    }
53
);
53
);
54
54
55
my $logged_in_patron = Koha::Patrons->find( $loggedinuser );
56
55
my $invoiceid = $input->param('invoiceid');
57
my $invoiceid = $input->param('invoiceid');
56
my $op        = $input->param('op');
58
my $op        = $input->param('op');
57
59
Lines 70-75 if ( $op && $op eq 'close' ) { Link Here
70
    }
72
    }
71
}
73
}
72
elsif ( $op && $op eq 'reopen' ) {
74
elsif ( $op && $op eq 'reopen' ) {
75
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
76
        unless $logged_in_patron->has_permission( { acquisition => 'reopen_closed_invoices' } );
77
73
    ReopenInvoice($invoiceid);
78
    ReopenInvoice($invoiceid);
74
    my $referer = $input->param('referer');
79
    my $referer = $input->param('referer');
75
    if ($referer) {
80
    if ($referer) {
Lines 90-96 elsif ( $op && $op eq 'mod' ) { Link Here
90
        shipmentcost_budgetid => $shipment_budget_id
95
        shipmentcost_budgetid => $shipment_budget_id
91
    );
96
    );
92
    if ($input->param('reopen')) {
97
    if ($input->param('reopen')) {
93
        ReopenInvoice($invoiceid);
98
        ReopenInvoice($invoiceid)
99
            if $logged_in_patron->has_permission( { acquisition => 'reopen_closed_invoices' } );
94
    } elsif ($input->param('close')) {
100
    } elsif ($input->param('close')) {
95
        CloseInvoice($invoiceid);
101
        CloseInvoice($invoiceid);
96
    } elsif ($input->param('merge')) {
102
    } elsif ($input->param('merge')) {
(-)a/installer/data/mysql/atomicupdate/bug_24157.perl (+10 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q|
4
        INSERT IGNORE INTO permissions (module_bit, code, description) VALUES
5
        (11, 'reopen_closed_invoices', 'Reopen closed invoices')
6
    |);
7
8
    SetVersion( $DBversion );
9
    print "Upgrade to $DBversion done (Bug 24157: Add new permission reopen_closed_invoices)\n";
10
}
(-)a/installer/data/mysql/userpermissions.sql (+1 lines)
Lines 62-67 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
62
   (11, 'budget_add_del', 'Add and delete funds (but can''t modify funds)'),
62
   (11, 'budget_add_del', 'Add and delete funds (but can''t modify funds)'),
63
   (11, 'budget_manage_all', 'Manage all funds'),
63
   (11, 'budget_manage_all', 'Manage all funds'),
64
   (11, 'edi_manage', 'Manage EDIFACT transmissions'),
64
   (11, 'edi_manage', 'Manage EDIFACT transmissions'),
65
   (11, 'reopen_closed_invoices', 'Reopen closed invoices'),
65
   (12, 'suggestions_manage', 'Manage purchase suggestions'),
66
   (12, 'suggestions_manage', 'Manage purchase suggestions'),
66
   (13, 'edit_news', 'Write news for the OPAC and staff interfaces'),
67
   (13, 'edit_news', 'Write news for the OPAC and staff interfaces'),
67
   (13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'),
68
   (13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc (+2 lines)
Lines 17-22 Link Here
17
        <div class="dialog message">The form submission failed (Wrong CSRF token). Try to come back, refresh the page, then try again.</div>
17
        <div class="dialog message">The form submission failed (Wrong CSRF token). Try to come back, refresh the page, then try again.</div>
18
    [% CASE 'budget_is_locked' %]
18
    [% CASE 'budget_is_locked' %]
19
        <div class="dialog message">The budget is locked, fund creation is not possible.</div>
19
        <div class="dialog message">The budget is locked, fund creation is not possible.</div>
20
    [% CASE 'insufficient_permission' %]
21
        <div class="dialog message">You do not have sufficient permission to continue.</div>
20
    [% CASE %][% blocking_error | html %]
22
    [% CASE %][% blocking_error | html %]
21
    [% END %]
23
    [% END %]
22
24
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (+5 lines)
Lines 667-672 Link Here
667
            Manage EDIFACT transmissions
667
            Manage EDIFACT transmissions
668
        </span>
668
        </span>
669
        <span class="permissioncode">([% name | html %])</span>
669
        <span class="permissioncode">([% name | html %])</span>
670
    [%- CASE 'reopen_closed_invoices' -%]
671
        <span class="sub_permission reopen_closed_invoices_subpermission">
672
            Reopen closed invoices
673
        </span>
674
        <span class="permissioncode">([% name | html %])</span>
670
  [%# self_check %]
675
  [%# self_check %]
671
    [%- CASE 'self_checkin_module' -%]
676
    [%- CASE 'self_checkin_module' -%]
672
        <span class="sub_permission self_checkin_module_subpermission">
677
        <span class="sub_permission self_checkin_module_subpermission">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (-3 / +16 lines)
Lines 15-20 Link Here
15
[% INCLUDE 'header.inc' %]
15
[% INCLUDE 'header.inc' %]
16
[% INCLUDE 'acquisitions-search.inc' %]
16
[% INCLUDE 'acquisitions-search.inc' %]
17
17
18
[% SET readonly = NOT CAN_user_acquisition_edit_invoices %]
19
18
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | html %]">[% invoicenumber | html %]</a></div>
20
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | html %]">[% invoicenumber | html %]</a></div>
19
21
20
<div class="main container-fluid">
22
<div class="main container-fluid">
Lines 35-42 Link Here
35
            <ol>
37
            <ol>
36
            <li>
38
            <li>
37
                <label for="shipmentdate" class="required">Invoice number:</label>
39
                <label for="shipmentdate" class="required">Invoice number:</label>
38
                <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="required" required="required"/>
40
                [% IF readonly %]
39
                <span class="required">Required</span>
41
                    [% invoicenumber | html %]
42
                [% ELSE %]
43
                    <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="required" required="required"/>
44
                    <span class="required">Required</span>
45
                [% END %]
40
            </li>
46
            </li>
41
47
42
            <li><label for="shipmentdate">Shipment date:</label>
48
            <li><label for="shipmentdate">Shipment date:</label>
Lines 71-77 Link Here
71
            <li><span class="label">Status:</span>
77
            <li><span class="label">Status:</span>
72
                Closed on [% invoiceclosedate | $KohaDates %]</li>
78
                Closed on [% invoiceclosedate | $KohaDates %]</li>
73
79
74
            <li><label for="reopen">Reopen: </label> <input type="checkbox" name="reopen" id="reopen" /></li>
80
            <li>
81
                <label for="reopen">Reopen: </label>
82
                [% IF CAN_user_acquisition_reopen_closed_invoices %]
83
                    <input type="checkbox" name="reopen" id="reopen" />
84
                [% ELSE %]
85
                    <input type="checkbox" name="reopen" id="reopen" readonly="readonly" />
86
                [% END %]
87
            </li>
75
            [% ELSE %]
88
            [% ELSE %]
76
            <li><span class="label">Status:</span>
89
            <li><span class="label">Status:</span>
77
                Open</li>
90
                Open</li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (-1 / +3 lines)
Lines 81-87 Link Here
81
                          <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid | html %]">
81
                          <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid | html %]">
82
                              <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]"><i class="fa fa-search"></i> Details</a></li>
82
                              <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]"><i class="fa fa-search"></i> Details</a></li>
83
                            [% IF invoice.closedate %]
83
                            [% IF invoice.closedate %]
84
                                <li><a href="invoice.pl?op=reopen&amp;invoiceid=[% invoice.invoiceid | uri %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa fa-refresh"></i> Reopen</a></li>
84
                                [% IF CAN_user_acquisition_reopen_closed_invoices %]
85
                                    <li><a href="invoice.pl?op=reopen&amp;invoiceid=[% invoice.invoiceid | uri %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa fa-refresh"></i> Reopen</a></li>
86
                                [% END %]
85
                            [% ELSE %]
87
                            [% ELSE %]
86
                                <li><a href="invoice.pl?op=close&amp;invoiceid=[% invoice.invoiceid | uri %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa fa-times-circle"></i> Close</a></li>
88
                                <li><a href="invoice.pl?op=close&amp;invoiceid=[% invoice.invoiceid | uri %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa fa-times-circle"></i> Close</a></li>
87
                            [% END %]
89
                            [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-2 / +3 lines)
Lines 213-219 Link Here
213
[% ELSE %]
213
[% ELSE %]
214
    <p>
214
    <p>
215
        Invoice is closed, so you can't receive orders anymore.
215
        Invoice is closed, so you can't receive orders anymore.
216
        <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid | uri %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]">Reopen it</a>.
216
        [% IF CAN_user_acquisition_reopen_closed_invoices %]
217
            <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid | uri %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]">Reopen it</a>.
218
        [% END %]
217
    </p>
219
    </p>
218
[% END %]
220
[% END %]
219
221
220
- 

Return to bug 24157