|
Lines 44-116
sub get_effective_issuing_rule {
Link Here
|
| 44 |
my $itemtype = $params->{itemtype}; |
44 |
my $itemtype = $params->{itemtype}; |
| 45 |
my $branchcode = $params->{branchcode}; |
45 |
my $branchcode = $params->{branchcode}; |
| 46 |
|
46 |
|
| 47 |
my $rule = $self->find($params); |
47 |
my $rule = $self->search({ |
| 48 |
return $rule if $rule; |
48 |
categorycode => { 'in' => [ $categorycode, $default ] }, |
| 49 |
|
49 |
itemtype => { 'in' => [ $itemtype, $default ] }, |
| 50 |
$rule = $self->find( |
50 |
branchcode => { 'in' => [ $branchcode, $default ] }, |
| 51 |
{ |
51 |
}, { |
| 52 |
categorycode => $categorycode, |
52 |
order_by => { |
| 53 |
itemtype => $default, |
53 |
-desc => ['branchcode', 'categorycode', 'itemtype'] |
| 54 |
branchcode => $branchcode |
54 |
}, |
| 55 |
} |
55 |
rows => 1, |
| 56 |
); |
56 |
})->single; |
| 57 |
return $rule if $rule; |
57 |
return $rule; |
| 58 |
|
|
|
| 59 |
$rule = $self->find( |
| 60 |
{ |
| 61 |
categorycode => $default, |
| 62 |
itemtype => $itemtype, |
| 63 |
branchcode => $branchcode |
| 64 |
} |
| 65 |
); |
| 66 |
return $rule if $rule; |
| 67 |
|
| 68 |
$rule = $self->find( |
| 69 |
{ |
| 70 |
categorycode => $default, |
| 71 |
itemtype => $default, |
| 72 |
branchcode => $branchcode |
| 73 |
} |
| 74 |
); |
| 75 |
return $rule if $rule; |
| 76 |
|
| 77 |
$rule = $self->find( |
| 78 |
{ |
| 79 |
categorycode => $categorycode, |
| 80 |
itemtype => $itemtype, |
| 81 |
branchcode => $default |
| 82 |
} |
| 83 |
); |
| 84 |
return $rule if $rule; |
| 85 |
|
| 86 |
$rule = $self->find( |
| 87 |
{ |
| 88 |
categorycode => $categorycode, |
| 89 |
itemtype => $default, |
| 90 |
branchcode => $default |
| 91 |
} |
| 92 |
); |
| 93 |
return $rule if $rule; |
| 94 |
|
| 95 |
$rule = $self->find( |
| 96 |
{ |
| 97 |
categorycode => $default, |
| 98 |
itemtype => $itemtype, |
| 99 |
branchcode => $default |
| 100 |
} |
| 101 |
); |
| 102 |
return $rule if $rule; |
| 103 |
|
| 104 |
$rule = $self->find( |
| 105 |
{ |
| 106 |
categorycode => $default, |
| 107 |
itemtype => $default, |
| 108 |
branchcode => $default |
| 109 |
} |
| 110 |
); |
| 111 |
return $rule if $rule; |
| 112 |
|
| 113 |
return; |
| 114 |
} |
58 |
} |
| 115 |
|
59 |
|
| 116 |
=head3 type |
60 |
=head3 type |
| 117 |
- |
|
|