9 – Check & Set Publication Sort

#set( $gochange = false )
#set( $thisYear = '' )
    #set ($sql = ", BaseObject as obj, StringProperty as prop0, LongProperty as prop1, StringProperty as prop2, LargeStringProperty as prop3
       where
       obj.name = doc.fullName and
       obj.className = 'Publications.PublicationClass' and
       obj.name <> 'Publications.PublicationClassTemplate' and
       obj.name <> 'Publications.PublicationTemplate' and
       prop0.id.id = obj.id and
       prop1.id.id = obj.id and
       prop2.id.id = obj.id and
       prop3.id.id = obj.id and
       prop0.name = 'status' and
       prop0.value = 'Published' and
       prop1.name = 'year' and
       prop1.value like '%$thisYear%' and
       prop2.name = 'sort' and
       prop2.value = '' and
       prop3.name = 'abstract' and
       prop3.value like '%--%'
")
#set($pubFound = $xwiki.searchDocuments($sql))
##= $thisYear ($pubFound.size()) =
= $pubFound.size() =
#if( $pubFound.size()>0 )
  #foreach( $pub in $pubFound )
(((($foreach.count) {{pubAutheditors eds='true'}}$pub{{/pubAutheditors}}
{{pubTitle}}$pub{{/pubTitle}}
{{pubVenue}}$pub{{/pubVenue}})))
    #if( $gochange )
      #set( $pubDoc = $xwiki.getDocument($pub) )
      #set( $pubObj = $pubDoc.getObject('Publications.PublicationClass') )
      $pubObj.set('sort', 'inproceedings')
      $pubDoc.save()
    #end
  #end
#end
##         prop1.value = " + $thisYear +" and