From: konrad Date: Sat, 13 Dec 2008 21:37:38 +0000 (+0000) Subject: * clearer name for check order button X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=71e2370569ff59d28a3adac3a01845c360c3c36d;p=konrad%2Fsmoke.git * clearer name for check order button * preselect new customers * fix customer preselection on dlg create git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@214 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/doc/prog_protocol.html b/doc/prog_protocol.html index 33e0663..77309f5 100644 --- a/doc/prog_protocol.html +++ b/doc/prog_protocol.html @@ -432,7 +432,7 @@ The "mail" attribute is optional - it is only reported for customers that have a

Setting Customer Details

-The setcustomer transaction is used to set details of the customer. The request contains a customer XML object as listed above, but without the mail attribute. The response is empty. +The setcustomer transaction is used to set details of the customer. The request contains a customer XML object as listed above, but without the mail attribute. The response contains the ID of the customer.

Deleting and Merging Customers

diff --git a/src/customer.cpp b/src/customer.cpp index 09290b1..5fcc512 100644 --- a/src/customer.cpp +++ b/src/customer.cpp @@ -185,8 +185,10 @@ void MCustomer::save() cse.appendChild(el); doc.appendChild(cse); //request - m_req->request("setcustomer",doc.toByteArray()); - //TODO: do something useful with the result + if(!m_req->request("setcustomer",doc.toByteArray()))return; + //check result code + if(m_req->responseStatus()!=MWebRequest::Ok)return; + m_id=m_req->responseBody().trimmed().toInt(); } /*********************************************************/ @@ -243,18 +245,17 @@ MCustomerListDialog::MCustomerListDialog(MWebRequest*r,QWidget*par,bool isselect } //update data - updateList(); - if(presel>-1){ - for(int i=0;irowCount();i++){ - QModelIndex idx=m_proxymodel->index(0,i); - if(m_proxymodel->data(idx,Qt::UserRole).toInt()==presel) - m_listview->setCurrentIndex(idx); - } - } + updateList(presel); } -void MCustomerListDialog::updateList() +void MCustomerListDialog::updateList(int nid) { + //check for current selection + if(nid<0){ + QModelIndex idx=m_listview->currentIndex(); + if(idx.isValid()) + nid=m_proxymodel->data(idx,Qt::UserRole).toInt(); + } //go to server m_list=m_req->getAllCustomers(); //update widget @@ -267,6 +268,17 @@ void MCustomerListDialog::updateList() m_listmodel->setData(idx,i,Qt::UserRole); } m_listmodel->sort(0); + //reset current + if(nid>=0) + for(int i=0;irowCount();i++){ + QModelIndex idx=m_proxymodel->index(i,0); + int j=m_proxymodel->data(idx,Qt::UserRole).toInt(); + if(j<0 || j>=m_list.size())continue; + if(nid==m_list[j].customerID()){ + m_listview->setCurrentIndex(idx); + break; + } + } } MCustomer MCustomerListDialog::getCustomer() @@ -284,7 +296,7 @@ void MCustomerListDialog::newCustomer() { MCustomerDialog cd(MCustomer(m_req),this); if(cd.exec()==QDialog::Accepted) - updateList(); + updateList(cd.getCustomer().customerID()); } void MCustomerListDialog::editCustomer() { diff --git a/src/customer.h b/src/customer.h index a63b1f5..4bf7282 100644 --- a/src/customer.h +++ b/src/customer.h @@ -120,7 +120,7 @@ class MCustomerListDialog:public QDialog MWebRequest*m_req; /**updates internal list*/ - void updateList(); + void updateList(int id=-1); }; class QLineEdit; diff --git a/src/overview.cpp b/src/overview.cpp index 645717f..19bf76e 100644 --- a/src/overview.cpp +++ b/src/overview.cpp @@ -185,7 +185,7 @@ MOverview::MOverview(MWebRequest*mw,QString pk) frm->setFrameShape(QFrame::HLine); vl->addLayout(hl=new QHBoxLayout,0); hl->addStretch(10); - hl->addWidget(p=new QPushButton(tr("Order Items"))); + hl->addWidget(p=new QPushButton(tr("Check Order"))); p->setEnabled(req->hasRole("checkorder")); connect(p,SIGNAL(clicked()),this,SLOT(cartOrder())); hl->addWidget(p=new QPushButton(tr("Clear"))); diff --git a/src/smoke_de.ts b/src/smoke_de.ts index bd722b4..bdbcf7d 100644 --- a/src/smoke_de.ts +++ b/src/smoke_de.ts @@ -17,47 +17,47 @@ MCustomerDialog - + Customer %1 Kunde %1 - + New Customer Neuer Kunde - + Name: Name: - + Address: Rechnungsadresse: - + Contact Information: Kontaktinformationen: - + Web-Login/eMail: Web-Login/eMail: - + Comment: Kommentar: - + Save Speichern - + Cancel Abbrechen @@ -65,82 +65,82 @@ MCustomerListDialog - + Select a Customer Kunde auswählen - + Customers Kunden - + Details... Details... - + Create new... Neu... - + Delete... Löschen... - + Select Auswählen - + Cancel Abbrechen - + Close Schließen - + Delete Customer Kunden Löschen - + Really delete this customer (%1)? Diesen Kunden (%1) wirklich löschen? - + merge with other entry: mit anderem Eintrag vereinen: - + &Yes &Ja - + &No &Nein - + Error Fehler - + Failed to delete customer. Kann Kunden nicht löschen. - + Failed to delete customer: %1 Kann Kunden nicht löschen: %1 @@ -1775,8 +1775,8 @@ At least %1 Bits of random are required. - Order Items - Bestellung anlegen + Check Order + Bestellung prüfen diff --git a/src/smoke_de_SAX.ts b/src/smoke_de_SAX.ts index 7e7b5e8..30759c6 100644 --- a/src/smoke_de_SAX.ts +++ b/src/smoke_de_SAX.ts @@ -16,47 +16,47 @@ MCustomerDialog - + Customer %1 Gunde %1 - + New Customer Neier Gunde - + Name: Dor Name: - + Address: De Adresse: - + Contact Information: Wie mor den erreischen gann: - + Web-Login/eMail: Wie er sisch im Web anmelden gann: - + Comment: Gommendar: - + Save Schbeichorn - + Cancel Doch ni' machen @@ -64,82 +64,82 @@ MCustomerListDialog - + Select a Customer Gunde auswählen - + Customers Gunden - + Details... Dedails anzeichen... - + Create new... Neuen anlechen... - + Delete... Wechschmeißen... - + Select Auswählen - + Cancel Mach ma ni' - + Close Zumachn - + Delete Customer Gunden Löschn - + Really delete this customer (%1)? Willsde den Gunden wirschlich löschen? Has'de Dir das och gud üborleschd? Das ist dor %1. - + merge with other entry: Mid 'nem andorn Eindrag zusamm'lechn: - + &Yes &Nu glar! - + &No Nee &Lass ma! - + Error Gans doller falschor Fehler - + Failed to delete customer. Gann den Gunden ni löschen. Gomm'se morchen nochma'. - + Failed to delete customer: %1 Gann den Gunden "%1" ni löschen. Gomm'se morchen nochma'. @@ -1774,8 +1774,8 @@ At least %1 Bits of random are required. - Order Items - Ne Beschdellung anlegn. + Check Order + Ne Beschdellung anlegn. diff --git a/src/smoke_en.ts b/src/smoke_en.ts index 8d68cf8..ce3a786 100644 --- a/src/smoke_en.ts +++ b/src/smoke_en.ts @@ -1,6 +1,5 @@ - MCheckDialog @@ -17,47 +16,47 @@ MCustomerDialog - + Customer %1 - + New Customer - + Name: - + Address: - + Contact Information: - + Web-Login/eMail: - + Comment: - + Save - + Cancel @@ -65,82 +64,82 @@ MCustomerListDialog - + Select a Customer - + Customers - + Details... - + Create new... - + Delete... - + Select - + Cancel - + Close - + Delete Customer - + Really delete this customer (%1)? - + merge with other entry: - + &Yes - + &No - + Error - + Failed to delete customer. - + Failed to delete customer: %1 @@ -1490,7 +1489,7 @@ At least %1 Bits of random are required. - Order Items + Check Order