Letters / alert system, continuing...
* adding a package Letters.pm, that manages Letters & alerts. * adding feature : it's now possible to define a "letter" for any subscription created. If a letter is defined, users in OPAC can put an alert on the subscription. When an issue is marked "arrived", all users in the alert will recieve a mail (as defined in the "letter"). This last part (= send the mail) is not yet developped. (Should be done this week) * adding feature : it's now possible to "put to an alert" in OPAC, for any serial subscription. The alert is stored in a new table, called alert. An alert can be put only if the librarian has activated them in subscription (and they activate it just by choosing a "letter" to sent to borrowers on new issues) * adding feature : librarian can see in borrower detail which alerts they have put, and a user can see in opac-detail which alert they have put too. Note that the system should be generic enough to manage any type of alert. I plan to extend it soon to virtual shelves : a borrower will be able to put an alert on a virtual shelf, to be warned when something is changed in the virtual shelf (mail being sent once a day by cron, or manually by the shelf owner. Anyway, a mail won't be sent on every change, users would be spammed by Koha ;-) )
This commit is contained in:
parent
df6c6bcada
commit
bee8cebb41
|
|
@ -0,0 +1,36 @@
|
|||
<!-- TMPL_INCLUDE NAME="opac-top.inc" -->
|
||||
|
||||
<div id="mainbloc">
|
||||
<!-- TMPL_IF name="typeissue" -->
|
||||
<h1 class="catalogue">Subscribe to an alert</h1>
|
||||
<div id="bloc20">
|
||||
<h2>Confirmation</h2>
|
||||
<form action="opac-alert-subscribe.pl" method="post">
|
||||
<p>Do you confirm you want to subscribe to alerts for <!-- TMPL_VAR name="bibliotitle" --> <!-- TMPL_IF name="notes" -->(<!-- TMPL_VAR name="notes" -->)<!-- /TMPL_IF --> ?</p>
|
||||
<input type="hidden" name="externalid" value="<!-- TMPL_VAR name="externalid" -->">
|
||||
<input type="hidden" name="alerttype" value="issue">
|
||||
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->">
|
||||
<input type="hidden" name="op" value="alert_confirmed">
|
||||
<input type="submit" value="Yes" class="button">
|
||||
<a href="opac-serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->" class="button">No</a>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF name="typeissuecancel" -->
|
||||
<h1 class="catalogue">Unsubscribe to an alert</h1>
|
||||
<div id="bloc20">
|
||||
<h2>Confirmation</h2>
|
||||
<form action="opac-alert-subscribe.pl" method="post">
|
||||
<p>Do you confirm you want to <b>un</b>subscribe to alerts for <!-- TMPL_VAR name="bibliotitle" --> <!-- TMPL_IF name="notes" -->(<!-- TMPL_VAR name="notes" -->)<!-- /TMPL_IF --> ?</p>
|
||||
<input type="hidden" name="externalid" value="<!-- TMPL_VAR name="externalid" -->">
|
||||
<input type="hidden" name="alerttype" value="issue">
|
||||
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->">
|
||||
<input type="hidden" name="op" value="cancel_confirmed">
|
||||
<input type="submit" value="Yes" class="button">
|
||||
<a href="opac-serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->" class="button">No</a>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /TMPL_IF -->
|
||||
</div>
|
||||
|
||||
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Date;
|
||||
use C4::Output;
|
||||
use C4::Interface::CGI::Output;
|
||||
use C4::Context;
|
||||
use C4::Koha;
|
||||
use C4::Letters;
|
||||
use C4::Bull;
|
||||
# use C4::Search;
|
||||
use HTML::Template;
|
||||
|
||||
my $query = new CGI;
|
||||
my $op = $query->param('op');
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
my $sth;
|
||||
my ($template, $loggedinuser, $cookie);
|
||||
my $externalid = $query->param('externalid');
|
||||
my $alerttype = $query->param('alerttype');
|
||||
my $biblionumber = $query->param('biblionumber');
|
||||
|
||||
($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "opac-alert-subscribe.tmpl",
|
||||
query => $query,
|
||||
type => "opac",
|
||||
authnotrequired => 1,
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
if ($op eq 'alert_confirmed') {
|
||||
addalert($loggedinuser,$alerttype,$externalid);
|
||||
if ($alerttype eq 'issue') {
|
||||
print $query->redirect("opac-serial-issues.pl?biblionumber=$biblionumber");
|
||||
exit;
|
||||
}
|
||||
} elsif ($op eq 'cancel_confirmed') {
|
||||
my $alerts =getalert($loggedinuser,$alerttype,$externalid);
|
||||
foreach (@$alerts) { # we are supposed to have only 1 result, but just in case...
|
||||
delalert($_->{alertid});
|
||||
}
|
||||
if ($alerttype eq 'issue') {
|
||||
print $query->redirect("opac-serial-issues.pl?biblionumber=$biblionumber");
|
||||
exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($alerttype eq 'issue') { # alert for subscription issues
|
||||
my $subscription = &getsubscription($externalid);
|
||||
$template->param("typeissue$op" => 1,
|
||||
bibliotitle => $subscription->{bibliotitle},
|
||||
notes => $subscription->{notes},
|
||||
externalid => $externalid,
|
||||
biblionumber => $biblionumber,
|
||||
);
|
||||
} else {
|
||||
}
|
||||
|
||||
}
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
@ -80,9 +80,19 @@ my %requiretables = (
|
|||
content text,
|
||||
PRIMARY KEY (module,code)
|
||||
)",
|
||||
alert =>"(
|
||||
alertid int(11) NOT NULL auto_increment,
|
||||
borrowernumber int(11) NOT NULL default '0',
|
||||
type varchar(10) NOT NULL default '',
|
||||
externalid varchar(20) NOT NULL default '',
|
||||
PRIMARY KEY (alertid),
|
||||
KEY borrowernumber (borrowernumber),
|
||||
KEY type (type,externalid)
|
||||
)"
|
||||
);
|
||||
|
||||
my %requirefields = (
|
||||
subscription => { 'letter' => 'char(20) NULL'},
|
||||
# tablename => { 'field' => 'fieldtype' },
|
||||
);
|
||||
|
||||
|
|
@ -358,6 +368,17 @@ $sth->finish;
|
|||
exit;
|
||||
|
||||
# $Log$
|
||||
# Revision 1.116 2005/08/04 08:55:54 tipaul
|
||||
# Letters / alert system, continuing...
|
||||
#
|
||||
# * adding a package Letters.pm, that manages Letters & alerts.
|
||||
# * adding feature : it's now possible to define a "letter" for any subscription created. If a letter is defined, users in OPAC can put an alert on the subscription. When an issue is marked "arrived", all users in the alert will recieve a mail (as defined in the "letter"). This last part (= send the mail) is not yet developped. (Should be done this week)
|
||||
# * adding feature : it's now possible to "put to an alert" in OPAC, for any serial subscription. The alert is stored in a new table, called alert. An alert can be put only if the librarian has activated them in subscription (and they activate it just by choosing a "letter" to sent to borrowers on new issues)
|
||||
# * adding feature : librarian can see in borrower detail which alerts they have put, and a user can see in opac-detail which alert they have put too.
|
||||
#
|
||||
# Note that the system should be generic enough to manage any type of alert.
|
||||
# I plan to extend it soon to virtual shelves : a borrower will be able to put an alert on a virtual shelf, to be warned when something is changed in the virtual shelf (mail being sent once a day by cron, or manually by the shelf owner. Anyway, a mail won't be sent on every change, users would be spammed by Koha ;-) )
|
||||
#
|
||||
# Revision 1.115 2005/08/02 16:15:34 tipaul
|
||||
# adding 2 fields to letter system :
|
||||
# * module (acquisition, catalogue...) : it will be usefull to show the librarian only letters he may be interested by.
|
||||
|
|
@ -744,6 +765,17 @@ $sth->finish;
|
|||
exit;
|
||||
|
||||
# $Log$
|
||||
# Revision 1.116 2005/08/04 08:55:54 tipaul
|
||||
# Letters / alert system, continuing...
|
||||
#
|
||||
# * adding a package Letters.pm, that manages Letters & alerts.
|
||||
# * adding feature : it's now possible to define a "letter" for any subscription created. If a letter is defined, users in OPAC can put an alert on the subscription. When an issue is marked "arrived", all users in the alert will recieve a mail (as defined in the "letter"). This last part (= send the mail) is not yet developped. (Should be done this week)
|
||||
# * adding feature : it's now possible to "put to an alert" in OPAC, for any serial subscription. The alert is stored in a new table, called alert. An alert can be put only if the librarian has activated them in subscription (and they activate it just by choosing a "letter" to sent to borrowers on new issues)
|
||||
# * adding feature : librarian can see in borrower detail which alerts they have put, and a user can see in opac-detail which alert they have put too.
|
||||
#
|
||||
# Note that the system should be generic enough to manage any type of alert.
|
||||
# I plan to extend it soon to virtual shelves : a borrower will be able to put an alert on a virtual shelf, to be warned when something is changed in the virtual shelf (mail being sent once a day by cron, or manually by the shelf owner. Anyway, a mail won't be sent on every change, users would be spammed by Koha ;-) )
|
||||
#
|
||||
# Revision 1.115 2005/08/02 16:15:34 tipaul
|
||||
# adding 2 fields to letter system :
|
||||
# * module (acquisition, catalogue...) : it will be usefull to show the librarian only letters he may be interested by.
|
||||
|
|
|
|||
Loading…
Reference in New Issue