WHERE s.snet_id = :id;
mid = 0;
+ /* Non query owner must provide valid billing information. */
if (q->version >= 8)
{
if (subnet_status == SNET_STATUS_BILLABLE)
id = *(int *)argv[0];
EXEC SQL SELECT m.name, m.use, m.contact, m.billing_contact, m.status,
m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, m.snet_id,
- s.owner_type, s.owner_id INTO :name, :use, :contact, :billing_contact,
- :status, :address, :mtype, :mid, :acomment, :ocomment, :snid, :stype,
- :sid
+ s.owner_type, s.owner_id, s.status INTO :name, :use, :contact,
+ :billing_contact, :status, :address, :mtype, :mid, :acomment,
+ :ocomment, :snid, :stype, :sid, :subnet_status
FROM machine m, subnet s
WHERE m.mach_id = :id AND s.snet_id = m.snet_id;
if (dbms_errno)
return mr_errcode;
+ /* Non query owner must provide valid billing information. */
+ if (q->version >= 8)
+ {
+ if (subnet_status == SNET_STATUS_BILLABLE)
+ {
+ account_number = argv[8];
+ EXEC SQL SELECT account_number FROM accountnumbers
+ WHERE account_number = :account_number;
+ if (sqlca.sqlcode == SQL_NO_MATCH)
+ return MR_ACCOUNT_NUMBER;
+ }
+ }
+
/* non-query-owner cannot change use or ocomment */
if ((use != atoi(argv[7 + idx])) || (ocomment != *(int *)argv[14 + idx]))
return MR_PERM;
static char *gsnt_fields[] = {
"name",
- "name", "description", "status", "address", "mask", "low", "high", "prefix",
- "ace_type", "ace_name", "modtime", "modby", "modwith"
+ "name", "description", "status", "contact", "account_number", "address",
+ "mask", "low", "high", "prefix", "ace_type", "ace_name", "modtime",
+ "modby", "modwith"
};
static struct validate gsnt_validate = {
};
static char *asnt_fields[] = {
- "name", "description", "status", "address", "mask", "low", "high", "prefix",
- "ace_type", "ace_name",
+ "name", "description", "status", "contact", "account_number", "address",
+ "mask", "low", "high", "prefix", "ace_type", "ace_name",
};
static struct valobj asnt_valobj[] = {
{V_CHAR, 0, SUBNET_TABLE, "name"},
{V_LEN, 1, SUBNET_TABLE, "description"},
{V_NUM, 2},
- {V_NUM, 3},
- {V_NUM, 4},
+ {V_CHAR, 3, SUBNET_TABLE, "contact"},
+ {V_CHAR, 4, SUBNET_TABLE, "account_number"},
{V_NUM, 5},
{V_NUM, 6},
- {V_LEN, 7, SUBNET_TABLE, "prefix"},
- {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
- {V_TYPEDATA, 9, 0, 0, 0, MR_ACE},
+ {V_NUM, 7},
+ {V_NUM, 8},
+ {V_LEN, 9, SUBNET_TABLE, "prefix"},
+ {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
+ {V_TYPEDATA, 11, 0, 0, 0, MR_ACE},
};
static struct validate asnt_validate =
{
asnt_valobj,
- 10,
+ 12,
"name",
"name = UPPER('%s')",
1,
static char *usnt_fields[] = {
"name",
- "newname", "description", "status", "address", "mask", "low", "high",
- "prefix", "ace_type", "ace_name",
+ "newname", "description", "status", "contact", "account_number", "address",
+ "mask", "low", "high", "prefix", "ace_type", "ace_name",
};
static struct valobj usnt_valobj[] = {
{V_RENAME, 1, SUBNET_TABLE, "name", "snet_id", MR_NOT_UNIQUE},
{V_LEN, 2, SUBNET_TABLE, "description"},
{V_NUM, 3},
- {V_NUM, 4},
- {V_NUM, 5},
+ {V_CHAR, 4, SUBNET_TABLE, "contact"},
+ {V_CHAR, 5, SUBNET_TABLE, "account_number"},
{V_NUM, 6},
{V_NUM, 7},
- {V_LEN, 8, SUBNET_TABLE, "prefix"},
- {V_TYPE, 9, 0, "ace_type", 0, MR_ACE},
- {V_TYPEDATA, 10, 0, 0, 0, MR_ACE},
+ {V_NUM, 8},
+ {V_NUM, 9},
+ {V_LEN, 10, SUBNET_TABLE, "prefix"},
+ {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
+ {V_TYPEDATA, 12, 0, 0, 0, MR_ACE},
};
static struct validate usnt_validate =
{
usnt_valobj,
- 11,
+ 13,
"name",
"snet_id = %d",
1,
RETRIEVE,
"s",
SUBNET_TABLE,
- "name, description, status, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
+ "name, description, status, contact, account_number, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
gsnt_fields,
- 13,
+ 15,
"name LIKE UPPER('%s')",
1,
"name",
APPEND,
"s",
SUBNET_TABLE,
- "INTO subnet (name, description, status, saddr, mask, low, high, prefix, owner_type, owner_id, snet_id) VALUES (UPPER('%s'), NVL('%s', CHR(0)), %s, %d, %s, %s, %s, NVL('%s', CHR(0)), '%s', %d, %s)",
+ "INTO subnet (name, description, status, contact, account_number, saddr, mask, low, high, prefix, owner_type, owner_id, snet_id) VALUES (UPPER('%s'), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), %s, %s, %s, %s, %s, NVL('%s', CHR(0)), '%s', %d, %s)",
asnt_fields,
- 10,
+ 12,
0,
0,
NULL,
UPDATE,
"s",
SUBNET_TABLE,
- "subnet SET name = UPPER('%s'), description = NVL('%s', CHR(0)), status = %s, saddr = %s, mask = %s, low = %s, high = %s, prefix = NVL('%s', CHR(0)), owner_type = '%s', owner_id = %d",
+ "subnet SET name = UPPER('%s'), description = NVL('%s', CHR(0)), status = %s, contact = NVL('%s', CHR(0)), account_number = NVL('%s', CHR(0)), saddr = %s, mask = %s, low = %s, high = %s, prefix = NVL('%s', CHR(0)), owner_type = '%s', owner_id = %d",
usnt_fields,
- 10,
+ 12,
"snet_id = %d",
1,
NULL,