$sth=$dbh->prepare("select tagfield,$libfield as lib,mandatory from marc_tag_structure order by tagfield");
$sth->execute;
# check that itemtype framework exists
$sth=$dbh->prepare("select count(*) from marc_tag_structure where itemtype=? order by ?");
$sth->execute($itemtype,$itemtype);
my($total)=$sth->fetchrow;
$itemtype=""unless($total>0);
$sth=$dbh->prepare("select tagfield,$libfield as lib,mandatory from marc_tag_structure where itemtype=? order by tagfield");
$sth->execute($itemtype);
my($lib,$tag,$res,$tab,$mandatory,$repeatable);
while(($tag,$lib,$mandatory)=$sth->fetchrow){
$res->{$tag}->{lib}=$lib;
@ -231,8 +239,8 @@ sub MARCgettagslib {
$res->{$tag}->{mandatory}=$mandatory;
}
$sth=$dbh->prepare("select tagfield,tagsubfield,$libfield as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder,kohafield,seealso from marc_subfield_structure order by tagfield,tagsubfield");
$sth->execute;
$sth=$dbh->prepare("select tagfield,tagsubfield,$libfield as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder,kohafield,seealso from marc_subfield_structure where itemtype=? order by tagfield,tagsubfield");
my$sth=$dbh->prepare("Select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where (tagfield like ?) order by tagfield");
$sth->execute("$searchstring%");
my$sth=$dbh->prepare("Select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where (tagfield like ? and itemtype=?) order by tagfield");
my$sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield=?");# and tagsubfield='$tagsubfield'");
$sth->execute($tagfield);
my$sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield=? and itemtype=?");# and tagsubfield='$tagsubfield'");
# called by default form, used to confirm deletion of data in DB
}elsif($opeq'delete_confirm'){
my$dbh=C4::Context->dbh;
my$sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield=? and tagsubfield=?");
my$sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield=? and tagsubfield=? and itemtype=?");
my$sth=$dbh->prepare("Select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where (tagfield >= ?) order by tagfield");
$sth->execute($data[0]);
my@results;
while(my$data=$sth->fetchrow_hashref){
push(@results,$data);
}
# $sth->execute;
$sth->finish;
return(scalar(@results),\@results);
}
# retrieve parameters
my$input=newCGI;
my$itemtype=$input->param('itemtype');# set to select framework
$itemtype=""unless$itemtype;
my$existingitemtype=$input->param('existingitemtype');# set when we have to create a new framework (in itemtype) by copying an old one (in existingitemtype)
# called by default. Used to create form to add or modify a record
if($opeq'add_form'){
#---- if primkey exists, it's a modify action, so read values to modify...
my$data;
if($searchfield){
my$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where tagfield=?");
$sth->execute($searchfield);
$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where tagfield=? and itemtype=?");
# called automatically if an unexisting itemtype is selected
}elsif($opeq'itemtype_create'){
$sth=$dbh->prepare("select count(*),marc_tag_structure.itemtype,description from marc_tag_structure,itemtypes where itemtypes.itemtype=marc_tag_structure.itemtype group by marc_tag_structure.itemtype");
my$sth=$dbh->prepare("Select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where (tagfield >= ? and itemtype=?) order by tagfield");
$sth->execute($data[0],$itemtype);
my@results;
while(my$data=$sth->fetchrow_hashref){
push(@results,$data);
}
# $sth->execute;
$sth->finish;
return(scalar(@results),\@results);
}
#
# the sub used to duplicate a framework from an existing one in MARC parameters tables.
#
subduplicate_framework{
my($newitemtype,$olditemtype)=@_;
my$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where itemtype=?");
$sth=$dbh->prepare("select itemtype,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder,seealso from marc_subfield_structure where itemtype=?");
$sth->execute($olditemtype);
$sth_insert=$dbh->prepare("insert into marc_subfield_structure (itemtype,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder,seealso) values (?,?,?,?,?,?,?,?,?,?,?,?,?)");
<p>This screen shows the subfields associated with the selected tag. You can edit subfields or add a new one by clicking on edit. </p>
<p>The column <b>Koha field</b> shows that the subfield is linked with a Koha field. Koha can manage a MARC interface, or a Koha interface. This link ensures that both DB are synchronized, thus you can change from a MARC to a Koha interface easily.</p>
<td background="<!-- TMPL_VAR NAME='themelang' -->/images/background-mem.gif" width="8%"><b>Tab</b> <span style="font-size:8;color:red" title="subfield is shown in which tab (0-9 or item)">?</span></td>
<td background="<!-- TMPL_VAR NAME='themelang' -->/images/background-mem.gif" width="8%"><b>See also</b> <span style="font-size:8;color:red" title="if subfields entered here, searches on this field will also be done on seealso subfields (syntax 200a,300e)">?</span></td>
<td background="<!-- TMPL_VAR NAME='themelang' -->/images/background-mem.gif" width="8%"><b>Auth value</b> <span style="font-size:8;color:red" title="values authorised for this subfield">?</span></td>
<td background="<!-- TMPL_VAR NAME='themelang' -->/images/background-mem.gif" width="8%"><b>Thesaurus</b> <span style="font-size:8;color:red" title="Thesaurus linked to this subfield">?</span></td>
<th>Koha field<span style="font-size:8;color:red" title="the koha-DB field linked to this subfield">?</span></th>
<th>Rep<span style="font-size:8;color:red" title="subfield may be repeated (1=yes, 0=no)">?</span></th>
<th>Mand <span style="font-size:8;color:red" title="subfield is mandatory (1=yes, 0=no)">?</span></th>
<th>Tab <span style="font-size:8;color:red" title="subfield is shown in which tab (0-9 or item)">?</span></th>
<th>See also<span style="font-size:8;color:red" title="if subfields entered here, searches on this field will also be done on seealso subfields (syntax 200a,300e)">?</span></th>
<th>Auth value<span style="font-size:8;color:red" title="values authorised for this subfield">?</span></th>
<th>Thesaurus<span style="font-size:8;color:red" title="Thesaurus linked to this subfield">?</span></th>
<tr><td>Authorised value</td><td><!-- TMPL_VAR name="authorised_value" --> (if you select a value here, the indicators will be limited to the authorised value list)</td></tr>
<p><label>Authorised value</label><!-- TMPL_VAR name="authorised_value" --> (if you select a value here, the indicators will be limited to the authorised value list)</p>