Lines 112-123
sub GetClassSources {
Link Here
|
112 |
sub AddClassSource { |
112 |
sub AddClassSource { |
113 |
|
113 |
|
114 |
my ($cn_source, $description, $used, $class_sort_rule) = @_; |
114 |
my ($cn_source, $description, $used, $class_sort_rule) = @_; |
|
|
115 |
my $exists = GetClassSource($cn_source); |
116 |
if ($exists) { |
117 |
return 0; |
118 |
} |
115 |
my $dbh = C4::Context->dbh; |
119 |
my $dbh = C4::Context->dbh; |
116 |
my $sth = $dbh->prepare("INSERT INTO `class_sources` |
120 |
my $sth = $dbh->prepare("INSERT INTO `class_sources` |
117 |
(`cn_source`, `description`, `used`, `class_sort_rule`) |
121 |
(`cn_source`, `description`, `used`, `class_sort_rule`) |
118 |
VALUES (?, ?, ?, ?)"); |
122 |
VALUES (?, ?, ?, ?)"); |
119 |
$sth->execute($cn_source, $description, $used, $class_sort_rule); |
123 |
$sth->execute($cn_source, $description, $used, $class_sort_rule); |
120 |
|
124 |
return 1; |
121 |
} |
125 |
} |
122 |
|
126 |
|
123 |
=head2 GetClassSource |
127 |
=head2 GetClassSource |
Lines 224-235
sub GetClassSortRules {
Link Here
|
224 |
sub AddClassSortRule { |
228 |
sub AddClassSortRule { |
225 |
|
229 |
|
226 |
my ($class_sort_rule, $description, $sort_routine) = @_; |
230 |
my ($class_sort_rule, $description, $sort_routine) = @_; |
|
|
231 |
my $exists = GetClassSortRule($class_sort_rule); |
232 |
if ($exists) { |
233 |
return 0; |
234 |
} |
227 |
my $dbh = C4::Context->dbh; |
235 |
my $dbh = C4::Context->dbh; |
228 |
my $sth = $dbh->prepare("INSERT INTO `class_sort_rules` |
236 |
my $sth = $dbh->prepare("INSERT INTO `class_sort_rules` |
229 |
(`class_sort_rule`, `description`, `sort_routine`) |
237 |
(`class_sort_rule`, `description`, `sort_routine`) |
230 |
VALUES (?, ?, ?)"); |
238 |
VALUES (?, ?, ?)"); |
231 |
$sth->execute($class_sort_rule, $description, $sort_routine); |
239 |
$sth->execute($class_sort_rule, $description, $sort_routine); |
232 |
|
240 |
return 1; |
233 |
} |
241 |
} |
234 |
|
242 |
|
235 |
=head2 GetClassSortRule |
243 |
=head2 GetClassSortRule |