some fixes
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sun, 9 Aug 2009 11:24:58 +0000 (11:24 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sun, 9 Aug 2009 11:24:58 +0000 (11:24 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@324 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

src/overview.cpp
src/wbase/exception.h
wob/event.wolf
woc/phpout.cpp
woc/processor.cpp
www/inc/classes/event.php
www/inc/wbase/object.php

index 80e6d79..ea83dfb 100644 (file)
@@ -382,7 +382,13 @@ MOverview::MOverview(QString pk)
 
 void MOverview::updateEvents()
 {
-       QList<MOEvent>evl=req->queryGetAllEvents().getevents();
+       QList<MOEvent>evl;
+       try{
+               evl=req->queryGetAllEvents().getevents();
+       }catch(WException e){
+               qDebug("Error getting all events (%s): %s",e.component().toAscii().data(),e.error().toAscii().data());
+               return;
+       }
        eventmodel->clear();
        eventmodel->insertColumns(0,6);
        eventmodel->setHorizontalHeaderLabels(QStringList()<<tr("Start Time")<<tr("Title")<<tr("Free")<<tr("Reserved")<<tr("Sold")<<tr("Capacity"));
index 59e4c6e..1dff0ea 100644 (file)
@@ -19,7 +19,7 @@ class WException
 {
        protected:
                WException(QString e,QString c){err=e;comp=c;}
-               
+       public:
                QString error()const{return err;}
                QString component()const{return comp;}
        private:
index 441d503..615584d 100644 (file)
                <Property name="end" type="int64"/>
                <Property name="capacity" type="int"/>
                <Property name="defaultprice" type="int"/>
-               <Property name="cancelled" type="bool"/>
                <Property name="title" type="string"/>
                <Property name="artist" type="string"/>
                <Property name="room" type="string"/>
+               <Property name="iscancelled" type="bool"/>
                <Property name="cancelreason" type="string"/>
                <Property name="amountSold" type="int"/>
                <Property name="amountReserved" type="int"/>
                <Property name="description" type="string"/>
+               <Property name="tax" type="int"/>
+               
+               <Mapping table="event">
+                       <Map column="eventid" property="id"/>
+                       <Map column="title"/>
+                       <Map column="artist"/>
+                       <Map column="description"/>
+                       <Map column="comment"/>
+                       <!--timing and location-->
+                       <Map column="starttime"/>
+                       <Map column="endtime"/>
+                       <Map column="roomid" property="room"/>
+                       <!--Map column="seatplanid"/-->
+                       <!--initially a copy from room, can be adjusted-->
+                       <Map column="capacity"/>
+                       <!-- flags -->
+                       <Map column="iscancelled"/>
+                       <Map column="flags"/>
+                       <Map column="tax"/>
+                       <!-- reason the event has been cancelled-->
+                       <Map column="cancelreason"/>
+               </Mapping>
        </Class>
        
        <Class name="Room">
        
        <Transaction name="GetAllEvents">
                <Input/>
-               <Call lang="php" method="GetAllEventsXml2($this);"/>
+               <Call lang="php" method="Event::getAllEvents($this);"/>
                <Output>
                        <Var name="events" type="List:Event"/>
                </Output>
index ec0ffbd..dd55d22 100644 (file)
@@ -615,6 +615,9 @@ QString WocPHPServerOut::classMappings(const WocClass&cls)
                        code+="\t$data[\""+map[j].second+"\"]=$table->"+map[j].first+";\n";
                }
                code+="\treturn new WO"+cls.name()+"($data);\n}\n";
+               code+="static public function fromTableArray"+k[i]+"(array $table){\n\t$ret=array();\n";
+               code+="\tfor($i=0;$i<count($table);$i++)$ret[]=self::fromTable"+k[i]+"($table[$i]);\n";
+               code+="\treturn $ret;\n}\n";
        }
        
        return code;
index 2a10684..5cae36e 100644 (file)
@@ -555,7 +555,7 @@ WocTable::WocTable(const QDomElement&tbl)
                return;
        }
        m_backup=str2bool(tbl.attribute("backup","0"));
-       m_base=tbl.attribute("base","WocTable");
+       m_base=tbl.attribute("base","WobTable");
        qDebug("Info: parsing table %s",m_name.toAscii().data());
        QDomNodeList nl=tbl.elementsByTagName("Column");
        //Columns
index 8f66e20..9798291 100644 (file)
@@ -180,6 +180,13 @@ class Event
                }
                return $this->capacity - $amt;
        }
+       
+       /**XML iface: get all events*/
+       public static function getAllEvents($trans)
+       {
+               $evlst=WOEvent::fromTableArrayevent(WTevent::selectFromDB(""));
+               $trans->setevents($evlst);
+       }
 };
 
 /**machine-function: get the requested events as XML data*/
index 154b388..946fb82 100644 (file)
@@ -12,7 +12,7 @@
 class WObject {
        protected $data;
        
-       protected __construct($d){$this->data=$d;}
+       protected function __construct($d){$this->data=$d;}
        
 };