From: konrad Date: Tue, 29 Dec 2009 17:55:52 +0000 (+0000) Subject: activate order detail view (not usable yet) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=936320d83fb674c7b69f9ecc2e79a63b7af65460;p=web%2Fkonrad%2Fsmoke.git activate order detail view (not usable yet) some minor fixes git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@371 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/iface/customer.cpp b/src/iface/customer.cpp index 281518e..8c2aabf 100644 --- a/src/iface/customer.cpp +++ b/src/iface/customer.cpp @@ -38,7 +38,7 @@ QString MCustomer::address(int i) if(adr.name().isNull())ret=name(); else ret=adr.name().value(); ret+="\n"; - if(!adr.company().isNull())ret+=adr.company().value()+"\n"; +// if(!adr.company().isNull())ret+=adr.company().value()+"\n"; if(!adr.addr1().isNull())ret+=adr.addr1().value()+"\n"; if(!adr.addr2().isNull())ret+=adr.addr2().value()+"\n"; if(!adr.city().isNull())ret+=adr.city().value()+"\n"; diff --git a/src/iface/order.h b/src/iface/order.h index 610ac84..d2c69ad 100644 --- a/src/iface/order.h +++ b/src/iface/order.h @@ -138,6 +138,7 @@ class MOrder:public MOOrder MOrder(qint64); /**copy order*/ MOrder(const MOrder&o):MOOrder(o){} + MOrder(const MOOrder&o):MOOrder(o){} /**copies the order*/ MOrder& operator=(const MOrder&o){MOOrder::operator=(o);return *this;} diff --git a/src/mwin/orderstab.cpp b/src/mwin/orderstab.cpp index 009b688..3baf879 100644 --- a/src/mwin/orderstab.cpp +++ b/src/mwin/orderstab.cpp @@ -22,8 +22,8 @@ #include #include +#include #include -// #include #include #include #include @@ -71,7 +71,7 @@ MOrdersTab::MOrdersTab(QString pk) vl->addSpacing(15); vl->addWidget(p=new QPushButton(tr("Details...")),0); connect(p,SIGNAL(clicked()),this,SLOT(orderDetails())); - p->setEnabled(req->hasRole("getorder")); + p->setEnabled(req->hasRight(req->RGetOrder)); vl->addSpacing(15); vl->addWidget(p=new QPushButton(tr("Find by Ticket...")),0); connect(p,SIGNAL(clicked()),this,SLOT(orderByTicket())); @@ -84,7 +84,7 @@ MOrdersTab::MOrdersTab(QString pk) p->setEnabled(req->hasRight(req->RGetOrdersByCustomer)); vl->addWidget(p=new QPushButton(tr("Find by Order ID...")),0); connect(p,SIGNAL(clicked()),this,SLOT(orderByOrder())); - p->setEnabled(req->hasRole("getorder")); + p->setEnabled(req->hasRight(req->RGetOrder)); vl->addStretch(10); @@ -163,7 +163,7 @@ void MOrdersTab::updateOrders() } void MOrdersTab::orderDetails() -{/*TODO +{ //get selected order int id; QModelIndexList ilst=ordertable->selectionModel()->selectedIndexes(); @@ -172,9 +172,14 @@ void MOrdersTab::orderDetails() id=ordermodel->data(idx,Qt::UserRole).toInt(); if(id<0)return; //open order window - MOrderWindow *om=new MOrderWindow(this,req,MOrder(req,id)); + MTGetOrder go=req->queryGetOrder(id); + if(go.hasError()){ + QMessageBox::warning(this,tr("Warning"),tr("Error while retrieving order: %1").arg(go.errorString())); + return; + } + MOrderWindow *om=new MOrderWindow(this,go.getorder().value()); om->setAttribute(Qt::WA_DeleteOnClose); - om->show();*/ + om->show(); } void MOrdersTab::orderByTicket() @@ -284,17 +289,22 @@ void MOrdersTab::orderByCustomer() } void MOrdersTab::orderByOrder() -{/*TODO +{ //ask for OrderID bool ok; int oid=QInputDialog::getInteger(this,tr("Enter Order ID"),tr("Please enter the ID of the order you want to display:"),0,0,2147483647,1,&ok); if(!ok)return; //display - MOrder ord(req,oid); - if(!ord.isValid()){ + MTGetOrder go=req->queryGetOrder(oid); + if(go.hasError()){ + QMessageBox::warning(this,tr("Warning"),tr("Error while retrieving order: %1").arg(go.errorString())); + return; + } + if(go.getorder().isNull()){ QMessageBox::warning(this,tr("Warning"),tr("This order does not exist.")); return; } - MOrderWindow *ow=new MOrderWindow(this,req,ord); - ow->show();*/ + MOrderWindow *om=new MOrderWindow(this,go.getorder().value()); + om->setAttribute(Qt::WA_DeleteOnClose); + om->show(); }