X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fsql_generic.pm;fp=FS%2FFS%2Fpart_pkg%2Fsql_generic.pm;h=90472947d58cc633463ff519177d8188359fda32;hb=e3dffa23a03cd9f88946ceb78bc75ada29bc013a;hp=0e6ab7c0dbde47a4b33c1b55cae7aa6c6f2b4f0a;hpb=d4734cefabb54109fc036cb030adff6f5c5b5119;p=freeside.git diff --git a/FS/FS/part_pkg/sql_generic.pm b/FS/FS/part_pkg/sql_generic.pm index 0e6ab7c0d..90472947d 100644 --- a/FS/FS/part_pkg/sql_generic.pm +++ b/FS/FS/part_pkg/sql_generic.pm @@ -10,6 +10,7 @@ use FS::part_pkg::flat; %info = ( 'name' => 'Base charge plus a per-domain metered rate from a configurable SQL query', + 'shortname' => 'Bulk (per-domain from SQL query)', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -45,7 +46,7 @@ use FS::part_pkg::flat; # 'recur' => '\'my $dbh = DBI->connect(\"\' + what.datasrc.value + \'\", \"\' + what.db_username.value + \'\") or die $DBI::errstr; \'', #'recur' => '\'my $dbh = DBI->connect(\"\' + what.datasrc.value + \'\", \"\' + what.db_username.value + \'\", \"\' + what.db_password.value + \'\" ) or die $DBI::errstr; my $sth = $dbh->prepare(\"\' + what.query.value + \'\") or die $dbh->errstr; my $units = 0; foreach my $cust_svc ( grep { $_->part_svc->svcdb eq \"svc_domain\" } $cust_pkg->cust_svc ) { my $domain = $cust_svc->svc_x->domain; $sth->execute($domain) or die $sth->errstr; $units += $sth->fetchrow_arrayref->[0]; } $units -= \' + what.recur_included.value + \'; $units = 0 if $units < 0; \' + what.recur_flat.value + \' + $units * \' + what.recur_unit_charge.value + \';\'', #'recur' => '\'my $dbh = DBI->connect("\' + what.datasrc.value + \'", "\' + what.db_username.value + \'", "\' what.db_password.value + \'" ) or die $DBI::errstr; my $sth = $dbh->prepare("\' + what.query.value + \'") or die $dbh->errstr; my $units = 0; foreach my $cust_svc ( grep { $_->part_svc->svcdb eq "svc_domain" } $cust_pkg->cust_svc ) { my $domain = $cust_svc->svc_x->domain; $sth->execute($domain) or die $sth->errstr; $units += $sth->fetchrow_arrayref->[0]; } $units -= \' + what.recur_included.value + \'; $units = 0 if $units < 0; \' + what.recur_flat.value + \' + $units * \' + what.recur_unit_charge + \';\'', - 'weight' => '70', + 'weight' => '56', ); sub calc_recur {