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

(-)a/C4/Serials.pm (-28 / +40 lines)
Lines 1306-1342 sub ModSubscription { Link Here
1306
    $itemtype, $previousitemtype, $mana_id
1306
    $itemtype, $previousitemtype, $mana_id
1307
    ) = @_;
1307
    ) = @_;
1308
1308
1309
    my $dbh   = C4::Context->dbh;
1309
    my $subscription = Koha::Subscriptions->find( $subscriptionid );
1310
    my $query = "UPDATE subscription
1310
    return unless $subscription;
1311
        SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?,
1312
            startdate=?, periodicity=?, firstacquidate=?, irregularity=?,
1313
            numberpattern=?, locale=?, numberlength=?, weeklength=?, monthlength=?,
1314
            lastvalue1=?, innerloop1=?, lastvalue2=?, innerloop2=?,
1315
            lastvalue3=?, innerloop3=?, status=?, biblionumber=?,
1316
            callnumber=?, notes=?, letter=?, manualhistory=?,
1317
            internalnotes=?, serialsadditems=?, staffdisplaycount=?,
1318
            opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
1319
            skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?
1320
        WHERE subscriptionid = ?";
1321
1311
1322
    my $sth = $dbh->prepare($query);
1312
    $subscription->librarian($auser);
1323
    $sth->execute(
1313
    $subscription->branchcode($branchcode);
1324
        $auser,           $branchcode,     $aqbooksellerid, $cost,
1314
    $subscription->aqbooksellerid($aqbooksellerid);
1325
        $aqbudgetid,      $startdate,      $periodicity,    $firstacquidate,
1315
    $subscription->cost($cost);
1326
        $irregularity,    $numberpattern,  $locale,         $numberlength,
1316
    $subscription->aqbudgetid($aqbudgetid);
1327
        $weeklength,      $monthlength,    $lastvalue1,     $innerloop1,
1317
    $subscription->biblionumber($biblionumber);
1328
        $lastvalue2,      $innerloop2,     $lastvalue3,     $innerloop3,
1318
    $subscription->startdate($startdate);
1329
        $status,          $biblionumber,   $callnumber,     $notes,
1319
    $subscription->periodicity($periodicity);
1330
        $letter,          ($manualhistory ? $manualhistory : 0),
1320
    $subscription->numberlength($numberlength);
1331
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1321
    $subscription->weeklength($weeklength);
1332
        $graceperiod,     $location,       $enddate,        $skip_serialseq,
1322
    $subscription->monthlength($monthlength);
1333
        $itemtype,        $previousitemtype, $mana_id,
1323
    $subscription->lastvalue1($lastvalue1);
1334
        $subscriptionid
1324
    $subscription->innerloop1($innerloop1);
1335
    );
1325
    $subscription->lastvalue2($lastvalue2);
1336
    my $rows = $sth->rows;
1326
    $subscription->lastvalue3($lastvalue3);
1327
    $subscription->innerloop3($innerloop3);
1328
    $subscription->status($status);
1329
    $subscription->notes($notes);
1330
    $subscription->letter($letter);
1331
    $subscription->firstacquidate($firstacquidate);
1332
    $subscription->irregularity($irregularity);
1333
    $subscription->numberpattern($numberpattern);
1334
    $subscription->locale($locale);
1335
    $subscription->callnumber($callnumber);
1336
    $subscription->manualhistory($manualhistory || 0);
1337
    $subscription->internalnotes($internalnotes);
1338
    $subscription->serialsadditems($serialsadditems);
1339
    $subscription->staffdisplaycount($staffdisplaycount);
1340
    $subscription->opacdisplaycount($opacdisplaycount);
1341
    $subscription->graceperiod($graceperiod);
1342
    $subscription->location($location);
1343
    $subscription->enddate($enddate);
1344
    $subscription->skip_serialseq($skip_serialseq);
1345
    $subscription->itemtype($itemtype);
1346
    $subscription->previousitemtype($previousitemtype);
1347
    $subscription->mana_id($mana_id);
1348
    my $modified = $subscription->store;
1337
1349
1338
    logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");
1350
    logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");
1339
    return $rows;
1351
    return $modified;
1340
}
1352
}
1341
1353
1342
=head2 NewSubscription
1354
=head2 NewSubscription
(-)a/t/db_dependent/Serials.t (-13 / +14 lines)
Lines 355-364 subtest "NewSubscription" => sub { Link Here
355
    my $subscriptionid = NewSubscription(
355
    my $subscriptionid = NewSubscription(
356
        "",      "",     "", "", $budget_id, $biblionumber,
356
        "",      "",     "", "", $budget_id, $biblionumber,
357
        '2013-01-01', $frequency_id, "", "",  "",
357
        '2013-01-01', $frequency_id, "", "",  "",
358
        "",      "",  "", "", "", "",
358
        "",      "",  "", "", "",
359
        1,          $notes,"", '2013-01-01', "", $pattern_id,
359
        "", 1,          $notes,"", '2013-01-01', "",
360
        "",       "",  0,    $internalnotes,  0,
360
        $pattern_id, "",       "",  0,    $internalnotes,
361
        "", "", 0,          "",         '2013-12-31', 0
361
        0, "", "", 0,
362
        "",         '2013-12-31', 0,
362
    );
363
    );
363
    ok($subscriptionid, "Sending empty string instead of undef to reflect use of the interface");
364
    ok($subscriptionid, "Sending empty string instead of undef to reflect use of the interface");
364
};
365
};
Lines 367-379 subtest "ModSuscription" => sub { Link Here
367
    plan tests => 1;
368
    plan tests => 1;
368
    my $subscription = $builder->build_object({ class => 'Koha::Subscriptions' });
369
    my $subscription = $builder->build_object({ class => 'Koha::Subscriptions' });
369
    my $modified = ModSubscription(
370
    my $modified = ModSubscription(
370
        "",      "",     "", "", $budget_id, $biblionumber,
371
        "",      "",     "", "", $budget_id, '2013-01-01',
371
        '2013-01-01', $frequency_id, "", "",  "",
372
        $frequency_id, '2013-01-01', "", $pattern_id,  "",
372
        "",      "",  "", "", "", "",
373
        "",      "",  "", "", "",
373
        1,          $notes,"", '2013-01-01', "", $pattern_id,
374
        "",      "",  "", "", 1,
374
        "",       "",  0,    $internalnotes,  0,
375
        $biblionumber,      "",  "", "", 0,
375
        "", "", 0,          "",         '2013-12-31', $subscription->subscriptionid,
376
        "",      0,  "", "",
376
        0
377
        0,      "",  "", $subscription->subscriptionid, 0,
377
    );
378
    );
378
    is($modified, 1);
379
380
    isnt($modified, 0);
379
};
381
};
380
- 

Return to bug 23064