示例#1
0
    def _process(self):
        if not self._cancel:
            for seItem in self._registrant.getSocialEvents()[:]:
                self._registrant.removeSocialEventById(seItem.getId())

            l = []
            for seItem in self._socialEvents:
                newSE = SocialEvent(seItem, int(self._places[seItem.getId()]))
                self._registrant.addSocialEvent(newSE)
        self._redirect(
            urlHandlers.UHRegistrantModification.getURL(self._registrant))
示例#2
0
    def _process( self ):
        if not self._cancel:
            for seItem in self._registrant.getSocialEvents()[:]:
                # Remove all items which can be added back (i.e. if paid only non-billable ones)
                if not (self._registrant.getPayed() and seItem.isBillable()):
                    self._registrant.removeSocialEventById(seItem.getId())

            l = []
            for seItem in self._socialEvents:
                # Only add item if the registrant hasn't paid yet or the item is not billable
                if not self._registrant.getPayed() or not seItem.isBillable():
                    newSE = SocialEvent(seItem, int(self._places[seItem.getId()]))
                    self._registrant.addSocialEvent(newSE)
        self._registrant.updateTotal()
        self._redirect(urlHandlers.UHRegistrantModification.getURL(self._registrant))
## along with Indico;if not, see <http://www.gnu.org/licenses/>.

from MaKaC.common import DBMgr
from MaKaC import conference
from MaKaC.registration import SocialEvent


def copy(l):
    nl = []
    for e in l:
        nl.append(e)
    return nl


DBMgr.getInstance().startRequest()
error = False
ch = conference.ConferenceHolder()
for conf in ch.getList():
    for reg in conf.getRegistrantsList():
        l = []
        for seItem in reg.getSocialEvents():
            newSE = SocialEvent(seItem)
            l.append(newSE)
        reg.setSocialEvents(l)

if not error:
    DBMgr.getInstance().endRequest()
    print "No error. The change are saved"
else:
    print "There were errors. The changes was not saved"