From 80905d2bdf3779e376d6ced792e4a6cf8d38008a Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Fri, 13 Jul 2012 09:57:09 +0200 Subject: [PATCH] new customer wizard works --- src/dialogs/customerdlg.cpp | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/dialogs/customerdlg.cpp b/src/dialogs/customerdlg.cpp index 74d011c..f4587f1 100644 --- a/src/dialogs/customerdlg.cpp +++ b/src/dialogs/customerdlg.cpp @@ -1021,16 +1021,31 @@ void MNewCustomerWizard::save() MOAddress adr; adr.setaddr1(m_addr1->text()); adr.setcity(m_city->currentText()); - adr.setstate(m_state->currentText()); + if(!m_state->currentText().trimmed().isEmpty()) + adr.setstate(m_state->currentText()); adr.setzipcode(m_zipcode->text()); - //handle country - qDebug()<<"Country Idx"<currentIndex()<<"Name"<currentText()<<"ID"<itemData(m_country->currentIndex()).toString(); - return; -// adr.setcountryid(m_country->); + adr.setcountryid(m_country->itemData(m_country->currentIndex()).toString()); //complete addr inp.addaddresses(adr); + //contacts + for(int i=0;itext().trimmed().isEmpty())continue; + MOContact con; + con.setcontacttypeid(ct.contacttypeid()); + con.setcontact(le->text()); + inp.addcontacts(con); + } //create customer MTCreateCustomer cc=req->queryCreateCustomer(inp); + if(!cc.hasError()){ + m_cust=cc.getcustomer(); + accept(); + return; + } if(QMessageBox::warning(this,tr("Warning"),tr("There was an error while creating the customer: %1").arg(cc.errorString()),QMessageBox::Abort|QMessageBox::Retry)==QMessageBox::Retry)return; //close dialog accept(); -- 1.7.2.5