- Timestamp:
- 07/31/24 16:09:57 (4 months ago)
- Location:
- trunk/cgi-bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
-
Property svn:keywords
changed from
Date Rev Author
toDate Rev Author Id
r945 r947 1 1 # ipdb/cgi-bin/IPDB.pm 2 2 # Contains functions for IPDB - database access, subnet mangling, block allocation, etc 3 ### 4 # SVN revision info 5 # $Date$ 6 # SVN revision $Rev$ 7 # Last update by $Author$ 8 ### 9 # Copyright (C) 2004-2016 - Kris Deugau 3 ## 4 # $Id$ 5 # Copyright (C) 2004-2018,2022-2024 - Kris Deugau <kdeugau@deepnet.cx> 6 # 7 # This program is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 3 of the License, or 10 # (at your option) any later version. 11 # 12 # This program is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 ## 10 20 11 21 package IPDB; … … 353 363 INSERT INTO allocations ( 354 364 cidr,type,city, description, notes, circuitid, createstamp, modifystamp, 355 privdata, custid, vrf, vlan, rdns, parent_id, master_id 365 privdata, custid, vrf, vlan, rdns, parent_id, master_id, userid 356 366 ) 357 367 SELECT 358 368 ip, ? AS type, city, description, notes, circuitid, createstamp, modifystamp, 359 privdata, custid, vrf, vlan, rdns, ? AS parent_id, master_id 369 privdata, custid, vrf, vlan, rdns, ? AS parent_id, master_id, userid 360 370 FROM poolips 361 371 WHERE parent_id = ? AND available = 'n' … … 1596 1606 $args{vlan} = '' if !$args{vlan}; 1597 1607 $args{rdns} = '' if !$args{rdns}; 1608 # customer accounts may have multiple allocations; tag the specific billing user for the allocation 1609 $args{billinguserid} = 0 if !$args{billinguserid}; 1598 1610 1599 1611 # munge the reverse name to include the default domain if there are no dots. Don't append if … … 1687 1699 # finally assign the IP 1688 1700 $dbh->do("UPDATE poolips SET custid = ?, city = ?, available='n', description = ?, notes = ?, vlan = ?, ". 1689 "circuitid = ?, privdata = ?, rdns = ?, backup_id = ? ".1701 "circuitid = ?, privdata = ?, rdns = ?, backup_id = ?, userid = ? ". 1690 1702 "WHERE ip = ? AND parent_id = ?", undef, 1691 1703 ($args{custid}, $args{city}, $args{desc}, $args{notes}, $args{vlan}, 1692 $args{circid}, $args{privdata}, $args{rdns}, $backupid, 1704 $args{circid}, $args{privdata}, $args{rdns}, $backupid, $args{billinguserid}, 1693 1705 $args{cidr}, $args{parent}) ); 1694 1706 … … 1748 1760 # Insert the allocations entry 1749 1761 $dbh->do("INSERT INTO allocations ". 1750 "(cidr,parent_id,master_id,vrf,vlan,custid,type,city,description,notes,circuitid,privdata,rdns,backup_id )".1751 " VALUES (?,?,?,(SELECT vrf FROM allocations WHERE id=?),?,?,?,?,?,?,?,?,?,? )", undef,1762 "(cidr,parent_id,master_id,vrf,vlan,custid,type,city,description,notes,circuitid,privdata,rdns,backup_id,userid)". 1763 " VALUES (?,?,?,(SELECT vrf FROM allocations WHERE id=?),?,?,?,?,?,?,?,?,?,?,?)", undef, 1752 1764 ($args{cidr}, $fbparent, $fbmaster, $fbmaster, $args{vlan}, $args{custid}, $args{type}, $args{city}, 1753 $args{desc}, $args{notes}, $args{circid}, $args{privdata}, $args{rdns}, $backupid ) );1765 $args{desc}, $args{notes}, $args{circid}, $args{privdata}, $args{rdns}, $backupid, $args{billinguserid}) ); 1754 1766 my ($bid) = $dbh->selectrow_array("SELECT currval('allocations_id_seq')"); 1755 1767 … … 1824 1836 # Insert the allocations entry 1825 1837 $dbh->do("INSERT INTO allocations ". 1826 "(cidr,parent_id,master_id,vrf,vlan,custid,type,city,description,notes,circuitid,privdata,rdns )".1827 " VALUES (?,?,?,(SELECT vrf FROM allocations WHERE id=?),?,?,?,?,?,?,?,?,? )", undef,1838 "(cidr,parent_id,master_id,vrf,vlan,custid,type,city,description,notes,circuitid,privdata,rdns,userid)". 1839 " VALUES (?,?,?,(SELECT vrf FROM allocations WHERE id=?),?,?,?,?,?,?,?,?,?,?)", undef, 1828 1840 ($args{cidr}, $fbparent, $fbmaster, $fbmaster, $args{vlan}, $args{custid}, $args{type}, $args{city}, 1829 $args{desc}, $args{notes}, $args{circid}, $args{privdata}, $args{rdns} ) );1841 $args{desc}, $args{notes}, $args{circid}, $args{privdata}, $args{rdns}, $args{billinguserid}) ); 1830 1842 my ($bid) = $dbh->selectrow_array("SELECT currval('allocations_id_seq')"); 1831 1843 … … 2276 2288 # direct in SQL, something like 2277 2289 # "INSERT INTO foo (f1,f2,f3) VALUES (newf1,(SELECT oldf2,oldf3 FROM foo WHERE baz))" 2278 my @fieldlist = qw(type city description notes circuitid privdata custid swip vrf vlan rdns parent_id master_id );2290 my @fieldlist = qw(type city description notes circuitid privdata custid swip vrf vlan rdns parent_id master_id userid); 2279 2291 my $fields_sql = join(',', @fieldlist); 2280 2292 my @vals; … … 3372 3384 # Note city, vrf, parent_id and master_id removed due to JOIN uncertainty for block allocations 3373 3385 my $commonfields = q(a.custid, a.type, a.circuitid, a.description, a.notes, a.modifystamp AS lastmod, 3374 a.privdata, a.vlan, a.rdns );3386 a.privdata, a.vlan, a.rdns, a.userid); 3375 3387 my $bkfields = q(b.backup_id AS hasbk, b.bkbrand, b.bkmodel, b.bktype, b.bkport, b.bksrc, 3376 3388 b.bkuser, b.bkvpass, b.bkepass, b.bkip); -
Property svn:keywords
changed from
-
trunk/cgi-bin/main.cgi
-
Property svn:keywords
changed from
Date Rev Author
toDate Rev Author Id
r944 r947 3 3 ## 4 4 # $Id$ 5 # Copyright (C) 2004-2018,2022 - Kris Deugau <kdeugau@deepnet.cx>5 # Copyright (C) 2004-2018,2022-2024 - Kris Deugau <kdeugau@deepnet.cx> 6 6 # 7 7 # This program is free software: you can redistribute it and/or modify … … 907 907 vlan => $webvar{vlan}, 908 908 user => $authuser, 909 billinguserid => $webvar{billinguser}, 909 910 ); 910 911 -
Property svn:keywords
changed from
Note:
See TracChangeset
for help on using the changeset viewer.