Пример #1
0
def save(request, *args):
    logger.debug('*** quote: save : enter ***')
    id = request.POST.get('id', '')
    id = int(id)
    comment = request.POST.get('comment', '')
    completed = request.POST.get('completed', '')
    email = request.user.email

    qr = Quoterequest.objects.get(id=id)
    toNode = request.POST.get('tonode', None)
    if toNode is None:
        #no new toNode supplied? Use the old one...
        toNode = qr.tonode
    logger.debug('\ttoNode is %s' % (str(toNode)))
    #if the node has changed, email the administrator(s) for the new node
    try:
        if toNode != qr.tonode:
            targetusers = _findAdminOrNodeRepEmailTarget(groupname=toNode)
            #email the administrators for the node
            for targetuser in targetusers:
                targetemail = targetuser['uid'][0]
                sendQuoteRequestToAdminEmail(request, id, email, '',
                                             targetemail)
    except Exception, e:
        logger.exception('Exception emailing change to quote request')
Пример #2
0
def save(request, *args):
    logger.debug('*** quote: save : enter ***')
    id = request.POST.get('id', '')
    id = int(id)
    comment = request.POST.get('comment', '')
    completed = request.POST.get('completed', '')
    email = request.user.email

    qr = Quoterequest.objects.get(id=id)
    toNode = request.POST.get('tonode', None)
    if toNode is None:
        #no new toNode supplied? Use the old one...
        toNode = qr.tonode
    logger.debug('\ttoNode is %s' % (str(toNode)) )
    #if the node has changed, email the administrator(s) for the new node
    try:
        if toNode != qr.tonode:
            targetusers = _findAdminOrNodeRepEmailTarget(groupname = toNode)
            #email the administrators for the node
            for targetuser in targetusers:
                targetemail = targetuser['uid'][0]
                sendQuoteRequestToAdminEmail(request, id, email, '', targetemail)
    except Exception, e:
        logger.exception('Exception emailing change to quote request')
Пример #3
0
    except Exception, e:
        logger.exception('Exception saving attached file.')
        raise Exception('Exception saving attached file.')

    try:
        sendQuoteRequestConfirmationEmail(request, qr.id, email)
        #email the administrator(s) for the node
        logger.debug('Argument to _findAdminOrNodeRepEmailTarget is: %s' % (str(toNode)) )
        if toNode == '': #if the node was 'Dont Know'
            searchgroups = MADAS_ADMIN_GROUP
        else:
            searchgroups = toNode
        targetUsers = _findAdminOrNodeRepEmailTarget(groupname = searchgroups)
        for targetUser in targetUsers:
            sendQuoteRequestToAdminEmail(request, qr.id, firstname, lastname, targetUser['uid'][0]) #toemail should be a string, but ldap returns are all lists
    except Exception, e:
        logger.exception('Error sending mail in SendRequest: %s' % ( str(e) ) )

    logger.debug( '*** quote:sendRequest: exit ***' )
    return jsonResponse( mainContentFunction='quote:request')

@admins_or_nodereps
def listQuotesRequiringAttention(request):
    '''Used by dashboard to list the quotes that aren't Completed and don't have
       a formal quote yet.'''

    qs = Quoterequest.objects.filter(completed=False, formalquote__isnull=True)

    #If they are a noderep (only), we filter the qs by node
    if request.user.IsNodeRep and not request.user.IsAdmin:
Пример #4
0
        logger.exception('Exception saving attached file.')
        raise Exception('Exception saving attached file.')

    try:
        sendQuoteRequestConfirmationEmail(request, qr.id, email)
        #email the administrator(s) for the node
        logger.debug('Argument to _findAdminOrNodeRepEmailTarget is: %s' %
                     (str(toNode)))
        if toNode == '':  #if the node was 'Dont Know'
            searchgroups = MADAS_ADMIN_GROUP
        else:
            searchgroups = toNode
        targetUsers = _findAdminOrNodeRepEmailTarget(groupname=searchgroups)
        for targetUser in targetUsers:
            sendQuoteRequestToAdminEmail(
                request, qr.id, firstname, lastname, targetUser['uid'][0]
            )  #toemail should be a string, but ldap returns are all lists
    except Exception, e:
        logger.exception('Error sending mail in SendRequest: %s' % (str(e)))

    logger.debug('*** quote:sendRequest: exit ***')
    return jsonResponse(mainContentFunction='quote:request')


@admins_or_nodereps
def listQuotesRequiringAttention(request):
    '''Used by dashboard to list the quotes that aren't Completed and don't have
       a formal quote yet.'''

    qs = Quoterequest.objects.filter(completed=False, formalquote__isnull=True)