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

(-)a/acqui/basket.pl (-10 / +28 lines)
Lines 217-222 if ( $op eq 'delete_confirm' ) { Link Here
217
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
217
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
218
    exit;
218
    exit;
219
} else {
219
} else {
220
    my @branches_loop;
220
    # get librarian branch...
221
    # get librarian branch...
221
    if ( C4::Context->preference("IndependantBranches") ) {
222
    if ( C4::Context->preference("IndependantBranches") ) {
222
        my $userenv = C4::Context->userenv;
223
        my $userenv = C4::Context->userenv;
Lines 230-245 if ( $op eq 'delete_confirm' ) { Link Here
230
                exit 1;
231
                exit 1;
231
            }
232
            }
232
        }
233
        }
233
    }
234
        if (!defined $basket->{branch} or $basket->{branch} eq $userenv->{branch}) {
234
    # get branches
235
            push @branches_loop, {
235
    my $branches = C4::Branch::GetBranches;
236
                branchcode => $userenv->{branch},
236
    my @branches_loop;
237
                branchname => $userenv->{branchname},
237
    foreach my $branch (sort keys %$branches) {
238
                selected => 1,
238
        push @branches_loop, {
239
            };
239
            branchcode => $branch,
240
        }
240
            branchname => $branches->{$branch}->{branchname},
241
    } else {
241
            selected => (defined $basket->{branch} and $branch eq $basket->{branch}) ? 1 : 0
242
        # get branches
242
        };
243
        my $branches = C4::Branch::GetBranches;
244
        my @branchcodes = sort {
245
            $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
246
        } keys %$branches;
247
        foreach my $branch (@branchcodes) {
248
            my $selected = 0;
249
            if (defined $basket->{branch}) {
250
                $selected = 1 if $branch eq $basket->{branch};
251
            } else {
252
                $selected = 1 if $branch eq C4::Context->userenv->{branch};
253
            }
254
            push @branches_loop, {
255
                branchcode => $branch,
256
                branchname => $branches->{$branch}->{branchname},
257
                selected => $selected
258
            };
259
        }
243
    }
260
    }
