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

(-)a/admin/smart-rules.pl (+6 lines)
Lines 222-227 elsif ($op eq 'add') { Link Here
222
        Koha::IssuingRule->new()->set($params)->store();
222
        Koha::IssuingRule->new()->set($params)->store();
223
    }
223
    }
224
224
225
    warn $bor;
226
    warn $itemtype;
227
    warn $br;
228
225
    Koha::CirculationRules->set_rules(
229
    Koha::CirculationRules->set_rules(
226
        {
230
        {
227
            categorycode => $bor,
231
            categorycode => $bor,
Lines 298-303 elsif ($op eq "set-branch-defaults") { Link Here
298
            $sth_insert->execute($branch, $holdallowed, $hold_fulfillment_policy, $returnbranch);
302
            $sth_insert->execute($branch, $holdallowed, $hold_fulfillment_policy, $returnbranch);
299
        }
303
        }
300
304
305
        warn $branch;
306
        warn $categorycode;
301
        Koha::CirculationRules->set_rules(
307
        Koha::CirculationRules->set_rules(
302
            {
308
            {
303
                categorycode => undef,
309
                categorycode => undef,
(-)a/installer/onboarding.pl (-6 / +24 lines)
Lines 31-36 use Koha::Patrons; Link Here
31
use Koha::Patron::Categories;
31
use Koha::Patron::Categories;
32
use Koha::ItemTypes;
32
use Koha::ItemTypes;
33
use Koha::IssuingRules;
33
use Koha::IssuingRules;
34
use Koha::CirculationRules;
35
use Switch;
34
36
35
#Setting variables
37
#Setting variables
36
my $input = new CGI;
38
my $input = new CGI;
Lines 240-267 if ( $step == 5 ) { Link Here
240
        my $maxissueqty     = $input->param('maxissueqty');
242
        my $maxissueqty     = $input->param('maxissueqty');
241
        my $issuelength     = $input->param('issuelength');
243
        my $issuelength     = $input->param('issuelength');
242
        my $lengthunit      = $input->param('lengthunit');
244
        my $lengthunit      = $input->param('lengthunit');
243
        my $renewalsallowed = $input->param('renewalsallowed');
245
        my $renewalsallowed = $input->param('renewalsallowed'); 
244
        my $renewalperiod   = $input->param('renewalperiod');
246
        my $renewalperiod   = $input->param('renewalperiod');
245
        my $onshelfholds    = $input->param('onshelfholds') || 0;
247
        my $onshelfholds    = $input->param('onshelfholds') || 0;
246
        $maxissueqty =~ s/\s//g;
248
        $maxissueqty =~ s/\s//g;
247
        $maxissueqty = undef if $maxissueqty !~ /^\d+/;
249
        $maxissueqty = undef if $maxissueqty !~ /^\d+/;
248
        $issuelength = $issuelength eq q{} ? undef : $issuelength;
250
        $issuelength = $issuelength eq q{} ? undef : $issuelength;
249
251
250
        my $params = {
252
        my $issuingruleparams = {
251
            branchcode      => $branchcode,
253
            branchcode      => $branchcode,
252
            categorycode    => $categorycode,
254
            categorycode    => $categorycode,
253
            itemtype        => $itemtype,
255
            itemtype        => $itemtype,
254
            maxissueqty     => $maxissueqty,
255
            renewalsallowed => $renewalsallowed,
256
            renewalsallowed => $renewalsallowed,
256
            renewalperiod   => $renewalperiod,
257
            renewalperiod   => $renewalperiod,
257
            issuelength     => $issuelength,
258
            issuelength     => $issuelength,
258
            lengthunit      => $lengthunit,
259
            lengthunit      => $lengthunit,
259
            onshelfholds    => $onshelfholds,
260
            onshelfholds    => $onshelfholds,
260
        };
261
        };
262
        $branchcode = $branchcode if $branchcode ne '*';
263
        $branchcode = undef if $branchcode eq '*';
264
        $categorycode = $categorycode if $categorycode ne '*';
265
        $categorycode = undef if $categorycode eq '*';
266
        $itemtype = $itemtype if $itemtype ne '*';
267
        $itemtype = undef if $itemtype eq '*';
268
269
         my $circulationruleparams = {
270
            branchcode      => $branchcode,
271
            categorycode    => $categorycode,
272
            itemtype        => $itemtype,
273
            rule_name       => 'patron_maxissueqty',
274
            rule_value      => $maxissueqty,
275
        };
261
276
262
        my $issuingrule = Koha::IssuingRule->new($params);
277
        my $issuingrule = Koha::IssuingRule->new($issuingruleparams);
263
        eval { $issuingrule->store; };
278
        eval { $issuingrule->store; };
264
279
280
        my $circulationrule = Koha::CirculationRule->new($circulationruleparams);
281
        eval { $circulationrule->store; };
282
265
        unless ($@) {
283
        unless ($@) {
266
            push @messages, { code => 'success_on_insert_circ_rule' };
284
            push @messages, { code => 'success_on_insert_circ_rule' };
267
        }
285
        }
Lines 269-276 if ( $step == 5 ) { Link Here
269
            push @messages, { code => 'error_on_insert_circ_rule' };
287
            push @messages, { code => 'error_on_insert_circ_rule' };
270
        }
288
        }
271
    }
289
    }
272
290
    warn Koha::CirculationRules->count;
273
    $step++ if Koha::IssuingRules->count;
291
    $step++ if (Koha::IssuingRules->count && Koha::CirculationRules->count);
274
}
292
}
275
293
276
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
294
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt (-7 / +5 lines)
Lines 71-82 Link Here
71
                                    <span class="required"> Required</span>
71
                                    <span class="required"> Required</span>
72
                                </li>
72
                                </li>
73
                                <li>
73
                                <li>
74
                                    <label for="maxissueqty" class="required">Current checkouts allowed: </label>
75
                                    <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" value="50" class="required" required="required" />
76
                                    <span class="required">Required</span>
77
                                </li>
78
79
                                <li>
80
                                    <label for="issuelength" class="required">Loan period: </label>
74
                                    <label for="issuelength" class="required">Loan period: </label>
81
                                    <input type="number" min="0" name="issuelength" id="issuelength" size="10" value="14" class="required" required="required" />
75
                                    <input type="number" min="0" name="issuelength" id="issuelength" size="10" value="14" class="required" required="required" />
82
                                    <span class="required">Required</span>
76
                                    <span class="required">Required</span>
Lines 101-106 Link Here
101
                                    </select>
95
                                    </select>
102
                                </li>
96
                                </li>
103
                                <li>
97
                                <li>
98
                                    <label for="maxissueqty" class="required">Current checkouts allowed: </label>
99
                                    <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" value="50" class="required" required="required" />
100
                                    <span class="required">Required</span>
101
                                </li>
102
                                <li>
104
                                    <label for="renewalsallowed" class="required">Renewals allowed: </label>
103
                                    <label for="renewalsallowed" class="required">Renewals allowed: </label>
105
                                    <input type="number" min="0" name="renewalsallowed" id="renewalsallowed" size="10" max="10" value="10" class="required" required="required" />
104
                                    <input type="number" min="0" name="renewalsallowed" id="renewalsallowed" size="10" max="10" value="10" class="required" required="required" />
106
                                    <span class="required">Required</span>
105
                                    <span class="required">Required</span>
107
- 

Return to bug 22489