use vars qw($VERSION @ISA @EXPORT);
BEGIN {
- # set the version for version checking
- $VERSION = 3.01;
- require Exporter;
- @ISA = qw(Exporter);
- @EXPORT = qw(
- &NewSuggestion
- &SearchSuggestion
- &GetSuggestion
- &GetSuggestionByStatus
- &DelSuggestion
- &CountSuggestion
- &ModSuggestion
- &ConnectSuggestionAndBiblio
- &GetSuggestionFromBiblionumber
- &ConnectSuggestionAndBiblio
- &CountSuggestion
- &DelSuggestion
- &GetSuggestion
- &GetSuggestionByStatus
- &GetSuggestionFromBiblionumber
- &ModStatus
- &ModSuggestion
- &NewSuggestion
- );
+ # set the version for version checking
+ $VERSION = 3.01;
+ require Exporter;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(
+ &NewSuggestion
+ &SearchSuggestion
+ &GetSuggestion
+ &GetSuggestionByStatus
+ &DelSuggestion
+ &CountSuggestion
+ &ModSuggestion
+ &ConnectSuggestionAndBiblio
+ &GetSuggestionFromBiblionumber
+ &ConnectSuggestionAndBiblio
+ &DelSuggestion
+ &GetSuggestion
+ &GetSuggestionByStatus
+ &GetSuggestionFromBiblionumber
+ &ModStatus
+ &ModSuggestion
+ &NewSuggestion
+ );
}
=head1 NAME
my $dbh = C4::Context->dbh;
my @sql_params;
my @query = (
- q{ SELECT suggestions.*,
- U1.branchcode AS branchcodesuggestedby,
- B1.branchname AS branchnamesuggestedby,
- U1.surname AS surnamesuggestedby,
- U1.firstname AS firstnamesuggestedby,
- U1.email AS emailsuggestedby,
- U1.borrowernumber AS borrnumsuggestedby,
+ q{ SELECT suggestions.*,
+ U1.branchcode AS branchcodesuggestedby,
+ B1.branchname AS branchnamesuggestedby,
+ U1.surname AS surnamesuggestedby,
+ U1.firstname AS firstnamesuggestedby,
+ U1.email AS emailsuggestedby,
+ U1.borrowernumber AS borrnumsuggestedby,
U1.categorycode AS categorycodesuggestedby,
C1.description AS categorydescriptionsuggestedby,
- U2.surname AS surnamemanagedby,
- U2.firstname AS firstnamemanagedby,
- B2.branchname AS branchnamesuggestedby,
- U2.email AS emailmanagedby,
- U2.branchcode AS branchcodemanagedby,
- U2.borrowernumber AS borrnummanagedby
- FROM suggestions
- LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber
- LEFT JOIN branches AS B1 ON B1.branchcode=U1.branchcode
+ U2.surname AS surnamemanagedby,
+ U2.firstname AS firstnamemanagedby,
+ B2.branchname AS branchnamesuggestedby,
+ U2.email AS emailmanagedby,
+ U2.branchcode AS branchcodemanagedby,
+ U2.borrowernumber AS borrnummanagedby
+ FROM suggestions
+ LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber
+ LEFT JOIN branches AS B1 ON B1.branchcode=U1.branchcode
LEFT JOIN categories AS C1 ON C1.categorycode = U1.categorycode
- LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber
- LEFT JOIN branches AS B2 ON B2.branchcode=U2.branchcode
+ LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber
+ LEFT JOIN branches AS B2 ON B2.branchcode=U2.branchcode
LEFT JOIN categories AS C2 ON C2.categorycode = U2.categorycode
- WHERE STATUS NOT IN ('CLAIMED')
- } , map {
- if ( my $s = $$suggestion{$_} ) {
- push @sql_params,'%'.$s.'%';
- " and suggestions.$_ like ? ";
- } else { () }
- } qw( title author isbn publishercode collectiontitle )
- );
-
- my $userenv = C4::Context->userenv;
+ WHERE STATUS NOT IN ('CLAIMED')
+ } , map {
+ if ( my $s = $$suggestion{$_} ) {
+ push @sql_params,'%'.$s.'%';
+ " and suggestions.$_ like ? ";
+ } else { () }
+ } qw( title author isbn publishercode collectiontitle )
+ );
+
+ my $userenv = C4::Context->userenv;
if (C4::Context->preference('IndependantBranches')) {
- if ($userenv) {
- if (($userenv->{flags} % 2) != 1 && !$$suggestion{branchcode}){
- push @sql_params,$$userenv{branch};
- push @query,q{ and (branchcode = ? or branchcode ='')};
- }
- }
+ if ($userenv) {
+ if (($userenv->{flags} % 2) != 1 && !$$suggestion{branchcode}){
+ push @sql_params,$$userenv{branch};
+ push @query,q{ and (branchcode = ? or branchcode ='')};
+ }
+ }
}
foreach my $field (grep { my $fieldname=$_;
- any {$fieldname eq $_ } qw<
- STATUS branchcode itemtype suggestedby managedby acceptedby
- bookfundid biblionumber
- >} keys %$suggestion
+ any {$fieldname eq $_ } qw<
+ STATUS branchcode itemtype suggestedby managedby acceptedby
+ bookfundid biblionumber
+ >} keys %$suggestion
) {
- if ($$suggestion{$field}){
- push @sql_params,$$suggestion{$field};
- push @query, " and suggestions.$field=?";
- }
- else {
- push @query, " and (suggestions.$field='' OR suggestions.$field IS NULL)";
- }
+ if ($$suggestion{$field}){
+ push @sql_params,$$suggestion{$field};
+ push @query, " and suggestions.$field=?";
+ }
+ else {
+ push @query, " and (suggestions.$field='' OR suggestions.$field IS NULL)";
+ }
}
- $debug && warn "@query";
+ $debug && warn "@query";
my $sth=$dbh->prepare("@query");
$sth->execute(@sql_params);
my @results;
SELECT suggestionid
FROM suggestions
WHERE biblionumber=?
- };
- my $dbh=C4::Context->dbh;
+ };
+ my $dbh=C4::Context->dbh;
my $sth = $dbh->prepare($query);
$sth->execute($biblionumber);
my ($ordernumber) = $sth->fetchrow;
U1.firstname AS firstnamesuggestedby,
U1.branchcode AS branchcodesuggestedby,
B1.branchname AS branchnamesuggestedby,
- U1.borrowernumber AS borrnumsuggestedby,
- U1.categorycode AS categorycodesuggestedby,
+ U1.borrowernumber AS borrnumsuggestedby,
+ U1.categorycode AS categorycodesuggestedby,
C1.description AS categorydescriptionsuggestedby,
U2.surname AS surnamemanagedby,
U2.firstname AS firstnamemanagedby,
FROM suggestions
WHERE STATUS=?
|;
- $sth = $dbh->prepare($query);
+ $sth = $dbh->prepare($query);
$sth->execute($status);
}
my ($result) = $sth->fetchrow;
sub NewSuggestion {
my ($suggestion) = @_;
- $suggestion->{STATUS}="ASKED" unless $suggestion->{STATUS};
- return InsertInTable("suggestions",$suggestion);
+ $suggestion->{STATUS}="ASKED" unless $suggestion->{STATUS};
+ return InsertInTable("suggestions",$suggestion);
}
=head2 ModSuggestion
sub ModSuggestion {
my ($suggestion)=@_;
- my $status_update_table=UpdateInTable("suggestions", $suggestion);
+ my $status_update_table=UpdateInTable("suggestions", $suggestion);
# check mail sending.
if ($$suggestion{STATUS}){
my $letter=C4::Letters::getletter('suggestions',$$suggestion{STATUS});
if (!$enqueued){warn "can't enqueue letter $letter";}
}
}
- return $status_update_table;
+ return $status_update_table;
}
=head2 ConnectSuggestionAndBiblio
push( @loop_budget, { %{$result}, toggle => $toggle++ % 2, } );
}
-
-# ---------------------------------------------------
-
-=c FIXME
-
-
-### $cur
-
-## suggestions
-
-my $dbh = C4::Context->dbh;
-
-
-## liste des domaines
-
-my $sth=$dbh->prepare("
-SELECT bookfundgroupnumber,bookfundgroupname
-FROM `aq2bookfundgroups`
-ORDER BY Bookfundgroupname
-");
-$sth->execute;
-
-my @bookfundgroup_loop; ## liste des domaines
-
-while (my $row=$sth->fetchrow_hashref) {
- push @bookfundgroup_loop,$row;
-}
-$sth->finish;
-
-
-## liste des BFG ayant des suggestions à traiter
-
-
-## nowsuggestions = Number Of Waiting Suggestions
-
-my $dbh = C4::Context->dbh;
-
-my $sth=$dbh->prepare("
-SELECT bookfundgroupnumber, count(*) AS nowsuggestions
-FROM `aq2orders`
-WHERE step=2
-AND STATUS='ASKED'
-GROUP BY bookfundgroupnumber
-");
-$sth->execute;
-
-my @nowsuggestionsneq0_loop; ## liste des BFG ayant des suggestions à traiter
-
-while (my $row=$sth->fetchrow_hashref) {
- push @nowsuggestionsneq0_loop,$row;
-}
-$sth->finish;
-
-
-## liste des BFG avec l'effectif des suggestions à traiter (effectif éventuellement nul)
-
-my @nowsuggestions_loop;
-
-foreach my $data1 (@bookfundgroup_loop) {
- $data1->{'nowsuggestions'}=0;
- foreach my $data2 (@nowsuggestionsneq0_loop) {
- if ($data1->{'bookfundgroupnumber'}==$data2->{'bookfundgroupnumber'}) {
- $data1->{'nowsuggestions'}=$data2->{'nowsuggestions'};
- }
- }
-}
-
-=cut
-
-
$template->param(
classlist => $classlist,
type => 'intranet',
totspent => $num->format_price($totspent ),
totcomtd => $num->format_price( $totcomtd ),
totavail => $num->format_price( $totavail ),
-
- # nowsuggestions_loop => \@nowsuggestions_loop,
- # bookfundgroup_loop => \@bookfundgroup_loop,
- # numberofwaitingsuggestionsgpd => $numberofwaitingsuggestionsgpd,
- # numberofwaitingsuggestionspd => $numberofwaitingsuggestionspd,
- # suggestions_loop => $suggestions_loop,
-
+ suggestion => $suggestion,
);
output_html_with_http_headers $query, $cookie, $template->output;
<div id="doc3" class="yui-t2">
- <div id="bd">
- <div id="yui-main">
- <div class="yui-b">
+<div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
<!-- TMPL_INCLUDE NAME="acquisitions-toolbar.inc" -->
<fieldset>
<legend>Manage orders</legend>
<!-- TMPL_IF name="nobudget" -->
- <!-- TMPL_IF NAME="CAN_user_parameters" -->
+ <!-- TMPL_IF NAME="CAN_user_parameters" -->
<span class="problem">You must <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget</a> in Administration</span>
- <!-- TMPL_ELSE -->
- <span class="problem">Your administrator must define a budget in Administration</span>
- <!-- /TMPL_IF -->
+ <!-- TMPL_ELSE -->
+ <span class="problem">Your administrator must define a budget in Administration</span>
+ <!-- /TMPL_IF -->
<form name="findsupplier" action="/cgi-bin/koha/acqui/booksellers.pl" method="post">
<p><label for="supplierpage">Vendor </label><input type="text" size="25" name="supplier" id="supplierpage" class="focus" />
<input type="submit" value="Search" />
<fieldset>
<legend>Pending suggestions</legend>
<!-- TMPL_IF name="suggestion" -->
- <!--TMPL_VAR NAME="suggestion" --> suggestions waiting <a href="/cgi-bin/koha/suggestion/acceptorreject.pl">Manage suggestions</a>
+ <!--TMPL_VAR NAME="suggestion" --> suggestions waiting <a href="/cgi-bin/koha/suggestion/suggestion.pl">Manage suggestions</a>
<!-- TMPL_ELSE -->
<p>No suggestions waiting</p>
<!-- /TMPL_IF -->
- <br>
- <br>
- <table>
- <thead>
- <tr>
- <th>Book fund group</th>
- <th>number of <br>waiting sugg.</th>
- <th></th>
- </tr>
- </thead>
-
- <tbody>
- <!-- TMPL_LOOP name="bookfundgroup_loop" -->
- <tr>
- <td><!-- TMPL_VAR name="bookfundgroupname" --></td>
- <td><!-- TMPL_VAR name="nowsuggestions" --></td>
- <td><a href="/cgi-bin/koha/suggestion/acceptorrejectpd.pl?bookfundgroupnumber=<!-- TMPL_VAR name="bookfundgroupnumber" -->">manage</a></td>
- </tr>
- <!-- /TMPL_LOOP -->
- </tbody>
- </table>
-
</fieldset>
</div>
</div>
<th>Avail</th>
</tr>
</thead>
+ <tfoot>
+ <tr>
+ <th>Total</th>
+ <th> </th>
+ <th> </th>
+ <th align="right" ><!-- TMPL_VAR name="total" --></th>
+ <th align="right" ><!-- TMPL_VAR name="totspent" --></th>
+ <th align="right" ><!-- TMPL_VAR name="totavail" --></th>
+ </tr>
+ </tfoot>
<tbody>
-
-
<!-- TMPL_LOOP name="loop_budget" -->
-
- <!--TMPL_IF name="toggle"-->
- <tr class="highlight">
- <!--TMPL_ELSE-->
- <tr>
- <!--/TMPL_IF-->
-
+ <!--TMPL_IF name="toggle"-->
+ <tr class="highlight">
+ <!--TMPL_ELSE-->
+ <tr>
+ <!--/TMPL_IF-->
<td align="center"><!-- TMPL_VAR name="budget_code" --></td>
<td align="center"><!-- TMPL_VAR name="budget_owner" --></td>
<td align="center"><!-- TMPL_VAR name="budget_branchname" --></td>
- <td><p align="right" ><!-- TMPL_VAR name="budget_amount" --></p> </td>
- <td><p align="right" ><!-- TMPL_VAR name="budget_spent" --></p> </td>
- <td><p align="right" ><!-- TMPL_VAR name="budget_avail" --></p> </td>
-
+ <td align="right" ><!-- TMPL_VAR name="budget_amount" --></td>
+ <td align="right" ><!-- TMPL_VAR name="budget_spent" --></td>
+ <td align="right" ><!-- TMPL_VAR name="budget_avail" --></td>
</tr>
<!-- /TMPL_LOOP -->
</tbody>
-
- <tfoot>
- <tr>
- <th>Total</th>
- <td>
- <td>
- <th><p align="right" ><!-- TMPL_VAR name="total" --></p> </th>
- <th><p align="right" ><!-- TMPL_VAR name="totspent" --></p> </th>
- <th><p align="right" ><!-- TMPL_VAR name="totavail" --></p> </th>
- </tr>
- </tfoot>
</table>
</div>
-
-
- <p>Use your reload button [ctrl + r] to get the most recent figures.
- Committed figures are approximate only, as exchange rates will affect the amount actually paid.</p>
<!-- /TMPL_IF -->
-
-
<div id="acqui_acqui_home_currency">
<!-- TMPL_IF NAME="loop_currency" -->
<h3>Exchange rates</h3>
</div>
</div>
-
-<div id="acqui_acqui_home_hints">
- <h2>Help</h2>
- <p>To begin an order, local purchase or donation, search for the vendor or benefactor, and then you can create a new Basket.</p>
- <p>A Basket is a collection of orders.</p>
- <p>To order an item you need to establish whether a biblio already exists for it, and either add an item, or set up a new biblio and then add the item.</p>
-</div>
-
</div>
</div>
<div class="yui-b">