[freeside-commits] branch FREESIDE_3_BRANCH updated. 47ceec17a0b069a16686c93eca4bd227fc045625

Christopher Burger burgerc at 420.am
Tue Aug 1 09:42:12 PDT 2017


The branch, FREESIDE_3_BRANCH has been updated
       via  47ceec17a0b069a16686c93eca4bd227fc045625 (commit)
       via  6554e22d3f998a18c994bbe36b97db4e2a7e4837 (commit)
       via  3a1c3f5fa08c90b0c68ebe4b8858053777a0fcfc (commit)
       via  0f9f314fa40adf66b672065f8f3477789c50ae56 (commit)
      from  e41036e2c2c9fa3c70e13d56ec4ffb8168de99cc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 47ceec17a0b069a16686c93eca4bd227fc045625
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Aug 1 12:38:02 2017 -0400

    RT# 74665 - removed section name and updated disable query to keep working on V3

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 9f66073..c0e7cd0 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -1647,7 +1647,7 @@ and customer address. Include units.',
 
   {
     'key'         => 'quotation_disable_after_days',
-    'section'     => 'quotations',
+    'section'     => '',
     'description' => 'The number of days, if set, after which a non-converted quotation will be automatically disabled.',
     'type'        => 'text'
   },
diff --git a/FS/FS/Cron/disable_quotation.pm b/FS/FS/Cron/disable_quotation.pm
index fde2686..3a11586 100644
--- a/FS/FS/Cron/disable_quotation.pm
+++ b/FS/FS/Cron/disable_quotation.pm
@@ -14,7 +14,7 @@ sub disable_quotation {
             "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;
+        dbh->commit or die dbh->errstr;
     }
 }
 

commit 6554e22d3f998a18c994bbe36b97db4e2a7e4837
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Thu Apr 6 09:21:06 2017 -0400

    RT# 74665 - small cleanup of code, removed text value
    
    Conflicts:
    	httemplate/edit/quotation.html

diff --git a/httemplate/edit/quotation.html b/httemplate/edit/quotation.html
index 8aa0412..cd6da7a 100644
--- a/httemplate/edit/quotation.html
+++ b/httemplate/edit/quotation.html
@@ -17,7 +17,7 @@
                    { field=>'custnum',               type=>'fixed-cust_main' },
                    { field=>'_date',                 type=>'fixed-date' },
                    { field=>'quotation_description', type=>'text', size=>50 },
-                   { field=>'close_date',            type=>'input-date-field', value=>'30' },
+                   { field=>'close_date',            type=>'input-date-field' },
                    { field=>'confidence',            type=>'text', size=>3, postfix=>'%' },
                    ($can_disable ? { field=>'disabled', type=>'checkbox', value=>'Y'} : ()),
                               ],

commit 3a1c3f5fa08c90b0c68ebe4b8858053777a0fcfc
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Thu Apr 6 09:09:57 2017 -0400

    RT# 74665 -  set a default close date if global config quotation_disable_after_days is set
    
    Conflicts:
    	httemplate/edit/quotation.html

diff --git a/httemplate/edit/quotation.html b/httemplate/edit/quotation.html
index 15b2b3e..8aa0412 100644
--- a/httemplate/edit/quotation.html
+++ b/httemplate/edit/quotation.html
@@ -17,7 +17,7 @@
                    { field=>'custnum',               type=>'fixed-cust_main' },
                    { field=>'_date',                 type=>'fixed-date' },
                    { field=>'quotation_description', type=>'text', size=>50 },
-                   { field=>'close_date',            type=>'input-date-field' },
+                   { field=>'close_date',            type=>'input-date-field', value=>'30' },
                    { field=>'confidence',            type=>'text', size=>3, postfix=>'%' },
                    ($can_disable ? { field=>'disabled', type=>'checkbox', value=>'Y'} : ()),
                               ],
@@ -27,6 +27,9 @@
                                            foreach qw( prospectnum custnum );
                                          $quotation->_date(time);
                                        },
+                 'field_callback' => sub { my( $cgi, $quotation, $field_hashref ) = @_;
+                                         $quotation->close_date(($default_close_days * 86400) + time) if !$quotation->close_date && $default_close_days; 
+                                       },
            )
 %>
 <%init>
@@ -36,4 +39,8 @@ die "access denied"
 
 my $can_disable = $FS::CurrentUser::CurrentUser->access_right('Disable quotation');
 
+my $conf = new FS::Conf;
+
+my $default_close_days ||= $conf->config('quotation_disable_after_days');
+
 </%init>

commit 0f9f314fa40adf66b672065f8f3477789c50ae56
Author: Justin DeVuyst <justin at devuyst.com>
Date:   Mon Mar 20 16:17:56 2017 -0400

    Add configurable daily auto-disable for quotations.  See RT#74665.

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index c7dbd0b..9f66073 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -1646,6 +1646,13 @@ and customer address. Include units.',
   },
 
   {
+    '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.',
diff --git a/FS/FS/Cron/disable_quotation.pm b/FS/FS/Cron/disable_quotation.pm
new file mode 100644
index 0000000..fde2686
--- /dev/null
+++ b/FS/FS/Cron/disable_quotation.pm
@@ -0,0 +1,21 @@
+package FS::Cron::disable_quotation;
+
+use vars qw( @ISA @EXPORT_OK );
+use Exporter;
+use FS::UID qw(dbh);
+use FS::Conf;
+
+ at ISA = qw( Exporter );
+ at 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;
diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily
index eb1a3e3..5276a2f 100755
--- a/FS/bin/freeside-daily
+++ b/FS/bin/freeside-daily
@@ -82,6 +82,10 @@ agent_email(%opt);
 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();

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Conf.pm                   |    7 +++++++
 FS/FS/Cron/disable_quotation.pm |   21 +++++++++++++++++++++
 FS/bin/freeside-daily           |    4 ++++
 httemplate/edit/quotation.html  |    7 +++++++
 4 files changed, 39 insertions(+)
 create mode 100644 FS/FS/Cron/disable_quotation.pm




More information about the freeside-commits mailing list