},
{
+ 'key' => 'quotation_disable_after_days',
+ 'section' => 'quotations',
+ 'description' => 'The number of days, if set, after which a non-converted quotation will be automatically disabled.',
+ 'type' => 'text'
+ },
+
+ {
'key' => 'invoice_print_pdf',
'section' => 'invoicing',
'description' => 'For all invoice print operations, store postal invoices for download in PDF format rather than printing them directly.',
--- /dev/null
+package FS::Cron::disable_quotation;
+
+use vars qw( @ISA @EXPORT_OK );
+use Exporter;
+use FS::UID qw(dbh);
+use FS::Conf;
+
+@ISA = qw( Exporter );
+@EXPORT_OK = qw( disable_quotation );
+
+sub disable_quotation {
+ if ( my $days = FS::Conf->new->config( 'quotation_disable_after_days' ) ) {
+ my $sth = dbh->prepare(
+ "UPDATE quotation SET disabled = 'Y' WHERE _date < ?"
+ ) or die dbh->errstr;
+ $sth->execute( time - ( $days * 86400 ) ) or die $sth->errstr;
+ dbh->commit or die dbh->errstr if $FS::UID::AutoCommit;
+ }
+}
+
+1;
use FS::Cron::send_subscribed qw(send_subscribed);
send_subscribed(%opt);
+#does nothing unless quotation_disable_after_days is set.
+use FS::Cron::disable_quotation qw(disable_quotation);
+disable_quotation();
+
#clears out cacti imports & deletes select database cache files
use FS::Cron::cleanup qw( cleanup cleanup_before_backup );
cleanup_before_backup();