[Koha-patches] [PATCH] (BUG #4811) suggestion.pl: display borrowers name in suggestion information filters (Suggested By, Managed by, Accepted by)
Chris Cormack
chrisc at catalyst.net.nz
Thu Mar 24 21:54:07 CET 2011
From: Alex Arnaud <alex.arnaud at biblibre.com>
---
C4/Search.pm | 2 +-
suggestion/suggestion.pl | 25 ++++++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/C4/Search.pm b/C4/Search.pm
index cd970b7..162159d 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -2662,7 +2662,7 @@ sub GetDistinctValues {
my ($table,$column)=split /\./, $fieldname;
my $dbh = C4::Context->dbh;
warn "select DISTINCT($column) as value, count(*) as cnt from $table group by lib order by $column " if $DEBUG;
- my $sth = $dbh->prepare("select DISTINCT($column) as value, count(*) as cnt from $table ".($string?" where $column like \"$string%\"":"")."group by value order by $column ");
+ my $sth = $dbh->prepare("select DISTINCT($column) as value, count(*) as cnt from $table where $column is not null ".($string?" and $column like \"$string%\"":"")." group by value order by $column ");
$sth->execute;
my $elements=$sth->fetchall_arrayref({});
return $elements;
diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl
index 5aca561..1668958 100755
--- a/suggestion/suggestion.pl
+++ b/suggestion/suggestion.pl
@@ -56,7 +56,7 @@ sub GetCriteriumDesc{
return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) if ($displayby =~/status/i);
return (GetBranchName($criteriumvalue)) if ($displayby =~/branchcode/);
return (GetSupportName($criteriumvalue)) if ($displayby =~/itemtype/);
- if ($displayby =~/managedby/||$displayby =~/acceptedby/){
+ if ( $displayby =~ /managedby/ || $displayby =~ /acceptedby/ || $displayby =~ /suggestedby/) {
my $borr=C4::Members::GetMember(borrowernumber=>$criteriumvalue);
return "" unless $borr;
return $$borr{firstname} . ", " . $$borr{surname};
@@ -125,6 +125,7 @@ elsif ($op=~/edit/) {
#Edit suggestion
$suggestion_ref=&GetSuggestion($$suggestion_ref{'suggestionid'});
Init($suggestion_ref);
+<<<<<<< HEAD
$op ='save';
}
elsif ($op eq "change" ) {
@@ -146,6 +147,28 @@ elsif ($op eq "change" ) {
foreach (keys %$suggestion_ref){
delete $$suggestion_ref{$_} unless ($$suggestion_ref{$_});
}
+=======
+ $op = 'save';
+} elsif ( $op eq "change" ) {
+ if ( $$suggestion_ref{"STATUS"} ) {
+ if ( my $tmpstatus = lc( $$suggestion_ref{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) {
+ $$suggestion_ref{ lc( $$suggestion_ref{"STATUS"}) . "date" } = C4::Dates->today;
+ $$suggestion_ref{ lc( $$suggestion_ref{"STATUS"}) . "by" } = C4::Context->userenv->{number};
+ }
+ $$suggestion_ref{"manageddate"} = C4::Dates->today;
+ $$suggestion_ref{"managedby"} = C4::Context->userenv->{number};
+ }
+ if ( my $reason = $$suggestion_ref{"reason$tabcode"} ) {
+ if ( $reason eq "other" ) {
+ $reason = $$suggestion_ref{"other_reason$tabcode"};
+ }
+ $$suggestion_ref{'reason'} = $reason;
+ }
+ delete $$suggestion_ref{$_} foreach ( "reason$tabcode", "other_reason$tabcode" );
+ foreach ( keys %$suggestion_ref ) {
+ delete $$suggestion_ref{$_} unless ( $$suggestion_ref{$_} );
+ }
+>>>>>>> (BUG #4811) suggestion.pl: display borrowers name in suggestion information filters (Suggested By, Managed by, Accepted by)
foreach my $suggestionid (@editsuggestions) {
next unless $suggestionid;
$$suggestion_ref{'suggestionid'}=$suggestionid;
--
1.7.1
More information about the Koha-patches
mailing list