From 6684020ee63ff4cd12035e5edd8143f8b27409e9 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Sat, 1 Sep 2007 16:57:07 +0000 Subject: Creating customers now works. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1488 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/CT.pm | 54 ++++-------------------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/LedgerSMB/CT.pm b/LedgerSMB/CT.pm index e870323e..e9497b57 100644 --- a/LedgerSMB/CT.pm +++ b/LedgerSMB/CT.pm @@ -212,55 +212,10 @@ sub _save_vc { # this should really all be replaced by an upsert. if ( $form->{id} ) { - $query = qq| - DELETE FROM $form->{vc}tax - WHERE entity_id = - (select entity_id from $form->{vc} - WHERE id = ?)|; - - $sth = $dbh->prepare($query); - $sth->execute( $form->{id} ) || $form->dberror($query); - - $query = qq| - SELECT id - FROM $form->{vc} - WHERE id = ?|; - - $sth = $dbh->prepare($query); - $sth->execute( $form->{id} ) || $form->dberror($query); + # This module is depricated, so we are just going to throw an error here + $form->error("Updating $form->{vc} not supported. ". + "Please wait for us to move to the new codebase."); - if ( $sth->fetchrow_array ) { - $sth->finish; - $query = qq| - UPDATE enti - SET discount = ? - taxincluded = ? - creditlimit = ? - terms = ? - $form->{vc}number = ? - cc = ? - bcc = ? - business_id = ? - sic_code = ? - language_code = ? - pricegroup_id = ? - curr = ? - startdate = ? - enddate = ? - bic = ? - iban = ? - WHERE id = ?|; - $sth = $dbh->prepare($query); - $sth->execute( - $form->{discount}, $form->{taxincluded}, $form->{creditlimit}, - $form->{terms}, $form->{"$form->{vc}number"}, $form->{cc}, - $form->{bcc}, $form->{business_id}, $form->{sic_code}, - $form->{language_code}, $form->{pricegroup_id}, - $form->{curr}, $form->{startdate}, $form->{enddate}, - $form->{bic}, $form->{iban}, $form->{id} - ) || $form->dberror(__FILE__.":".__LINE__.":$query"); - $updated = 1; - } } if (!$updated){ # Creating Entity @@ -307,7 +262,6 @@ sub _save_vc { $form->{taxnumber}, $form->{sic_code}); # Creating entity_metadata record, replacing customer and vendor. - $query = qq| INSERT INTO entity_credit_account (entity_id, entity_class, discount, taxincluded, creditlimit, @@ -350,7 +304,7 @@ sub save_customer { my $query; my $sth; my $null; - + $form->{vc} = 'customer'; # remove double spaces $form->{name} =~ s/ / /g; -- cgit v1.2.3