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 40-46 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
40
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
40
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
41
   (11, 'planning_manage', 'Manage budget plannings'),
41
   (11, 'planning_manage', 'Manage budget plannings'),
42
   (11, 'order_manage', 'Manage orders & basket'),
42
   (11, 'order_manage', 'Manage orders & basket'),
43
   (11, 'order_manage_all', 'Manage all orders & baskets'),
43
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
44
   (11, 'group_manage', 'Manage orders & basketgroups'),
44
   (11, 'group_manage', 'Manage orders & basketgroups'),
45
   (11, 'order_receive', 'Manage orders & basket'),
45
   (11, 'order_receive', 'Manage orders & basket'),
46
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
46
   (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 40-46 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
40
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
40
   (11, 'budget_modify', 'Modify budget (can''t create lines, but can modify existing ones)'),
41
   (11, 'planning_manage', 'Manage budget plannings'),
41
   (11, 'planning_manage', 'Manage budget plannings'),
42
   (11, 'order_manage', 'Manage orders & basket'),
42
   (11, 'order_manage', 'Manage orders & basket'),
43
   (11, 'order_manage_all', 'Manage all orders & baskets'),
43
   (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them'),
44
   (11, 'group_manage', 'Manage orders & basketgroups'),
44
   (11, 'group_manage', 'Manage orders & basketgroups'),
45
   (11, 'order_receive', 'Manage orders & basket'),
45
   (11, 'order_receive', 'Manage orders & basket'),
46
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
46
   (11, 'budget_add_del', 'Add and delete budgets (but cant modify budgets)'),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +1 lines)
Lines 6557-6563 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
6557
    ");
6557
    ");
6558
    $dbh->do("
6558
    $dbh->do("
6559
        INSERT INTO permissions (module_bit, code, description)
6559
        INSERT INTO permissions (module_bit, code, description)
6560
        VALUES (11, 'order_manage_all', 'Manage all orders & baskets')
6560
        VALUES (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them')
6561
    ");
6561
    ");
6562
6562
6563
    print "Upgrade to $DBversion done (Add branch and users list to baskets. "
6563
    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 261-267 Link Here
261
                [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
261
                [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
262
                [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
262
                [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
263
                [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
263
                [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
264
                <li>
264
                <li id="managedby">
265
                    <form action="" method="post">
265
                    <form action="" method="post">
266
                        <span class="label">Managed by:</span>
266
                        <span class="label">Managed by:</span>
267
                        <div style="float:left">
267
                        <div style="float:left">
Lines 281-303 Link Here
281
                        </div>
281
                        </div>
282
                    </form>
282
                    </form>
283
                </li>
283
                </li>
284
                <li>
284
                <li id="branch">
285
                    <form action="" method="post">
285
                    <span class="label">Branch:</span>
286
                        <span class="label">Branch:</span>
286
                    [% IF basketbranchname %]
287
                        <select id="branch" name="branch">
287
                        [% basketbranchname %]
288
                            <option value="">No branch</option>
288
                    [% ELSE %]
289
                            [% FOREACH branch IN branches_loop %]
289
                        No branch
290
                                [% IF (branch.selected) %]
290
                    [% END %]
291
                                    <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
291
                    [% IF branches_loop.size %]
292
                                [% ELSE %]
292
                        <form action="" method="post">
293
                                    <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
293
                            <select id="branch" name="branch">
294
                                <option value="">(no branch)</option>
295
                                [% FOREACH branch IN branches_loop %]
296
                                    [% IF (branch.selected) %]
297
                                        <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
298
                                    [% ELSE %]
299
                                        <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
300
                                    [% END %]
294
                                [% END %]
301
                                [% END %]
295
                            [% END %]
302
                            </select>
296
                        </select>
303
                            <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
297
                        <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
304
                            <input type="hidden" id="op" name="op" value="mod_branch" />
298
                        <input type="hidden" id="op" name="op" value="mod_branch" />
305
                            <input type="submit" value="Change" />
299
                        <input type="submit" value="Save" />
306
                        </form>
300
                    </form>
307
                    [% END %]
301
                </li>
308
                </li>
302
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
309
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
303
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
310
                [% 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