244
261
245
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups
262
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups
Lines 424-429 if ( $op eq 'delete_confirm' ) { Link Here
424
    $template->param(
441
    $template->param(
425
        basketno             => $basketno,
442
        basketno             => $basketno,
426
        basketname           => $basket->{'basketname'},
443
        basketname           => $basket->{'basketname'},
444
        basketbranchname     => C4::Branch::GetBranchName($basket->{branch}),
427
        basketnote           => $basket->{note},
445
        basketnote           => $basket->{note},
428
        basketbooksellernote => $basket->{booksellernote},
446
        basketbooksellernote => $basket->{booksellernote},
429
        basketcontractno     => $basket->{contractnumber},
447
        basketcontractno     => $basket->{contractnumber},
(-)a/installer/data/mysql/de-DE/mandatory/userpermissions.sql (-1 / +1 lines)
Lines 15-21 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
15
   (11, 'budget_modify', 'Konten verändern (keine neuen anlegen, aber bestehende ändern)'),
15
   (11, 'budget_modify', 'Konten verändern (keine neuen anlegen, aber bestehende ändern)'),
16
   (11, 'planning_manage', 'Etatplanung verwalten'),
16
   (11, 'planning_manage', 'Etatplanung verwalten'),
17
   (11, 'order_manage', 'Bestellungen verwalten'),
17
   (11, 'order_manage', 'Bestellungen verwalten'),
18
   (11, 'order_manage_all', 'Manage all orders & baskets'),
18
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
19
   (11, 'group_manage', 'Bestellgruppen vewalten'),
19
   (11, 'group_manage', 'Bestellgruppen vewalten'),
20
   (11, 'order_receive', 'Lieferungen verwalten'),
20
   (11, 'order_receive', 'Lieferungen verwalten'),
21
   (11, 'budget_add_del', 'Konten hinzufügen/ändern, aber bestehende nicht ändern'),
21
   (11, 'budget_add_del', 'Konten hinzufügen/ändern, aber bestehende nicht ändern'),
(-)a/installer/data/mysql/en/mandatory/userpermissions.sql (-1 / +1 lines)
Lines 15-21 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
15
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
15
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
16
   (11, 'planning_manage', 'Manage budget plannings'),
16
   (11, 'planning_manage', 'Manage budget plannings'),
17
   (11, 'order_manage', 'Manage orders & basket'),
17
   (11, 'order_manage', 'Manage orders & basket'),
18
   (11, 'order_manage_all', 'Manage all orders & baskets'),
18
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
19
   (11, 'group_manage', 'Manage orders & basketgroups'),
19
   (11, 'group_manage', 'Manage orders & basketgroups'),
20
   (11, 'order_receive', 'Manage orders & basket'),
20
   (11, 'order_receive', 'Manage orders & basket'),
21
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
21
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
(-)a/installer/data/mysql/es-ES/mandatory/userpermissions.sql (-1 / +1 lines)
Lines 15-21 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
15
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
15
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
16
   (11, 'planning_manage', 'Manage budget plannings'),
16
   (11, 'planning_manage', 'Manage budget plannings'),
17
   (11, 'order_manage', 'Manage orders & basket'),
17
   (11, 'order_manage', 'Manage orders & basket'),
18
   (11, 'order_manage_all', 'Manage all orders & baskets'),
18
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
19
   (11, 'group_manage', 'Manage orders & basketgroups'),
19
   (11, 'group_manage', 'Manage orders & basketgroups'),
20
   (11, 'order_receive', 'Manage orders & basket'),
20
   (11, 'order_receive', 'Manage orders & basket'),
21
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
21
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql (-1 / +1 lines)
Lines 32-38 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
32
   (11, 'budget_modify', 'Modifier les budgets (impossible de créer les lignes, mais possible de modifier celles qui existent'),
32
   (11, 'budget_modify', 'Modifier les budgets (impossible de créer les lignes, mais possible de modifier celles qui existent'),
33
   (11, 'planning_manage', 'Gérer de la planification des budgets'),
33
   (11, 'planning_manage', 'Gérer de la planification des budgets'),
34
   (11, 'order_manage', 'Gérer les commandes et les paniers'),
34
   (11, 'order_manage', 'Gérer les commandes et les paniers'),
35
   (11, 'order_manage_all', 'Gérer toutes les commandes et panier'),
35
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
36
   (11, 'group_manage', 'Gérer les commandes et les bons de commande'),
36
   (11, 'group_manage', 'Gérer les commandes et les bons de commande'),
37
   (11, 'order_receive', 'Gérer les réceptions'),
37
   (11, 'order_receive', 'Gérer les réceptions'),
38
   (11, 'budget_add_del', 'Ajouter et supprimer les budgets (mais pas modifier)'),
38
   (11, 'budget_add_del', 'Ajouter et supprimer les budgets (mais pas modifier)'),
(-)a/installer/data/mysql/it-IT/necessari/userpermissions.sql (-1 / +1 lines)
Lines 17-23 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
17
   (11, 'budget_modify', 'Modifica budget (non li crea ma modifica gli esistenti)'),
17
   (11, 'budget_modify', 'Modifica budget (non li crea ma modifica gli esistenti)'),
18
   (11, 'planning_manage', 'Intervieni sulla pianificazione dei budgets'),
18
   (11, 'planning_manage', 'Intervieni sulla pianificazione dei budgets'),
19
   (11, 'order_manage', 'Gestisci ordini e raccoglitori'),
19
   (11, 'order_manage', 'Gestisci ordini e raccoglitori'),
20
   (11, 'order_manage_all', 'Manage all orders & baskets'),
20
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
21
   (11, 'group_manage', 'Gestisci ordini e raccoglitori raggruppati'),
21
   (11, 'group_manage', 'Gestisci ordini e raccoglitori raggruppati'),
22
   (11, 'order_receive', 'Gestisci arrivi'),
22
   (11, 'order_receive', 'Gestisci arrivi'),
23
   (11, 'budget_add_del', 'Aggiungi e cancella budgets (senza modificarli)'),
23
   (11, 'budget_add_del', 'Aggiungi e cancella budgets (senza modificarli)'),
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql (-1 / +1 lines)
Lines 36-42 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
36
   (11, 'budget_modify', 'Endre budsjetter (kan ikke legge til kontolinjer, men endre eksisterende)'),
36
   (11, 'budget_modify', 'Endre budsjetter (kan ikke legge til kontolinjer, men endre eksisterende)'),
37
   (11, 'planning_manage', 'Administrere budsjettplaner'),
37
   (11, 'planning_manage', 'Administrere budsjettplaner'),
38
   (11, 'order_manage', 'Administrere bestillinger og kurver'),
38
   (11, 'order_manage', 'Administrere bestillinger og kurver'),
39
   (11, 'order_manage_all', 'Manage all orders & baskets'),
39
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
40
   (11, 'group_manage', 'Administrere bestillinger og kurv-grupper'),
40
   (11, 'group_manage', 'Administrere bestillinger og kurv-grupper'),
41
   (11, 'order_receive', 'Administrere bestillinger og kurver'),
41
   (11, 'order_receive', 'Administrere bestillinger og kurver'),
42
   (11, 'budget_add_del', 'Legge til og slette budsjetter (men ikke endre budsjetter)'),
42
   (11, 'budget_add_del', 'Legge til og slette budsjetter (men ikke endre budsjetter)'),
(-)a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql (-1 / +1 lines)
Lines 15-21 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
15
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
15
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
16
   (11, 'planning_manage', 'Manage budget plannings'),
16
   (11, 'planning_manage', 'Manage budget plannings'),
17
   (11, 'order_manage', 'Manage orders & basket'),
17
   (11, 'order_manage', 'Manage orders & basket'),
18
   (11, 'order_manage_all', 'Manage all orders & baskets'),
18
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
19
   (11, 'group_manage', 'Manage orders & basketgroups'),
19
   (11, 'group_manage', 'Manage orders & basketgroups'),
20
   (11, 'order_receive', 'Manage orders & basket'),
20
   (11, 'order_receive', 'Manage orders & basket'),
21
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
21
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
(-)a/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql (-1 / +1 lines)
Lines 39-45 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
39
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
39
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
40
   (11, 'planning_manage', 'Manage budget plannings'),
40
   (11, 'planning_manage', 'Manage budget plannings'),
41
   (11, 'order_manage', 'Manage orders & basket'),
41
   (11, 'order_manage', 'Manage orders & basket'),
42
   (11, 'order_manage_all', 'Manage all orders & baskets'),
42
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
43
   (11, 'group_manage', 'Manage orders & basketgroups'),
43
   (11, 'group_manage', 'Manage orders & basketgroups'),
44
   (11, 'order_receive', 'Manage orders & basket'),
44
   (11, 'order_receive', 'Manage orders & basket'),
45
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
45
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
(-)a/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql (-1 / +1 lines)
Lines 39-45 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
39
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
39
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
40
   (11, 'planning_manage', 'Manage budget plannings'),
40
   (11, 'planning_manage', 'Manage budget plannings'),
41
   (11, 'order_manage', 'Manage orders & basket'),
41
   (11, 'order_manage', 'Manage orders & basket'),
42
   (11, 'order_manage_all', 'Manage all orders & baskets'),
42
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
43
   (11, 'group_manage', 'Manage orders & basketgroups'),
43
   (11, 'group_manage', 'Manage orders & basketgroups'),
44
   (11, 'order_receive', 'Manage orders & basket'),
44
   (11, 'order_receive', 'Manage orders & basket'),
45
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
45
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +1 lines)
Lines 5635-5641 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5635
    ");
5635
    ");
5636
    $dbh->do("
5636
    $dbh->do("
5637
        INSERT INTO permissions (module_bit, code, description)
5637
        INSERT INTO permissions (module_bit, code, description)
5638
        VALUES (11, 'order_manage_all', 'Manage all orders & baskets')
5638
        VALUES (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them')
5639
    ");
5639
    ");
5640
5640
5641
    print "Upgrade to $DBversion done (Add branch and users list to baskets. "
5641
    print "Upgrade to $DBversion done (Add branch and users list to baskets. "
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-17 / +24 lines)
Lines 231-237 Link Here
231
                    <li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]&amp;booksellerid=[% booksellerid %]">[% basketcontractname %]</a></li>
231
                    <li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]&amp;booksellerid=[% booksellerid %]">[% basketcontractname %]</a></li>
232
                [% END %]
232
                [% END %]
233
                [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
233
                [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
234
                <li>
234
                <li id="managedby">
235
                    <form action="" method="post">
235
                    <form action="" method="post">
236
                        <span class="label">Managed by:</span>
236
                        <span class="label">Managed by:</span>
237
                        <div style="float:left">
237
                        <div style="float:left">
Lines 251-273 Link Here
251
                        </div>
251
                        </div>
252
                    </form>
252
                    </form>
253
                </li>
253
                </li>
254
                <li>
254
                <li id="branch">
255
                    <form action="" method="post">
255
                    <span class="label">Branch:</span>
256
                        <span class="label">Branch:</span>
256
                    [% IF basketbranchname %]
257
                        <select id="branch" name="branch">
257
                        [% basketbranchname %]
258
                            <option value="">No branch</option>
258
                    [% ELSE %]
259
                            [% FOREACH branch IN branches_loop %]
259
                        No branch
260
                                [% IF (branch.selected) %]
260
                    [% END %]
261
                                    <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
261
                    [% IF branches_loop.size %]
262
                                [% ELSE %]
262
                        <form action="" method="post">
263
                                    <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
263
                            <select id="branch" name="branch">
264
                                <option value="">(no branch)</option>
265
                                [% FOREACH branch IN branches_loop %]
266
                                    [% IF (branch.selected) %]
267
                                        <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
268
                                    [% ELSE %]
269
                                        <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
270
                                    [% END %]
264
                                [% END %]
271
                                [% END %]
265
                            [% END %]
272
                            </select>
266
                        </select>
273
                            <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
267
                        <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
274
                            <input type="hidden" id="op" name="op" value="mod_branch" />
268
                        <input type="hidden" id="op" name="op" value="mod_branch" />
275
                            <input type="submit" value="Change" />
269
                        <input type="submit" value="Save" />
276
                        </form>
270
                    </form>
277
                    [% END %]
271
                </li>
278
                </li>
272
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
279
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
273
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
280
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
(-)a/t/Acquisition/CanUserManageBasket.t (-6 / +5 lines)
Lines 1-15 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::MockModule;
5
use Test::More tests => 42;
4
use Test::More tests => 42;
6
5
7
use C4::Acquisition;
6
use C4::Acquisition;
8
7
9
my $C4_Acquisition_module = new Test::MockModule('C4::Acquisition');
8
# Avoid "redefined subroutine" warnings
10
$C4_Acquisition_module->mock('GetBasketUsers', \&Mock_GetBasketUsers);
9
local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /redefined/ };
11
my $C4_Context_module = new Test::MockModule('C4::Context');
10
12
$C4_Context_module->mock('preference', \&Mock_preference);
11
*C4::Acquisition::GetBasketUsers = \&Mock_GetBasketUsers;
12
*C4::Context::preference = \&Mock_preference;
13
13
14
my $AcqViewBaskets;
14
my $AcqViewBaskets;
15
my %basketusers = (
15
my %basketusers = (
16
- 

Return to bug 7295