Lines 34-40
sub string_search {
Link Here
|
34 |
my $dbh = C4::Context->dbh; |
34 |
my $dbh = C4::Context->dbh; |
35 |
$searchstring=~ s/\'/\\\'/g; |
35 |
$searchstring=~ s/\'/\\\'/g; |
36 |
my @data=split(' ',$searchstring); |
36 |
my @data=split(' ',$searchstring); |
37 |
my $sth=$dbh->prepare("Select * from auth_subfield_structure where (tagfield like ? and authtypecode=?) order by tagfield"); |
37 |
my $sth=$dbh->prepare("Select * from auth_subfield_structure where (tagfield like ? and authtypecode=?) order by tagfield, display_order"); |
38 |
$sth->execute("$searchstring%",$authtypecode); |
38 |
$sth->execute("$searchstring%",$authtypecode); |
39 |
my $results = $sth->fetchall_arrayref({}); |
39 |
my $results = $sth->fetchall_arrayref({}); |
40 |
return (scalar(@$results), $results); |
40 |
return (scalar(@$results), $results); |
Lines 124-130
if ($op eq 'add_form') {
Link Here
|
124 |
closedir DIR; |
124 |
closedir DIR; |
125 |
|
125 |
|
126 |
# build values list |
126 |
# build values list |
127 |
my $sth=$dbh->prepare("select * from auth_subfield_structure where tagfield=? and authtypecode=?"); # and tagsubfield='$tagsubfield'"); |
127 |
my $sth=$dbh->prepare("select * from auth_subfield_structure where tagfield=? and authtypecode=? order by display_order"); # and tagsubfield='$tagsubfield'"); |
128 |
$sth->execute($tagfield,$authtypecode); |
128 |
$sth->execute($tagfield,$authtypecode); |
129 |
my @loop_data = (); |
129 |
my @loop_data = (); |
130 |
my $i=0; |
130 |
my $i=0; |
Lines 189-197
if ($op eq 'add_form') {
Link Here
|
189 |
$template->param(tagfield => "$input->param('tagfield')"); |
189 |
$template->param(tagfield => "$input->param('tagfield')"); |
190 |
# my $sth=$dbh->prepare("replace auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,frameworkcode,value_builder,hidden,isurl) |
190 |
# my $sth=$dbh->prepare("replace auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,frameworkcode,value_builder,hidden,isurl) |
191 |
# values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); |
191 |
# values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); |
192 |
my $sth_insert = $dbh->prepare("insert into auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,frameworkcode,value_builder,hidden,isurl,defaultvalue) |
192 |
my $sth_insert = $dbh->prepare("insert into auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,frameworkcode,value_builder,hidden,isurl,defaultvalue, display_order) |
193 |
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); |
193 |
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); |
194 |
my $sth_update = $dbh->prepare("update auth_subfield_structure set authtypecode=?, tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, frameworkcode=?, value_builder=?, hidden=?, isurl=?, defaultvalue=? |
194 |
my $sth_update = $dbh->prepare("update auth_subfield_structure set authtypecode=?, tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, frameworkcode=?, value_builder=?, hidden=?, isurl=?, defaultvalue=?, display_order=? |
195 |
where authtypecode=? and tagfield=? and tagsubfield=?"); |
195 |
where authtypecode=? and tagfield=? and tagsubfield=?"); |
196 |
my @tagsubfield = $input->multi_param('tagsubfield'); |
196 |
my @tagsubfield = $input->multi_param('tagsubfield'); |
197 |
my @liblibrarian = $input->multi_param('liblibrarian'); |
197 |
my @liblibrarian = $input->multi_param('liblibrarian'); |
Lines 205-210
if ($op eq 'add_form') {
Link Here
|
205 |
my @frameworkcodes = $input->multi_param('frameworkcode'); |
205 |
my @frameworkcodes = $input->multi_param('frameworkcode'); |
206 |
my @value_builder =$input->multi_param('value_builder'); |
206 |
my @value_builder =$input->multi_param('value_builder'); |
207 |
my @defaultvalue = $input->multi_param('defaultvalue'); |
207 |
my @defaultvalue = $input->multi_param('defaultvalue'); |
|
|
208 |
|
209 |
my $display_order; |
208 |
for (my $i=0; $i<= $#tagsubfield ; $i++) { |
210 |
for (my $i=0; $i<= $#tagsubfield ; $i++) { |
209 |
my $tagfield =$input->param('tagfield'); |
211 |
my $tagfield =$input->param('tagfield'); |
210 |
my $tagsubfield =$tagsubfield[$i]; |
212 |
my $tagsubfield =$tagsubfield[$i]; |
Lines 241-246
if ($op eq 'add_form') {
Link Here
|
241 |
$hidden, |
243 |
$hidden, |
242 |
$isurl, |
244 |
$isurl, |
243 |
$defaultvalue, |
245 |
$defaultvalue, |
|
|
246 |
$display_order->{$tagfield} || 0, |
244 |
( |
247 |
( |
245 |
$authtypecode, |
248 |
$authtypecode, |
246 |
$tagfield, |
249 |
$tagfield, |
Lines 265-274
if ($op eq 'add_form') {
Link Here
|
265 |
$hidden, |
268 |
$hidden, |
266 |
$isurl, |
269 |
$isurl, |
267 |
$defaultvalue, |
270 |
$defaultvalue, |
|
|
271 |
display_order => $display_order->{$tagfield} || 0, |
268 |
); |
272 |
); |
269 |
} |
273 |
} |
|
|
274 |
$display_order->{$tagfield}++; |
270 |
} |
275 |
} |
271 |
} |
276 |
} |
|
|
277 |
use Data::Printer colored => 1; warn p $display_order; |
272 |
print $input->redirect("/cgi-bin/koha/admin/auth_subfields_structure.pl?tagfield=$tagfield&authtypecode=$authtypecode"); |
278 |
print $input->redirect("/cgi-bin/koha/admin/auth_subfields_structure.pl?tagfield=$tagfield&authtypecode=$authtypecode"); |
273 |
exit; |
279 |
exit; |
274 |
|
280 |
|