Adding Letters management to Suggestions.
This commit is contained in:
parent
8339718d82
commit
88bb1b635b
|
|
@ -483,6 +483,7 @@ sub parseletter_sth {
|
|||
($table eq 'biblio' ) ? "SELECT * FROM $table WHERE biblionumber = ?" :
|
||||
($table eq 'biblioitems' ) ? "SELECT * FROM $table WHERE biblionumber = ?" :
|
||||
($table eq 'items' ) ? "SELECT * FROM $table WHERE itemnumber = ?" :
|
||||
($table eq 'suggestions' ) ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?" :
|
||||
($table eq 'reserves' ) ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?" :
|
||||
($table eq 'borrowers' ) ? "SELECT * FROM $table WHERE borrowernumber = ?" :
|
||||
($table eq 'branches' ) ? "SELECT * FROM $table WHERE branchcode = ?" :
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ our @EXPORT = qw<
|
|||
&SearchSuggestion
|
||||
>;
|
||||
use C4::Dates qw(format_date_in_iso);
|
||||
>>>>>>> Suggestions.pm, probably useless & not working (check with hdl):C4/Suggestions.pm
|
||||
>>>>>>> Suggestions.pm, probably useless & not working (check with hdl):C4/Suggestions.pm
|
||||
use vars qw($VERSION @ISA @EXPORT);
|
||||
|
||||
BEGIN {
|
||||
|
|
@ -62,6 +60,15 @@ BEGIN {
|
|||
&ModSuggestion
|
||||
&ConnectSuggestionAndBiblio
|
||||
&GetSuggestionFromBiblionumber
|
||||
&ConnectSuggestionAndBiblio
|
||||
&CountSuggestion
|
||||
&DelSuggestion
|
||||
&GetSuggestion
|
||||
&GetSuggestionByStatus
|
||||
&GetSuggestionFromBiblionumber
|
||||
&ModStatus
|
||||
&ModSuggestion
|
||||
&NewSuggestion
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,42 @@ use C4::Auth;
|
|||
use C4::Context;
|
||||
use C4::Output;
|
||||
|
||||
sub StringSearch {
|
||||
my ($searchstring) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
$searchstring =~ s/\'/\\\'/g;
|
||||
my @data = split( ' ', $searchstring );
|
||||
$data[0] = '' unless @data;
|
||||
my $sth = $dbh->prepare("SELECT * FROM letter WHERE (code LIKE ?) ORDER BY module, code");
|
||||
$sth->execute("$data[0]%"); # slightly bogus, only searching on first string.
|
||||
return $sth->fetchall_arrayref({});
|
||||
}
|
||||
|
||||
# FIXME untranslateable
|
||||
our %column_map = (
|
||||
aqbooksellers => 'BOOKSELLERS',
|
||||
aqorders => 'ORDERS',
|
||||
serial => 'SERIALS',
|
||||
reserves => 'HOLDS',
|
||||
suggestions => 'SUGGESTIONS',
|
||||
);
|
||||
|
||||
sub column_picks ($) {
|
||||
# returns @array of values
|
||||
my $table = shift or return ();
|
||||
my $sth = C4::Context->dbh->prepare("SHOW COLUMNS FROM $table");
|
||||
$sth->execute;
|
||||
my @SQLfieldname = ();
|
||||
push @SQLfieldname, {'value' => "", 'text' => '---' . uc($column_map{$table} || $table) . '---'};
|
||||
while (my ($field) = $sth->fetchrow_array) {
|
||||
push @SQLfieldname, {
|
||||
value => $table . ".$field",
|
||||
text => $table . ".$field"
|
||||
};
|
||||
}
|
||||
return @SQLfieldname;
|
||||
}
|
||||
|
||||
# letter_exists($module, $code)
|
||||
# - return true if a letter with the given $module and $code exists
|
||||
sub letter_exists {
|
||||
|
|
@ -145,19 +181,23 @@ sub add_form {
|
|||
$template->param( adding => 1 );
|
||||
}
|
||||
|
||||
# build field list
|
||||
my $field_selection = [
|
||||
{
|
||||
value => 'LibrarianFirstname',
|
||||
text => 'LibrarianFirstname',
|
||||
},
|
||||
{
|
||||
value => 'LibrarianSurname',
|
||||
text => 'LibrarianSurname',
|
||||
},
|
||||
{
|
||||
value => 'LibrarianEmailaddress',
|
||||
text => 'LibrarianEmailaddress',
|
||||
# add acquisition specific tables
|
||||
if ( $module eq "suggestions" ) {
|
||||
push @SQLfieldname, column_picks('borrowers'),
|
||||
column_picks('suggestions'),
|
||||
column_picks('aqbooksellers'),
|
||||
column_picks('biblio'),
|
||||
column_picks('items');
|
||||
}
|
||||
elsif ( $module eq "reserves" ) {
|
||||
push @SQLfieldname, column_picks('borrowers'),
|
||||
column_picks('reserves'),
|
||||
column_picks('biblio'),
|
||||
column_picks('items');
|
||||
}
|
||||
elsif ( index( $module, "acquisition" ) > 0 ) { # FIXME: imprecise comparison
|
||||
push @SQLfieldname, column_picks('aqbooksellers'), column_picks('aqorders');
|
||||
# add issues specific tables
|
||||
}
|
||||
];
|
||||
push @{$field_selection}, add_fields('branches');
|
||||
|
|
|
|||
Loading…
Reference in New Issue