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

(-)a/acqui/basket.pl (-10 / +28 lines)
Lines 219-224 if ( $op eq 'delete_confirm' ) { Link Here
219
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
219
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
220
    exit;
220
    exit;
221
} else {
221
} else {
222
    my @branches_loop;
222
    # get librarian branch...
223
    # get librarian branch...
223
    if ( C4::Context->preference("IndependantBranches") ) {
224
    if ( C4::Context->preference("IndependantBranches") ) {
224
        my $userenv = C4::Context->userenv;
225
        my $userenv = C4::Context->userenv;
Lines 232-247 if ( $op eq 'delete_confirm' ) { Link Here
232
                exit 1;
233
                exit 1;
233
            }
234
            }
234
        }
235
        }
235
    }
236
        if (!defined $basket->{branch} or $basket->{branch} eq $userenv->{branch}) {
236
    # get branches
237
            push @branches_loop, {
237
    my $branches = C4::Branch::GetBranches;
238
                branchcode => $userenv->{branch},
238
    my @branches_loop;
239
                branchname => $userenv->{branchname},
239
    foreach my $branch (sort keys %$branches) {
240
                selected => 1,
240
        push @branches_loop, {
241
            };
241
            branchcode => $branch,
242
        }
242
            branchname => $branches->{$branch}->{branchname},
243
    } else {
243
            selected => (defined $basket->{branch} and $branch eq $basket->{branch}) ? 1 : 0
244
        # get branches
244
        };
245
        my $branches = C4::Branch::GetBranches;
246
        my @branchcodes = sort {
247
            $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
248
        } keys %$branches;
249
        foreach my $branch (@branchcodes) {
250
            my $selected = 0;
251
            if (defined $basket->{branch}) {
252
                $selected = 1 if $branch eq $basket->{branch};
253
            } else {
254
                $selected = 1 if $branch eq C4::Context->userenv->{branch};
255
            }
256
            push @branches_loop, {
257
                branchcode => $branch,
258
                branchname => $branches->{$branch}->{branchname},
259
                selected => $selected
260
            };
261
        }
245
    }
262
    }
