Example #1
0
 def onSelectItem(self,event):
     currentItem = event.m_itemIndex
     m_item=Emprunt.get(self.getColumnText(currentItem, 5))
     m_item.checkin()
     m_item.item.change_status("BORROWABLE")
     if self.is_dialog:
         self.parent.close_the_window()
Example #2
0
 def OnSearch(self,event):
     self.list.DeleteAllItems()
     self.authorString=self.author.GetValue()
     self.titleString=self.title.GetValue()
     self.firstnameString=self.firstname.GetStringSelection()
     self.lastnameString=self.lastname.GetStringSelection()
     i = 0
     bookcondition={}
     usercondition={}
     bookcondition["author"]=self.authorString
     bookcondition["title"]=self.titleString
     usercondition["fn"]=self.firstnameString
     usercondition["ln"]=self.lastnameString
         
     for x in Emprunt.select("return_date is null"):
         print x.date
         isGood=1
         item = x.getItem()
         member = x.getBorrower()
         titres = item.title # titres = title in french... 
         title = titres.booktitle
         a = Author.select("title_id=\'%d\'" % titres.id)
         a = list(a)
         print "6..."
         if len(a) > 1 or len(a) == 0:
             print "Shit !"
         author = a[0].authorName
         print author
         if len(usercondition) >= 1:
             if len(usercondition["fn"]) > 0 and not(member.first_name.find(usercondition['fn'])):
                 isGood=0
             else:
                 print "f n matches"
             if len(usercondition["ln"]) > 0 and not(member.last_name.find(usercondition['ln'])):
                 isGood=0
             else:
                 print "l n matches"
         if len(bookcondition) >= 1:
             if len(bookcondition["title"]) > 0 and not(title.find(bookcondition['title'])):
                 isGood=0
             else:
                 print "title matches"
             if len(bookcondition["author"]) > 0 and not(author.find(bookcondition["author"])):
                 isGood=0
             else:
                 print "author matches"
         if isGood == 1:
             self.list.InsertStringItem(i,title)
             self.list.SetStringItem(i,1,author)
             self.list.SetStringItem(i,2,member.first_name)
             self.list.SetStringItem(i,3,member.last_name)
             self.list.SetStringItem(i,4,x.date.isoformat())
             self.list.SetStringItem(i,5, "%d" % x.id)
             self.list.SetItemData(i,i)
             i=i+1
     if i>0:
         for x in range(6):
             self.list.SetColumnWidth(x, wxLIST_AUTOSIZE)
     EVT_LIST_ITEM_ACTIVATED(self,self.list.GetId(), self.onSelectItem)
Example #3
0
 def Borrow(self, id):
     borrower = self.parent.membersList.get(id)
     print borrower
     for i in self.parent.orderbox.items:
         # Check if this work on sqlobject 0.7... I got
         # lots of problem on 0.6.1, and itemID __isn't__
         # defined in emprunt, which is plain weirdness
         e = Emprunt(borrower=id, itemID=i.database_id)
         print i.database_id
     self.parent.orderbox.setBorrowed()
     self.parent.orderbox.void()
     self.Close()