X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FBP.pm;h=4489b8dae07ad84467be0aaa01fed9765995372f;hb=51aa7d3ccc53449c3582bae461d567ff2203e964;hp=711b988e75eabce70181d86695b50aeaafda3996;hpb=aad72b4a0c9e9eafc96dba41c317d3d66baad4fb;p=kivitendo-erp.git diff --git a/SL/BP.pm b/SL/BP.pm index 711b988e7..4489b8dae 100644 --- a/SL/BP.pm +++ b/SL/BP.pm @@ -25,7 +25,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # # Batch printing module backend routines @@ -39,54 +40,6 @@ use SL::DB; use strict; -sub get_vc { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my %arap = (invoice => 'ar', - sales_order => 'oe', - purchase_order => 'oe', - sales_quotation => 'oe', - request_quotation => 'oe', - check => 'ap', - receipt => 'ar'); - - my $vc = $form->{vc} eq "customer" ? "customer" : "vendor"; - my $arap_type = defined($arap{$form->{type}}) ? $arap{$form->{type}} : 'ar'; - - my $query = - qq|SELECT count(*) | . - qq|FROM (SELECT DISTINCT ON (vc.id) vc.id FROM $vc vc, $arap_type a, status s | . - qq| WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | . - qq| AND s.spoolfile IS NOT NULL) AS total|; - - my ($count) = selectrow_query($form, $dbh, $query, $form->{type}); - - # build selection list - if ($count < $myconfig->{vclimit}) { - $query = - qq|SELECT DISTINCT ON (vc.id) vc.id, vc.name | . - qq|FROM $vc vc, $arap_type a, status s | . - qq|WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | . - qq| AND s.spoolfile IS NOT NULL|; - - my $sth = $dbh->prepare($query); - $sth->execute($form->{type}) || $form->dberror($query . " ($form->{type})"); - - $form->{"all_${vc}"} = []; - while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - push @{ $form->{"all_${vc}"} }, $ref; - } - $sth->finish; - } - - $main::lxdebug->leave_sub(); -} - sub payment_accounts { $main::lxdebug->enter_sub(); @@ -261,7 +214,8 @@ sub delete_spool { unlink(qq|$spool/$form->{"spoolfile_$i"}|); } } - }); + 1; + }) or do { die SL::DB->client->error }; $main::lxdebug->leave_sub(); return 1; @@ -310,4 +264,3 @@ sub print_spool { } 1; -