Beispiel #1
0
def query_project_members(performDbQuery=0,onLoad=None,queryFields=None):

    status,table_data,db=pageInit('Members',formJS=0)
    if status != 'success':
        message='Could not connect to database.\n%s' % status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)
    if status != 'success':
        exit(details)

    # Check for user admin privileges
    if pmt_utils.hasPriv(db, username,'user_admin')!=1:
        message='User %s does not have user admin privileges.' % username
        exit(message)

    queryFields,whereFields=pmt_utils.getQueryWhereFields(form,
                                                          table_data,
                                                          'project_members')

    if queryFields == None or queryFields == []:
        queryFields = []
        whereFields = None
        queryFields.append('first_name')
        queryFields.append('last_name')
        queryFields.append('phone_number_voice')

    dbResult,queryStatement=pmt_utils.executeQuery(db,
                                                   table_data,
                                                   'project_members',
                                                   queryFields,
                                                   whereFields,
                                                   'query',
                                                   queryItemFunctionsHtml,
                                                   'ORDER by last_name',
                                                   ['id'],
                                                   None,None,
                                                   "return execute('query')",
                                                   ["",""])
    if dbResult['status'] != 'success':
        message="Could not get member data from db.\n%s" % dbResult['message']
        exit(message)
    msg="Last Query Statement: %s\n" % queryStatement
    msg=msg+"%s project members retrieved from db" % `len(dbResult['result'])`
    pmt_utils.alertsArea(form,msg)

    # Add buttons and hidden fields
    help_url='/%s/html/contactsum.html' % db_name
    pmt_utils.queryFunctionButtons(1,help_url)

    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')
    
    pageEnd(table_data,db)
Beispiel #2
0
def query_spr(performDbQuery=0, onLoad=None, queryFields=None):

    status,table_data,db=pageInit('Problem Reports',formJS=0)

    if status != 'success':
        message="Can not connect to database.\n%s" % status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)
            
    queryFields, whereFields = pmt_utils.getQueryWhereFields(form,
                                                             table_data,
                                                             'spr')

    if queryFields == None or queryFields == []:
        queryFields = []
        whereFields = None
        queryFields.append('id')
        queryFields.append('gist')
        queryFields.append('spr_status')
        queryFields.append('assigned_to')

    ignore_fields = ['analyst_signature_function',
                     'swm_analysis_signature_function',
                     'swm_completion_signature_function',
                     'test_completion_signature_function',
                     'cm_completion_signature_function',
                     'qa_completion_signature_function']

    del_priv=pmt_utils.hasPriv(db, username, 'del_spr')
    dbResult,queryStatement=pmt_utils.executeQuery(db,
                                                  table_data,
                                                  'spr',
                                                  queryFields,
                                                  whereFields,
                                                  'query',
                                                  queryItemFunctionsHtml,
                                                  'ORDER by int4(id)',
                                                  ['id','originator'],
                                                  None,
                                                  ignore_fields,
                                                  "return execute('query')",
                                                  ["","",del_priv])

    if dbResult['status'] != 'success':
        message="Could not retrieve spr data from db.\n" + dbResult['message']
        exit(message)

    msg="Last Query Statement: %s\n" % queryStatement
    msg=msg+"%s items retrieved from database." % `len(dbResult['result'])`
    exit(msg,table_data,db,display_login=0)
Beispiel #3
0
def query_project_members(performDbQuery=0, onLoad=None, queryFields=None):

    status, table_data, db = pageInit('Members', formJS=0)

    if username == None:
        message = "Unable to identify user."
        exit(message)

    if status != 'success':
        message = "Can not connect to database.\n" + dbResult['message']
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)

    queryFields, whereFields = pmt_utils.getQueryWhereFields(
        form, table_data, 'project_members')

    if queryFields == None or queryFields == []:
        queryFields = []
        whereFields = None
        queryFields.append('first_name')
        queryFields.append('last_name')
        queryFields.append('email')
        queryFields.append('phone_number_voice')
        queryFields.append('phone_extension')

    dbResult, queryStatement = pmt_utils.executeQuery(
        db, table_data, 'project_members', queryFields, whereFields, 'query',
        queryItemFunctionsHtml, 'ORDER by last_name',
        ['id', 'member_username'], None, ['member_password'],
        "return execute('query')", [username])

    if dbResult['status'] != 'success':
        message = "Couldn't get user data from db.\n" + dbResult['message']
        exit(message)

    pmt_utils.alertsArea(form,
                         "Last Query Statement: "+queryStatement+\
                         "\n" + `len(dbResult['result'])` +\
                         " project members retrieved from db")

    queryFunctionButtons(1, '/%s/html/contactsum.html' % (db_name))

    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')

    pageEnd(table_data, db)
