summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-04-19 01:16:39 +0000
committerivan <ivan>2002-04-19 01:16:39 +0000
commit98a73bb080f55f4f5d850102bcec6da2807e3d4f (patch)
tree960bf3f9117760ee030020a9104b836f69910d43
parent6866bdda26d1feb152af991388113e2e9309fafb (diff)
- add init file installation to Makefile, add unified init file
- fix qsearch for op => '!=', value => '' searches - fix invalid_catd typo - add payby method to part_pkg and have fs_signup_server pass the data
-rw-r--r--FS/FS/Record.pm20
-rw-r--r--FS/FS/cust_main.pm4
-rw-r--r--FS/FS/part_pkg.pm24
-rw-r--r--Makefile11
-rwxr-xr-xfs_signup/fs_signup_server3
-rw-r--r--init.d/freeside-init58
6 files changed, 110 insertions, 10 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index ed87b0c..ac8117e 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -224,10 +224,24 @@ sub qsearch {
}
if ( ! defined( $record->{$_} ) || $record->{$_} eq '' ) {
- if ( driver_name =~ /^Pg$/i ) {
- qq-( $_ IS NULL OR $_ = '' )-;
+ if ( $op eq '=' ) {
+ if ( driver_name =~ /^Pg$/i ) {
+ qq-( $_ IS NULL OR $_ = '' )-;
+ } else {
+ qq-( $_ IS NULL OR $_ = "" )-;
+ }
+ } elsif ( $op eq '!=' ) {
+ if ( driver_name =~ /^Pg$/i ) {
+ qq-( $_ IS NOT NULL AND $_ != '' )-;
+ } else {
+ qq-( $_ IS NOT NULL AND $_ != "" )-;
+ }
} else {
- qq-( $_ IS NULL OR $_ = "" )-;
+ if ( driver_name =~ /^Pg$/i ) {
+ qq-( $_ $op '' )-;
+ } else {
+ qq-( $_ $op "" )-;
+ }
}
} else {
"$_ $op ?";
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 66e032b..445c695 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -644,11 +644,11 @@ sub check {
my $payinfo = $self->payinfo;
$payinfo =~ s/\D//g;
$payinfo =~ /^(\d{13,16})$/
- or return gettext('invalid_catd'); # . ": ". $self->payinfo;
+ or return gettext('invalid_card'); # . ": ". $self->payinfo;
$payinfo = $1;
$self->payinfo($payinfo);
validate($payinfo)
- or return gettext('invalid_catd'); # . ": ". $self->payinfo;
+ or return gettext('invalid_card'); # . ": ". $self->payinfo;
return gettext('unknown_card_type')
if cardtype($self->payinfo) eq "Unknown";
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 00ce1d9..e8cc677 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -262,11 +262,33 @@ sub svcpart {
$pkg_svc[0]->svcpart;
}
+=item payby
+
+Returns a list of the acceptable payment types for this package. Eventually
+this should come out of a database table and be editable, but currently has the
+following logic instead;
+
+If the package has B<0> setup and B<0> recur, the single item B<BILL> is
+returned, otherwise, the single item B<CARD> is returned.
+
+=cut
+
+sub payby {
+ my $self = shift;
+ #if ( $self->setup == 0 && $self->recur == 0 ) {
+ if ( $self->setup =~ /^\s*0+(\.0*)?\s*$/
+ && $self->recur =~ /^\s*0+(\.0*)?\s*$/ ) {
+ ( 'BILL' );
+ } else {
+ ( 'CARD' );
+ }
+}
+
=back
=head1 VERSION
-$Id: part_pkg.pm,v 1.9 2002-03-24 17:42:58 ivan Exp $
+$Id: part_pkg.pm,v 1.10 2002-04-19 01:16:39 ivan Exp $
=head1 BUGS
diff --git a/Makefile b/Makefile
index 21aeb45..315d430 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,10 @@ ASP_GLOBAL = /usr/local/etc/freeside/asp-global
FREESIDE_DOCUMENT_ROOT = /var/www/freeside
+INIT_FILE = /etc/init.d/freeside
+
HTTPD_RESTART = /etc/init.d/apache restart
-QUEUED_RESTART = /etc/init.d/freeside restart
+FREESIDE_RESTART = /etc/init.d/freeside restart
#---
@@ -74,11 +76,14 @@ install-perl-modules: perl-modules
cd FS; \
make install UNINST=1
-install: install-perl-modules install-docs
+install-init:
+ [ -e ${INIT_FILE} ] || install -o root -g root -m 711 init.d/freeside-init ${INIT_FILE}
+
+install: install-perl-modules install-docs install-init
deploy: install
${HTTPD_RESTART}
- ${QUEUED_RESTART}
+ ${FREESIDE_RESTART}
create-database:
perl -e 'use DBIx::DataSource qw( create_database ); create_database( "${DATASOURCE}", "${DB_USER}", "${DB_PASSWORD}" ) or die $$DBIx::DataSource::errstr;'
diff --git a/fs_signup/fs_signup_server b/fs_signup/fs_signup_server
index 4abdafc..1618cf1 100755
--- a/fs_signup/fs_signup_server
+++ b/fs_signup/fs_signup_server
@@ -67,7 +67,8 @@ while (1) {
'part_pkg' =>
[
- map { $_->hashref }
+ #map { $_->hashref }
+ map { { 'payby' => [ $_->payby ], %{$_->hashref} } }
grep { $_->svcpart('svc_acct') && $pkgpart_href->{ $_->pkgpart } }
qsearch( 'part_pkg', { 'disabled' => '' } )
],
diff --git a/init.d/freeside-init b/init.d/freeside-init
new file mode 100644
index 0000000..fd9e9e7
--- /dev/null
+++ b/init.d/freeside-init
@@ -0,0 +1,58 @@
+#! /bin/sh
+#
+# chkconfig: 345 86 16
+# description: Freeside daemons
+
+QUEUED_USER=ivan
+
+FREESIDE_PATH="/home/ivan/freeside_current"
+
+PASSWD_USER=ivan
+PASSWD_MACHINE=localhost
+
+SIGNUP_USER=ivan
+SIGNUP_MACHINE=localhost
+SIGNUP_AGENTNUM=2
+SIGNUP_REFNUM=2
+
+case "$1" in
+ start)
+ # Start daemons.
+ echo -n "Starting freeside-queued: "
+ freeside-queued $QUEUED_USER
+ echo "done."
+
+ echo -n "Starting fs_passwd_server: "
+ su freeside -c "$FREESIDE_PATH/fs_passwd/fs_passwd_server $PASSWD_USER $PASSWD_MACHINE" &
+ echo "done."
+
+ echo -n "Starting fs_signup_server: "
+ su freeside -c "$FREESIDE_PATH/fs_signup/fs_signup_server $SIGNUP_USER $SIGNUP_MACHINE $SIGNUP_AGENTNUM $SIGNUP_REFNUM" &
+ echo "done."
+ ;;
+ stop)
+ # Stop daemons.
+ echo -n "Stopping freeside-queued: "
+ kill `cat /var/run/freeside-queued.pid`
+ echo "done."
+
+ echo -n "Stopping fs_passwd_server: "
+ killall fs_passwd_server
+ echo "done."
+
+ echo -n "Stopping fs_passwd_server: "
+ killall fs_signup_server
+ echo "done."
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: freeside {start|stop|restart}"
+ exit 1
+esac
+
+exit 0
+