Changeset 2718

Show
Ignore:
Timestamp:
10/26/07 05:56:48 (1 year ago)
Author:
coling
Message:
  • Weak attempt at using new ticket workflows (status\!='closed')
  • Properly esacpe summary
  • Add status field into the changes XML
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • clientsplugin/0.11/cron/send-client-email

    r2715 r2718  
    4545from trac.util.datefmt import format_date, to_datetime 
    4646from trac.wiki import wiki_to_html 
    47  
     47from genshi import escape 
    4848 
    4949parser = OptionParser() 
     
    226226              WHERE tcust.name = 'client' 
    227227                AND tcust.value = %s 
    228                 AND t.status IN ('new','assigned','reopened') 
     228                AND t.status != 'closed' 
    229229              """) 
    230230            cur2 = db.cursor() 
     
    235235              xml.write('<ticket>') 
    236236              xml.write('<id>%s</id>' % tid) 
    237               xml.write('<summary>%s</summary>' % summary
     237              xml.write('<summary>%s</summary>' % escape(summary)
    238238              xml.write('<description>%s</description>' % wiki_to_html(extract_client_text(description), self.env, self.req)) 
    239239              xml.write('<status>%s</status>' % status) 
     
    247247            # Load in any changes that have happend 
    248248            sql = ("""\ 
    249               SELECT t.id, t.summary, t.description, t.milestone, m.due, tchng.field, tchng.oldvalue, tchng.newvalue 
     249              SELECT t.id, t.summary, t.description, t.status, t.milestone, m.due, tchng.field, tchng.oldvalue, tchng.newvalue 
    250250              FROM ticket_custom tcust 
    251251              INNER JOIN ticket t ON tcust.ticket=t.id 
     
    263263            xml.write('<changes>') 
    264264            lasttid = 0 
    265             for tid, summary, description, milestone, due, cgfield, oldvalue, newvalue in cur2: 
     265            for tid, summary, description, status, milestone, due, cgfield, oldvalue, newvalue in cur2: 
    266266              text = '' 
    267267              if 'status' == cgfield: 
    268                 text = 'Status changed from &quot;%s&quot; to &quot;%s&quot;' % (oldvalue, newvalue) 
     268                text = 'Status changed from "%s" to "%s"' % (oldvalue, newvalue) 
    269269              elif 'milestone' == cgfield: 
    270                 text = 'Milestone changed from &quot;%s&quot; to &quot;%s&quot; - please check for revised delivery date.' % (oldvalue, newvalue) 
     270                text = 'Milestone changed from "%s" to "%s" - please check for revised delivery date.' % (oldvalue, newvalue) 
    271271              elif 'comment' == cgfield: 
    272272                # Todo - extract... 
     
    288288                xml.write('<ticket>') 
    289289                xml.write('<id>%s</id>' % tid) 
    290                 xml.write('<summary>%s</summary>' % summary
     290                xml.write('<summary>%s</summary>' % escape(summary)
    291291                xml.write('<description>%s</description>' % wiki_to_html(extract_client_text(description), self.env, self.req)) 
     292                xml.write('<status>%s</status>' % status) 
    292293                xml.write('<milestone>%s</milestone>' % milestone) 
    293294                xml.write('<due>%s</due>' % myformat_date(due))