From: Konrad Rosenbaum Date: Fri, 13 Jul 2012 07:57:09 +0000 (+0200) Subject: new customer wizard works X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=80905d2bdf3779e376d6ced792e4a6cf8d38008a;p=konrad%2Fsmoke.git new customer wizard works --- 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();