Lines 734-761
sub DelAuthority {
Link Here
|
734 |
$sth->execute($authid); |
734 |
$sth->execute($authid); |
735 |
} |
735 |
} |
736 |
|
736 |
|
|
|
737 |
=head2 ModAuthority |
738 |
|
739 |
$authid= &ModAuthority($authid,$record,$authtypecode) |
740 |
|
741 |
Modifies authority record, optionally updates attached biblios. |
742 |
|
743 |
=cut |
744 |
|
737 |
sub ModAuthority { |
745 |
sub ModAuthority { |
738 |
my ($authid,$record,$authtypecode,$merge)=@_; |
746 |
my ($authid,$record,$authtypecode)=@_; # deprecated $merge parameter removed |
|
|
747 |
|
739 |
my $dbh=C4::Context->dbh; |
748 |
my $dbh=C4::Context->dbh; |
740 |
#Now rewrite the $record to table with an add |
749 |
#Now rewrite the $record to table with an add |
741 |
my $oldrecord=GetAuthority($authid); |
750 |
my $oldrecord=GetAuthority($authid); |
742 |
$authid=AddAuthority($record,$authid,$authtypecode); |
751 |
$authid=AddAuthority($record,$authid,$authtypecode); |
743 |
|
752 |
|
744 |
### If a library thinks that updating all biblios is a long process and wishes to leave that to a cron job to use merge_authotities.p |
753 |
# If a library thinks that updating all biblios is a long process and wishes |
745 |
### they should have a system preference "dontmerge=1" otherwise by default biblios will be updated |
754 |
# to leave that to a cron job, use misc/migration_tools/merge_authority.pl. |
746 |
### the $merge flag is now depreceated and will be removed at code cleaning |
755 |
# In that case set system preference "dontmerge" to 1. Otherwise biblios will |
747 |
if (C4::Context->preference('MergeAuthoritiesOnUpdate') ){ |
756 |
# be updated. |
|
|
757 |
unless(C4::Context->preference('dontmerge') eq '1'){ |
748 |
&merge($authid,$oldrecord,$authid,$record); |
758 |
&merge($authid,$oldrecord,$authid,$record); |
749 |
} else { |
759 |
} else { |
750 |
# save the file in tmp/modified_authorities |
760 |
# save the file in /var/tmp/modified_authorities |
751 |
my $cgidir = C4::Context->intranetdir ."/cgi-bin"; |
761 |
my $dir= "/var/tmp/modified_authorities"; |
752 |
unless (opendir(DIR,"$cgidir")) { |
762 |
unless(-d $dir) { |
753 |
$cgidir = C4::Context->intranetdir."/"; |
763 |
mkdir $dir; system "chmod 777 $dir"; |
754 |
closedir(DIR); |
|
|
755 |
} |
764 |
} |
756 |
|
765 |
my $filename = "$dir/$authid.authid"; |
757 |
my $filename = $cgidir."/tmp/modified_authorities/$authid.authid"; |
766 |
open AUTH, '>', $filename; |
758 |
open AUTH, "> $filename"; |
|
|
759 |
print AUTH $authid; |
767 |
print AUTH $authid; |
760 |
close AUTH; |
768 |
close AUTH; |
761 |
} |
769 |
} |