Beispiel #4
0
def query_ecp(performDbQuery=0, onLoad=None, queryFields=None):

    status, table_data, db = pageInit('Change Proposals', formJS=0)
    if status != 'success':
        message = "Cannot connect to db.\n%s" % status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)

    queryFields, whereFields = pmt_utils.getQueryWhereFields(
        form, table_data, 'ecp')

    if queryFields == None or queryFields == []:
        queryFields = []
        whereFields = None
        queryFields.append('id')
        queryFields.append('change_name')
        queryFields.append('ecp_status')

    ignore_fields = [
        'analyst_signature_function', 'swm_analysis_signature_function',
        'swm_completion_signature_function', 'ccb_signature_function',
        'gccb_signature_function', 'qa_completion_signature_function'
    ]

    del_priv = pmt_utils.hasPriv(db, username, 'del_ecp')

    dbResult, queryStatement = pmt_utils.executeQuery(
        db, table_data, 'ecp', queryFields, whereFields, 'query',
        queryItemFunctionsHtml, 'ORDER by int4(id)', ['id', 'originator'],
        None, ignore_fields, "return execute('query')", ["", "", del_priv])

    if dbResult['status'] != 'success':
        message = "Unable to get ECP data from db.\n" + dbResult['message']
        exit(message)

    message = "Last Query Statement: %s\n" % queryStatement
    message = message + ` len(dbResult['result']) ` + " items retrieved."
    exit(message, table_data, db, login_display=0)
Beispiel #5
0
def query_inventory(performDbQuery=0, onLoad=None, queryFields=None):

    status, table_data, db = pageInit('Inventory', formJS=0)

    if status != 'success':
        message = "Can not connect to database.\n%s" % status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)

    queryFields, whereFields = pmt_utils.getQueryWhereFields(
        form, table_data, 'inventory')

    if queryFields == None or queryFields == []:
        queryFields = []
        whereFields = None
        queryFields.append('quantity')
        queryFields.append('part_number')
        queryFields.append('description')
        queryFields.append('unit_price')
    ignore_fields = []
    del_priv = pmt_utils.hasPriv(db, username, 'del_inv')
    dbResult, queryStatement = pmt_utils.executeQuery(
        db, table_data, 'inventory', queryFields, whereFields, 'query',
        queryItemFunctionsHtml, 'ORDER by int4(id)', ['id'], None,
        ignore_fields, "return execute('query')", ["", "", del_priv])

    if dbResult['status'] != 'success':
        message = "Could not retrieve inv data from db.\n" + dbResult['message']
        exit(message)

    msg = "Last Query Statement: %s\n" % queryStatement
    msg = msg + "%s items retrieved from database." % ` len(
        dbResult['result']) `
    exit(msg, table_data, db)
Beispiel #6
0
def query_pai(performDbQuery=0, onLoad=None, queryFields=None):

    status, table_data, db = pageInit("Action Items", formJS=0)

    if status != 'success':
        message = "Can not connect to database.\n%s" % status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)

    queryFields, whereFields = pmt_utils.getQueryWhereFields(
        form, table_data, 'pai')

    if queryFields == None or queryFields == []:
        queryFields = []
        whereFields = None
        queryFields.append('id')
        queryFields.append('gist')
        queryFields.append('assigned_to')

    del_priv = pmt_utils.hasPriv(db, username, 'del_pai')
    dbResult, queryStatement = pmt_utils.executeQuery(
        db, table_data, 'pai', queryFields, whereFields, 'query',
        queryItemFunctionsHtml, 'ORDER by int4(id)', ['id', 'originator'],
        None, None, "return execute('query')", ["", "", del_priv])

    if dbResult['status'] != 'success':
        message = "Could not get pai data from db.\n" + dbResult['message']
        exit(message)

    msg = "Last Query Statement: %s\n" % queryStatement
    msg = msg + "%s action items retrieved from db" % ` len(
        dbResult['result']) `
    exit(msg, table_data, db, display_login=0)