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

(-)a/Koha/Acquisition/Order.pm (-3 / +3 lines)
Lines 147-153 sub cancel { Link Here
147
147
148
    # If ordered from a suggestion, revert the suggestion status to ACCEPTED
148
    # If ordered from a suggestion, revert the suggestion status to ACCEPTED
149
    my $suggestions = $self->suggestions;
149
    my $suggestions = $self->suggestions;
150
    while ( my $suggestion = $suggestions->next ){
150
    while ( my $suggestion = $suggestions->next ) {
151
        if ( $suggestion && $suggestion->STATUS eq "ORDERED" ) {
151
        if ( $suggestion && $suggestion->STATUS eq "ORDERED" ) {
152
            ModSuggestion(
152
            ModSuggestion(
153
                {
153
                {
Lines 309-318 to the order. Link Here
309
=cut
309
=cut
310
310
311
sub suggestions {
311
sub suggestions {
312
    my ( $self )  = @_;
312
    my ($self) = @_;
313
    my $rs = $self->_result->suggestions;
313
    my $rs = $self->_result->suggestions;
314
    return unless $rs;
314
    return unless $rs;
315
    return Koha::Suggestions->_new_from_dbic( $rs );
315
    return Koha::Suggestions->_new_from_dbic($rs);
316
}
316
}
317
317
318
=head3 current_item_level_holds
318
=head3 current_item_level_holds
(-)a/Koha/EDI.pm (-1 / +1 lines)
Lines 332-338 sub process_invoice { Link Here
332
                if ($order) {
332
                if ($order) {
333
333
334
                    my $order_koha_object = Koha::Acquisition::Orders->find($ordernumber);
334
                    my $order_koha_object = Koha::Acquisition::Orders->find($ordernumber);
335
                    my $suggestions = $order_koha_object->suggestions;
335
                    my $suggestions       = $order_koha_object->suggestions;
336
                    while ( my $suggestion = $suggestions->next ) {
336
                    while ( my $suggestion = $suggestions->next ) {
337
                        ModSuggestion(
337
                        ModSuggestion(
338
                            {
338
                            {
(-)a/acqui/addorder.pl (-1 / +1 lines)
Lines 351-357 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
351
            {
351
            {
352
                suggestionid => $suggestionid,
352
                suggestionid => $suggestionid,
353
                biblionumber => $orderinfo->{biblionumber},
353
                biblionumber => $orderinfo->{biblionumber},
354
                ordernumber => $order->ordernumber,
354
                ordernumber  => $order->ordernumber,
355
                STATUS       => 'ORDERED',
355
                STATUS       => 'ORDERED',
356
            }
356
            }
357
        );
357
        );
(-)a/installer/data/mysql/atomicupdate/bug_28844.pl (-6 / +8 lines)
Lines 1-17 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
2
3
return {
3
return {
4
    bug_number => "28844",
4
    bug_number  => "28844",
5
    description => "Link orders and suggestions",
5
    description => "Link orders and suggestions",
6
    up => sub {
6
    up          => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        unless ( column_exists('suggestions', 'ordernumber') ) {
9
        unless ( column_exists( 'suggestions', 'ordernumber' ) ) {
10
            $dbh->do(q{
10
            $dbh->do(
11
                q{
11
                ALTER TABLE suggestions
12
                ALTER TABLE suggestions
12
                ADD COLUMN `ordernumber` int(10) DEFAULT NULL COMMENT 'links suggestion to an acquisitions order (aqorders.ordernumber)' AFTER biblionumber,
13
                ADD COLUMN `ordernumber` int(10) DEFAULT NULL COMMENT 'links suggestion to an acquisitions order (aqorders.ordernumber)' AFTER biblionumber,
13
                ADD CONSTRAINT `suggestions_ordernumber` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE
14
                ADD CONSTRAINT `suggestions_ordernumber` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE
14
            });
15
            }
16
            );
15
            say $out "Added column 'suggestions.ordernumber'";
17
            say $out "Added column 'suggestions.ordernumber'";
16
        }
18
        }
17
    },
19
    },
(-)a/t/db_dependent/Koha/Acquisition/Order.t (-13 / +20 lines)
Lines 221-230 subtest 'suggestions' => sub { Link Here
221
    );
221
    );
222
222
223
    my $order = Koha::Acquisition::Orders->find( $o->ordernumber );
223
    my $order = Koha::Acquisition::Orders->find( $o->ordernumber );
224
    is( ref( $order->suggestions ), 'Koha::Suggestions',
224
    is(
225
        '->suggestions should return a Koha::Suggestions object');
225
        ref( $order->suggestions ), 'Koha::Suggestions',
226
    is( $order->suggestions->count, 0,
226
        '->suggestions should return a Koha::Suggestions object'
227
        '->suggestions should return empty set if no linked suggestion');
227
    );
228
    is(
229
        $order->suggestions->count, 0,
230
        '->suggestions should return empty set if no linked suggestion'
231
    );
228
232
229
    $o = $builder->build_object(
233
    $o = $builder->build_object(
230
        {
234
        {
Lines 239-248 subtest 'suggestions' => sub { Link Here
239
    );
243
    );
240
244
241
    $order = Koha::Acquisition::Orders->find( $o->ordernumber );
245
    $order = Koha::Acquisition::Orders->find( $o->ordernumber );
242
    is( ref( $order->suggestions ), 'Koha::Suggestions',
246
    is(
243
        '->suggestions should return a Koha::Suggestions object');
247
        ref( $order->suggestions ), 'Koha::Suggestions',
244
    is( $order->suggestions->count, 1,
248
        '->suggestions should return a Koha::Suggestions object'
245
        '->suggestions should return linked suggestions');
249
    );
250
    is(
251
        $order->suggestions->count, 1,
252
        '->suggestions should return linked suggestions'
253
    );
246
254
247
    $schema->storage->txn_rollback;
255
    $schema->storage->txn_rollback;
248
};
256
};
Lines 957-967 subtest 'cancel() tests' => sub { Link Here
957
        {
965
        {
958
            class => 'Koha::Suggestions',
966
            class => 'Koha::Suggestions',
959
            value => {
967
            value => {
960
                biblionumber => $biblio_id,
968
                biblionumber  => $biblio_id,
961
                suggesteddate => dt_from_string,
969
                suggesteddate => dt_from_string,
962
                STATUS => 'ORDERED',
970
                STATUS        => 'ORDERED',
963
                archived => 0,
971
                archived      => 0,
964
                ordernumber => $order->id,
972
                ordernumber   => $order->id,
965
            }
973
            }
966
        }
974
        }
967
    );
975
    );
968
- 

Return to bug 35717