activate order detail view (not usable yet)
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Tue, 29 Dec 2009 17:55:52 +0000 (17:55 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Tue, 29 Dec 2009 17:55:52 +0000 (17:55 +0000)
some minor fixes

git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@371 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

src/iface/customer.cpp
src/iface/order.h
src/mwin/orderstab.cpp

index 281518e..8c2aabf 100644 (file)
@@ -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";
index 610ac84..d2c69ad 100644 (file)
@@ -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;}
index 009b688..3baf879 100644 (file)
@@ -22,8 +22,8 @@
 
 #include <QBoxLayout>
 #include <QComboBox>
+#include <QInputDialog>
 #include <QLabel>
-// #include <QMenu>
 #include <QMessageBox>
 #include <QPushButton>
 #include <QSettings>
@@ -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();
 }