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

(-)a/admin/smart-rules.pl (-9 / +7 lines)
Lines 292-309 elsif ($op eq "add-branch-cat") { Link Here
292
292
293
    if ($branch eq "*") {
293
    if ($branch eq "*") {
294
        if ($categorycode eq "*") {
294
        if ($categorycode eq "*") {
295
            #FIXME This block is will probably be never used
295
            my $sth_search = $dbh->prepare("SELECT count(*) AS total
296
            my $sth_search = $dbh->prepare("SELECT count(*) AS total
296
                                            FROM default_circ_rules");
297
                                            FROM default_circ_rules");
297
            my $sth_insert = $dbh->prepare(q|
298
            my $sth_insert = $dbh->prepare(q|
298
                INSERT INTO default_circ_rules
299
                INSERT INTO default_circ_rules
299
                    (maxissueqty, maxonsiteissueqty, max_holds)
300
                    (maxissueqty, maxonsiteissueqty)
300
                    VALUES (?, ?, ?)
301
                    VALUES (?, ?)
301
            |);
302
            |);
302
            my $sth_update = $dbh->prepare(q|
303
            my $sth_update = $dbh->prepare(q|
303
                UPDATE default_circ_rules
304
                UPDATE default_circ_rules
304
                SET maxissueqty = ?,
305
                SET maxissueqty = ?,
305
                    maxonsiteissueqty = ?,
306
                    maxonsiteissueqty = ?,
306
                    max_holds = ?
307
            |);
307
            |);
308
308
309
            $sth_search->execute();
309
            $sth_search->execute();
Lines 385-398 elsif ($op eq "add-branch-cat") { Link Here
385
                                        AND   categorycode = ?");
385
                                        AND   categorycode = ?");
386
        my $sth_insert = $dbh->prepare(q|
386
        my $sth_insert = $dbh->prepare(q|
387
            INSERT INTO branch_borrower_circ_rules
387
            INSERT INTO branch_borrower_circ_rules
388
            (branchcode, categorycode, maxissueqty, maxonsiteissueqty, max_holds)
388
            (branchcode, categorycode, maxissueqty, maxonsiteissueqty)
389
            VALUES (?, ?, ?, ?, ?)
389
            VALUES (?, ?, ?, ?)
390
        |);
390
        |);
391
        my $sth_update = $dbh->prepare(q|
391
        my $sth_update = $dbh->prepare(q|
392
            UPDATE branch_borrower_circ_rules
392
            UPDATE branch_borrower_circ_rules
393
            SET maxissueqty = ?,
393
            SET maxissueqty = ?,
394
                maxonsiteissueqty = ?
394
                maxonsiteissueqty = ?
395
                max_holds = ?
396
            WHERE branchcode = ?
395
            WHERE branchcode = ?
397
            AND categorycode = ?
396
            AND categorycode = ?
398
        |);
397
        |);
Lines 400-408 elsif ($op eq "add-branch-cat") { Link Here
400
        $sth_search->execute($branch, $categorycode);
399
        $sth_search->execute($branch, $categorycode);
401
        my $res = $sth_search->fetchrow_hashref();
400
        my $res = $sth_search->fetchrow_hashref();
402
        if ($res->{total}) {
401
        if ($res->{total}) {
403
            $sth_update->execute($maxissueqty, $maxonsiteissueqty, $max_holds, $branch, $categorycode);
402
            $sth_update->execute($maxissueqty, $maxonsiteissueqty, $branch, $categorycode);
404
        } else {
403
        } else {
405
            $sth_insert->execute($branch, $categorycode, $maxissueqty, $maxonsiteissueqty, $max_holds);
404
            $sth_insert->execute($branch, $categorycode, $maxissueqty, $maxonsiteissueqty);
406
        }
405
        }
407
406
408
        Koha::CirculationRules->set_rule(
407
        Koha::CirculationRules->set_rule(
409
- 

Return to bug 18887