<h3>Setting Customer Details</h3>
-The <tt>setcustomer</tt> 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 <tt>setcustomer</tt> 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.
<h3>Deleting and Merging Customers</h3>
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();
}
/*********************************************************/
}
//update data
- updateList();
- if(presel>-1){
- for(int i=0;i<m_proxymodel->rowCount();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
m_listmodel->setData(idx,i,Qt::UserRole);
}
m_listmodel->sort(0);
+ //reset current
+ if(nid>=0)
+ for(int i=0;i<m_proxymodel->rowCount();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()
{
MCustomerDialog cd(MCustomer(m_req),this);
if(cd.exec()==QDialog::Accepted)
- updateList();
+ updateList(cd.getCustomer().customerID());
}
void MCustomerListDialog::editCustomer()
{
MWebRequest*m_req;
/**updates internal list*/
- void updateList();
+ void updateList(int id=-1);
};
class QLineEdit;
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")));
<context>
<name>MCustomerDialog</name>
<message>
- <location filename="customer.cpp" line="360"/>
+ <location filename="customer.cpp" line="374"/>
<source>Customer %1</source>
<translation>Kunde %1</translation>
</message>
<message>
- <location filename="customer.cpp" line="362"/>
+ <location filename="customer.cpp" line="376"/>
<source>New Customer</source>
<translation>Neuer Kunde</translation>
</message>
<message>
- <location filename="customer.cpp" line="368"/>
+ <location filename="customer.cpp" line="382"/>
<source>Name:</source>
<translation>Name:</translation>
</message>
<message>
- <location filename="customer.cpp" line="370"/>
+ <location filename="customer.cpp" line="384"/>
<source>Address:</source>
<translation>Rechnungsadresse:</translation>
</message>
<message>
- <location filename="customer.cpp" line="373"/>
+ <location filename="customer.cpp" line="387"/>
<source>Contact Information:</source>
<translation>Kontaktinformationen:</translation>
</message>
<message>
- <location filename="customer.cpp" line="377"/>
+ <location filename="customer.cpp" line="391"/>
<source>Web-Login/eMail:</source>
<translation>Web-Login/eMail:</translation>
</message>
<message>
- <location filename="customer.cpp" line="380"/>
+ <location filename="customer.cpp" line="394"/>
<source>Comment:</source>
<translation>Kommentar:</translation>
</message>
<message>
- <location filename="customer.cpp" line="388"/>
+ <location filename="customer.cpp" line="402"/>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
- <location filename="customer.cpp" line="391"/>
+ <location filename="customer.cpp" line="405"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
<context>
<name>MCustomerListDialog</name>
<message>
- <location filename="customer.cpp" line="199"/>
+ <location filename="customer.cpp" line="201"/>
<source>Select a Customer</source>
<translation>Kunde auswählen</translation>
</message>
<message>
- <location filename="customer.cpp" line="201"/>
+ <location filename="customer.cpp" line="203"/>
<source>Customers</source>
<translation>Kunden</translation>
</message>
<message>
- <location filename="customer.cpp" line="220"/>
+ <location filename="customer.cpp" line="224"/>
<source>Details...</source>
<translation>Details...</translation>
</message>
<message>
- <location filename="customer.cpp" line="222"/>
+ <location filename="customer.cpp" line="226"/>
<source>Create new...</source>
<translation>Neu...</translation>
</message>
<message>
- <location filename="customer.cpp" line="225"/>
+ <location filename="customer.cpp" line="229"/>
<source>Delete...</source>
<translation>Löschen...</translation>
</message>
<message>
- <location filename="customer.cpp" line="233"/>
+ <location filename="customer.cpp" line="237"/>
<source>Select</source>
<translation>Auswählen</translation>
</message>
<message>
- <location filename="customer.cpp" line="236"/>
+ <location filename="customer.cpp" line="240"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
<message>
- <location filename="customer.cpp" line="239"/>
+ <location filename="customer.cpp" line="243"/>
<source>Close</source>
<translation>Schließen</translation>
</message>
<message>
- <location filename="customer.cpp" line="310"/>
+ <location filename="customer.cpp" line="324"/>
<source>Delete Customer</source>
<translation>Kunden Löschen</translation>
</message>
<message>
- <location filename="customer.cpp" line="313"/>
+ <location filename="customer.cpp" line="327"/>
<source>Really delete this customer (%1)?</source>
<translation>Diesen Kunden (%1) wirklich löschen?</translation>
</message>
<message>
- <location filename="customer.cpp" line="316"/>
+ <location filename="customer.cpp" line="330"/>
<source>merge with other entry:</source>
<translation>mit anderem Eintrag vereinen:</translation>
</message>
<message>
- <location filename="customer.cpp" line="328"/>
+ <location filename="customer.cpp" line="342"/>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
- <location filename="customer.cpp" line="330"/>
+ <location filename="customer.cpp" line="344"/>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
- <location filename="customer.cpp" line="346"/>
+ <location filename="customer.cpp" line="360"/>
<source>Error</source>
<translation>Fehler</translation>
</message>
<message>
- <location filename="customer.cpp" line="342"/>
+ <location filename="customer.cpp" line="356"/>
<source>Failed to delete customer.</source>
<translation>Kann Kunden nicht löschen.</translation>
</message>
<message>
- <location filename="customer.cpp" line="346"/>
+ <location filename="customer.cpp" line="360"/>
<source>Failed to delete customer: %1</source>
<translation>Kann Kunden nicht löschen: %1</translation>
</message>
</message>
<message>
<location filename="overview.cpp" line="188"/>
- <source>Order Items</source>
- <translation>Bestellung anlegen</translation>
+ <source>Check Order</source>
+ <translation>Bestellung prüfen</translation>
</message>
<message>
<location filename="overview.cpp" line="195"/>
<context>
<name>MCustomerDialog</name>
<message>
- <location filename="customer.cpp" line="360"/>
+ <location filename="customer.cpp" line="374"/>
<source>Customer %1</source>
<translation>Gunde %1</translation>
</message>
<message>
- <location filename="customer.cpp" line="362"/>
+ <location filename="customer.cpp" line="376"/>
<source>New Customer</source>
<translation>Neier Gunde</translation>
</message>
<message>
- <location filename="customer.cpp" line="368"/>
+ <location filename="customer.cpp" line="382"/>
<source>Name:</source>
<translation>Dor Name:</translation>
</message>
<message>
- <location filename="customer.cpp" line="370"/>
+ <location filename="customer.cpp" line="384"/>
<source>Address:</source>
<translation>De Adresse:</translation>
</message>
<message>
- <location filename="customer.cpp" line="373"/>
+ <location filename="customer.cpp" line="387"/>
<source>Contact Information:</source>
<translation>Wie mor den erreischen gann:</translation>
</message>
<message>
- <location filename="customer.cpp" line="377"/>
+ <location filename="customer.cpp" line="391"/>
<source>Web-Login/eMail:</source>
<translation>Wie er sisch im Web anmelden gann:</translation>
</message>
<message>
- <location filename="customer.cpp" line="380"/>
+ <location filename="customer.cpp" line="394"/>
<source>Comment:</source>
<translation>Gommendar:</translation>
</message>
<message>
- <location filename="customer.cpp" line="388"/>
+ <location filename="customer.cpp" line="402"/>
<source>Save</source>
<translation>Schbeichorn</translation>
</message>
<message>
- <location filename="customer.cpp" line="391"/>
+ <location filename="customer.cpp" line="405"/>
<source>Cancel</source>
<translation>Doch ni' machen</translation>
</message>
<context>
<name>MCustomerListDialog</name>
<message>
- <location filename="customer.cpp" line="199"/>
+ <location filename="customer.cpp" line="201"/>
<source>Select a Customer</source>
<translation>Gunde auswählen</translation>
</message>
<message>
- <location filename="customer.cpp" line="201"/>
+ <location filename="customer.cpp" line="203"/>
<source>Customers</source>
<translation>Gunden</translation>
</message>
<message>
- <location filename="customer.cpp" line="220"/>
+ <location filename="customer.cpp" line="224"/>
<source>Details...</source>
<translation>Dedails anzeichen...</translation>
</message>
<message>
- <location filename="customer.cpp" line="222"/>
+ <location filename="customer.cpp" line="226"/>
<source>Create new...</source>
<translation>Neuen anlechen...</translation>
</message>
<message>
- <location filename="customer.cpp" line="225"/>
+ <location filename="customer.cpp" line="229"/>
<source>Delete...</source>
<translation>Wechschmeißen...</translation>
</message>
<message>
- <location filename="customer.cpp" line="233"/>
+ <location filename="customer.cpp" line="237"/>
<source>Select</source>
<translation>Auswählen</translation>
</message>
<message>
- <location filename="customer.cpp" line="236"/>
+ <location filename="customer.cpp" line="240"/>
<source>Cancel</source>
<translation>Mach ma ni'</translation>
</message>
<message>
- <location filename="customer.cpp" line="239"/>
+ <location filename="customer.cpp" line="243"/>
<source>Close</source>
<translation>Zumachn</translation>
</message>
<message>
- <location filename="customer.cpp" line="310"/>
+ <location filename="customer.cpp" line="324"/>
<source>Delete Customer</source>
<translation>Gunden Löschn</translation>
</message>
<message>
- <location filename="customer.cpp" line="313"/>
+ <location filename="customer.cpp" line="327"/>
<source>Really delete this customer (%1)?</source>
<translation>Willsde den Gunden wirschlich löschen? Has'de Dir das och gud üborleschd? Das ist dor %1.</translation>
</message>
<message>
- <location filename="customer.cpp" line="316"/>
+ <location filename="customer.cpp" line="330"/>
<source>merge with other entry:</source>
<translation>Mid 'nem andorn Eindrag zusamm'lechn:</translation>
</message>
<message>
- <location filename="customer.cpp" line="328"/>
+ <location filename="customer.cpp" line="342"/>
<source>&Yes</source>
<translation>&Nu glar!</translation>
</message>
<message>
- <location filename="customer.cpp" line="330"/>
+ <location filename="customer.cpp" line="344"/>
<source>&No</source>
<translation>Nee &Lass ma!</translation>
</message>
<message>
- <location filename="customer.cpp" line="346"/>
+ <location filename="customer.cpp" line="360"/>
<source>Error</source>
<translation>Gans doller falschor Fehler</translation>
</message>
<message>
- <location filename="customer.cpp" line="342"/>
+ <location filename="customer.cpp" line="356"/>
<source>Failed to delete customer.</source>
<translation>Gann den Gunden ni löschen. Gomm'se morchen nochma'.</translation>
</message>
<message>
- <location filename="customer.cpp" line="346"/>
+ <location filename="customer.cpp" line="360"/>
<source>Failed to delete customer: %1</source>
<translation>Gann den Gunden "%1" ni löschen. Gomm'se morchen nochma'.</translation>
</message>
</message>
<message>
<location filename="overview.cpp" line="188"/>
- <source>Order Items</source>
- <translation>Ne Beschdellung anlegn.</translation>
+ <source>Check Order</source>
+ <translation type="unfinished">Ne Beschdellung anlegn.</translation>
</message>
<message>
<location filename="overview.cpp" line="195"/>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS><TS version="1.1" language="en">
-<defaultcodec></defaultcodec>
<context>
<name>MCheckDialog</name>
<message>
<context>
<name>MCustomerDialog</name>
<message>
- <location filename="customer.cpp" line="360"/>
+ <location filename="customer.cpp" line="374"/>
<source>Customer %1</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="362"/>
+ <location filename="customer.cpp" line="376"/>
<source>New Customer</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="368"/>
+ <location filename="customer.cpp" line="382"/>
<source>Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="370"/>
+ <location filename="customer.cpp" line="384"/>
<source>Address:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="373"/>
+ <location filename="customer.cpp" line="387"/>
<source>Contact Information:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="377"/>
+ <location filename="customer.cpp" line="391"/>
<source>Web-Login/eMail:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="380"/>
+ <location filename="customer.cpp" line="394"/>
<source>Comment:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="388"/>
+ <location filename="customer.cpp" line="402"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="391"/>
+ <location filename="customer.cpp" line="405"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<context>
<name>MCustomerListDialog</name>
<message>
- <location filename="customer.cpp" line="199"/>
+ <location filename="customer.cpp" line="201"/>
<source>Select a Customer</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="201"/>
+ <location filename="customer.cpp" line="203"/>
<source>Customers</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="220"/>
+ <location filename="customer.cpp" line="224"/>
<source>Details...</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="222"/>
+ <location filename="customer.cpp" line="226"/>
<source>Create new...</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="225"/>
+ <location filename="customer.cpp" line="229"/>
<source>Delete...</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="233"/>
+ <location filename="customer.cpp" line="237"/>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="236"/>
+ <location filename="customer.cpp" line="240"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="239"/>
+ <location filename="customer.cpp" line="243"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="310"/>
+ <location filename="customer.cpp" line="324"/>
<source>Delete Customer</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="313"/>
+ <location filename="customer.cpp" line="327"/>
<source>Really delete this customer (%1)?</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="316"/>
+ <location filename="customer.cpp" line="330"/>
<source>merge with other entry:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="328"/>
+ <location filename="customer.cpp" line="342"/>
<source>&Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="330"/>
+ <location filename="customer.cpp" line="344"/>
<source>&No</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="346"/>
+ <location filename="customer.cpp" line="360"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="342"/>
+ <location filename="customer.cpp" line="356"/>
<source>Failed to delete customer.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="customer.cpp" line="346"/>
+ <location filename="customer.cpp" line="360"/>
<source>Failed to delete customer: %1</source>
<translation type="unfinished"></translation>
</message>
</message>
<message>
<location filename="overview.cpp" line="188"/>
- <source>Order Items</source>
+ <source>Check Order</source>
<translation type="unfinished"></translation>
</message>
<message>