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("IndependentBranches") ) {
224
    if ( C4::Context->preference("IndependentBranches") ) {
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 358-363 if ( $op eq 'delete_confirm' ) { Link Here
358
    $template->param(
375
    $template->param(
359
        basketno             => $basketno,
376
        basketno             => $basketno,
360
        basketname           => $basket->{'basketname'},
377
        basketname           => $basket->{'basketname'},
378
        basketbranchname     => C4::Branch::GetBranchName($basket->{branch}),
361
        basketnote           => $basket->{note},
379
        basketnote           => $basket->{note},
362
        basketbooksellernote => $basket->{booksellernote},
380
        basketbooksellernote => $basket->{booksellernote},
363
        basketcontractno     => $basket->{contractnumber},
381
        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 42-48 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
42
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
42
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
43
   (11, 'planning_manage', 'Manage budget plannings'),
43
   (11, 'planning_manage', 'Manage budget plannings'),
44
   (11, 'order_manage', 'Manage orders & basket'),
44
   (11, 'order_manage', 'Manage orders & basket'),
45
   (11, 'order_manage_all', 'Manage all orders & baskets'),
45
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
46
   (11, 'group_manage', 'Manage orders & basketgroups'),
46
   (11, 'group_manage', 'Manage orders & basketgroups'),
47
   (11, 'order_receive', 'Manage orders & basket'),
47
   (11, 'order_receive', 'Manage orders & basket'),
48
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
48
   (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 42-48 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
42
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
42
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
43
   (11, 'planning_manage', 'Manage budget plannings'),
43
   (11, 'planning_manage', 'Manage budget plannings'),
44
   (11, 'order_manage', 'Manage orders & basket'),
44
   (11, 'order_manage', 'Manage orders & basket'),
45
   (11, 'order_manage_all', 'Manage all orders & baskets'),
45
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
46
   (11, 'group_manage', 'Manage orders & basketgroups'),
46
   (11, 'group_manage', 'Manage orders & basketgroups'),
47
   (11, 'order_receive', 'Manage orders & basket'),
47
   (11, 'order_receive', 'Manage orders & basket'),
48
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
48
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +1 lines)
Lines 7092-7098 if ( CheckVersion($DBversion) ) { Link Here
7092
    ");
7092
    ");
7093
    $dbh->do("
7093
    $dbh->do("
7094
        INSERT INTO permissions (module_bit, code, description)
7094
        INSERT INTO permissions (module_bit, code, description)
7095
        VALUES (11, 'order_manage_all', 'Manage all orders & baskets')
7095
        VALUES (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them')
7096
    ");
7096
    ");
7097
7097
7098
    print "Upgrade to $DBversion done (Add branch and users list to baskets. "
7098
    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 239-245 Link Here
239
                [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
239
                [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
240
                [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
240
                [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
241
                [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
241
                [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
242
                <li>
242
                <li id="managedby">
243
                    <form action="" method="post">
243
                    <form action="" method="post">
244
                        <span class="label">Managed by:</span>
244
                        <span class="label">Managed by:</span>
245
                        <div style="float:left">
245
                        <div style="float:left">
Lines 259-281 Link Here
259
                        </div>
259
                        </div>
260
                    </form>
260
                    </form>
261
                </li>
261
                </li>
262
                <li>
262
                <li id="branch">
263
                    <form action="" method="post">
263
                    <span class="label">Branch:</span>
264
                        <span class="label">Branch:</span>
264
                    [% IF basketbranchname %]
265
                        <select id="branch" name="branch">
265
                        [% basketbranchname %]
266
                            <option value="">No branch</option>
266
                    [% ELSE %]
267
                            [% FOREACH branch IN branches_loop %]
267
                        No branch
268
                                [% IF (branch.selected) %]
268
                    [% END %]
269
                                    <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
269
                    [% IF branches_loop.size %]
270
                                [% ELSE %]
270
                        <form action="" method="post">
271
                                    <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
271
                            <select id="branch" name="branch">
272
                                <option value="">(no branch)</option>
273
                                [% FOREACH branch IN branches_loop %]
274
                                    [% IF (branch.selected) %]
275
                                        <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
276
                                    [% ELSE %]
277
                                        <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
278
                                    [% END %]
272
                                [% END %]
279
                                [% END %]
273
                            [% END %]
280
                            </select>
274
                        </select>
281
                            <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
275
                        <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
282
                            <input type="hidden" id="op" name="op" value="mod_branch" />
276
                        <input type="hidden" id="op" name="op" value="mod_branch" />
283
                            <input type="submit" value="Change" />
277
                        <input type="submit" value="Save" />
284
                        </form>
278
                    </form>
285
                    [% END %]
279
                </li>
286
                </li>
280
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
287
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
281
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
288
                [% 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