246
263
247
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups
264
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups
Lines 362-367 if ( $op eq 'delete_confirm' ) { Link Here
362
    $template->param(
379
    $template->param(
363
        basketno             => $basketno,
380
        basketno             => $basketno,
364
        basketname           => $basket->{'basketname'},
381
        basketname           => $basket->{'basketname'},
382
        basketbranchname     => C4::Branch::GetBranchName($basket->{branch}),
365
        basketnote           => $basket->{note},
383
        basketnote           => $basket->{note},
366
        basketbooksellernote => $basket->{booksellernote},
384
        basketbooksellernote => $basket->{booksellernote},
367
        basketcontractno     => $basket->{contractnumber},
385
        basketcontractno     => $basket->{contractnumber},
(-)a/installer/data/mysql/de-DE/mandatory/userpermissions.sql (-1 / +1 lines)
Lines 16-22 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
16
   (11, 'budget_modify', 'Konten verändern (keine neuen anlegen, aber bestehende ändern)'),
16
   (11, 'budget_modify', 'Konten verändern (keine neuen anlegen, aber bestehende ändern)'),
17
   (11, 'planning_manage', 'Etatplanung verwalten'),
17
   (11, 'planning_manage', 'Etatplanung verwalten'),
18
   (11, 'order_manage', 'Bestellungen verwalten'),
18
   (11, 'order_manage', 'Bestellungen verwalten'),
19
   (11, 'order_manage_all', 'Manage all orders & baskets'),
19
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
20
   (11, 'group_manage', 'Bestellgruppen vewalten'),
20
   (11, 'group_manage', 'Bestellgruppen vewalten'),
21
   (11, 'order_receive', 'Lieferungen verwalten'),
21
   (11, 'order_receive', 'Lieferungen verwalten'),
22
   (11, 'budget_add_del', 'Konten hinzufügen/ändern, aber bestehende nicht ändern'),
22
   (11, 'budget_add_del', 'Konten hinzufügen/ändern, aber bestehende nicht ändern'),
(-)a/installer/data/mysql/en/mandatory/userpermissions.sql (-1 / +1 lines)
Lines 16-22 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
16
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
16
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
17
   (11, 'planning_manage', 'Manage budget plannings'),
17
   (11, 'planning_manage', 'Manage budget plannings'),
18
   (11, 'order_manage', 'Manage orders & basket'),
18
   (11, 'order_manage', 'Manage orders & basket'),
19
   (11, 'order_manage_all', 'Manage all orders & baskets'),
19
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
20
   (11, 'group_manage', 'Manage orders & basketgroups'),
20
   (11, 'group_manage', 'Manage orders & basketgroups'),
21
   (11, 'order_receive', 'Manage orders & basket'),
21
   (11, 'order_receive', 'Manage orders & basket'),
22
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
22
   (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 16-22 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
16
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
16
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
17
   (11, 'planning_manage', 'Manage budget plannings'),
17
   (11, 'planning_manage', 'Manage budget plannings'),
18
   (11, 'order_manage', 'Manage orders & basket'),
18
   (11, 'order_manage', 'Manage orders & basket'),
19
   (11, 'order_manage_all', 'Manage all orders & baskets'),
19
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
20
   (11, 'group_manage', 'Manage orders & basketgroups'),
20
   (11, 'group_manage', 'Manage orders & basketgroups'),
21
   (11, 'order_receive', 'Manage orders & basket'),
21
   (11, 'order_receive', 'Manage orders & basket'),
22
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
22
   (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 33-39 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
33
   (11, 'budget_modify', 'Modifier les budgets (impossible de créer les lignes, mais possible de modifier celles qui existent'),
33
   (11, 'budget_modify', 'Modifier les budgets (impossible de créer les lignes, mais possible de modifier celles qui existent'),
34
   (11, 'planning_manage', 'Gérer de la planification des budgets'),
34
   (11, 'planning_manage', 'Gérer de la planification des budgets'),
35
   (11, 'order_manage', 'Gérer les commandes et les paniers'),
35
   (11, 'order_manage', 'Gérer les commandes et les paniers'),
36
   (11, 'order_manage_all', 'Gérer toutes les commandes et panier'),
36
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
37
   (11, 'group_manage', 'Gérer les commandes et les bons de commande'),
37
   (11, 'group_manage', 'Gérer les commandes et les bons de commande'),
38
   (11, 'order_receive', 'Gérer les réceptions'),
38
   (11, 'order_receive', 'Gérer les réceptions'),
39
   (11, 'budget_add_del', 'Ajouter et supprimer les budgets (mais pas modifier)'),
39
   (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 18-24 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
18
   (11, 'budget_modify', 'Modifica budget (non li crea ma modifica gli esistenti)'),
18
   (11, 'budget_modify', 'Modifica budget (non li crea ma modifica gli esistenti)'),
19
   (11, 'planning_manage', 'Intervieni sulla pianificazione dei budgets'),
19
   (11, 'planning_manage', 'Intervieni sulla pianificazione dei budgets'),
20
   (11, 'order_manage', 'Gestisci ordini e raccoglitori'),
20
   (11, 'order_manage', 'Gestisci ordini e raccoglitori'),
21
   (11, 'order_manage_all', 'Manage all orders & baskets'),
21
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
22
   (11, 'group_manage', 'Gestisci ordini e raccoglitori raggruppati'),
22
   (11, 'group_manage', 'Gestisci ordini e raccoglitori raggruppati'),
23
   (11, 'order_receive', 'Gestisci arrivi'),
23
   (11, 'order_receive', 'Gestisci arrivi'),
24
   (11, 'budget_add_del', 'Aggiungi e cancella budgets (senza modificarli)'),
24
   (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 16-22 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
16
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
16
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
17
   (11, 'planning_manage', 'Manage budget plannings'),
17
   (11, 'planning_manage', 'Manage budget plannings'),
18
   (11, 'order_manage', 'Manage orders & basket'),
18
   (11, 'order_manage', 'Manage orders & basket'),
19
   (11, 'order_manage_all', 'Manage all orders & baskets'),
19
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
20
   (11, 'group_manage', 'Manage orders & basketgroups'),
20
   (11, 'group_manage', 'Manage orders & basketgroups'),
21
   (11, 'order_receive', 'Manage orders & basket'),
21
   (11, 'order_receive', 'Manage orders & basket'),
22
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
22
   (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 41-47 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
41
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
41
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
42
   (11, 'planning_manage', 'Manage budget plannings'),
42
   (11, 'planning_manage', 'Manage budget plannings'),
43
   (11, 'order_manage', 'Manage orders & basket'),
43
   (11, 'order_manage', 'Manage orders & basket'),
44
   (11, 'order_manage_all', 'Manage all orders & baskets'),
44
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
45
   (11, 'group_manage', 'Manage orders & basketgroups'),
45
   (11, 'group_manage', 'Manage orders & basketgroups'),
46
   (11, 'order_receive', 'Manage orders & basket'),
46
   (11, 'order_receive', 'Manage orders & basket'),
47
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
47
   (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 41-47 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
41
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
41
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
42
   (11, 'planning_manage', 'Manage budget plannings'),
42
   (11, 'planning_manage', 'Manage budget plannings'),
43
   (11, 'order_manage', 'Manage orders & basket'),
43
   (11, 'order_manage', 'Manage orders & basket'),
44
   (11, 'order_manage_all', 'Manage all orders & baskets'),
44
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
45
   (11, 'group_manage', 'Manage orders & basketgroups'),
45
   (11, 'group_manage', 'Manage orders & basketgroups'),
46
   (11, 'order_receive', 'Manage orders & basket'),
46
   (11, 'order_receive', 'Manage orders & basket'),
47
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
47
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +1 lines)
Lines 6796-6802 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
6796
    ");
6796
    ");
6797
    $dbh->do("
6797
    $dbh->do("
6798
        INSERT INTO permissions (module_bit, code, description)
6798
        INSERT INTO permissions (module_bit, code, description)
6799
        VALUES (11, 'order_manage_all', 'Manage all orders & baskets')
6799
        VALUES (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them')
6800
    ");
6800
    ");
6801
6801
6802
    print "Upgrade to $DBversion done (Add branch and users list to baskets. "
6802
    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 233-239 Link Here
233
                [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
233
                [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
234
                [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
234
                [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
235
                [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
235
                [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
236
                <li>
236
                <li id="managedby">
237
                    <form action="" method="post">
237
                    <form action="" method="post">
238
                        <span class="label">Managed by:</span>
238
                        <span class="label">Managed by:</span>
239
                        <div style="float:left">
239
                        <div style="float:left">
Lines 253-275 Link Here
253
                        </div>
253
                        </div>
254
                    </form>
254
                    </form>
255
                </li>
255
                </li>
256
                <li>
256
                <li id="branch">
257
                    <form action="" method="post">
257
                    <span class="label">Branch:</span>
258
                        <span class="label">Branch:</span>
258
                    [% IF basketbranchname %]
259
                        <select id="branch" name="branch">
259
                        [% basketbranchname %]
260
                            <option value="">No branch</option>
260
                    [% ELSE %]
261
                            [% FOREACH branch IN branches_loop %]
261
                        No branch
262
                                [% IF (branch.selected) %]
262
                    [% END %]
263
                                    <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
263
                    [% IF branches_loop.size %]
264
                                [% ELSE %]
264
                        <form action="" method="post">
265
                                    <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
265
                            <select id="branch" name="branch">
266
                                <option value="">(no branch)</option>
267
                                [% FOREACH branch IN branches_loop %]
268
                                    [% IF (branch.selected) %]
269
                                        <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
270
                                    [% ELSE %]
271
                                        <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
272
                                    [% END %]
266
                                [% END %]
273
                                [% END %]
267
                            [% END %]
274
                            </select>
268
                        </select>
275
                            <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
269
                        <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
276
                            <input type="hidden" id="op" name="op" value="mod_branch" />
270
                        <input type="hidden" id="op" name="op" value="mod_branch" />
277
                            <input type="submit" value="Change" />
271
                        <input type="submit" value="Save" />
278
                        </form>
272
                    </form>
279
                    [% END %]
273
                </li>
280
                </li>
274
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
281
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
275
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
282
                [% 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