From: ivan Date: Fri, 19 Apr 2002 01:16:39 +0000 (+0000) Subject: - add init file installation to Makefile, add unified init file X-Git-Tag: freeside_1_4_0_pre12~53 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=98a73bb080f55f4f5d850102bcec6da2807e3d4f - 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 --- diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index ed87b0c19..ac8117e70 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 66e032b0e..445c6951a 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 00ce1d944..e8cc67713 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 is +returned, otherwise, the single item B 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 21aeb4566..315d43070 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 4abdafc46..1618cf1fe 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 000000000..fd9e9e71b --- /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 +