Subversion Repositories computer_asset_manager_v1

Rev

Rev 41 | Rev 43 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 41 Rev 42
Line 1... Line 1...
1
drop table license;
1
drop table if exists license;
2
create table license (
2
create table license (
3
   license_id int unsigned not null auto_increment,
3
   license_id int unsigned not null auto_increment,
4
   client_id  int unsigned null comment 'link to client table',
4
   client_id  int unsigned null comment 'link to client table',
5
   device_id   int unsigned null comment 'link to device table',
5
   device_id   int unsigned null comment 'link to device table',
6
   license text not null comment 'the actual license text',
6
   license text not null comment 'the actual license text',
Line 8... Line 8...
8
   added_date date default null comment 'date the license used on this machine',
8
   added_date date default null comment 'date the license used on this machine',
9
   removed_date date default null comment 'date license removed from this machine',
9
   removed_date date default null comment 'date license removed from this machine',
10
   primary key (license_id)
10
   primary key (license_id)
11
) comment 'Holds the license and links to machine installed on' ;
11
) comment 'Holds the license and links to machine installed on' ;
12
   
12
   
13
drop table license_product;
13
drop table if exists license_product;
14
create table license_product (
14
create table license_product (
15
   license_product_id int unsigned not null auto_increment,
15
   license_product_id int unsigned not null auto_increment,
16
   name text comment 'name of the license',
16
   name text comment 'name of the license',
17
   primary key ( license_product_id )
17
   primary key ( license_product_id )
18
) comment 'a list of all products we track license for';
18
) comment 'a list of all products we track license for';
19
 
19
 
-
 
20
delete from _system where key_name = 'Licenses';
-
 
21
insert into _system ( group_name,key_name,theValue,added_date) values ( 'Modules', 'Licenses', 'modules/license/', now() );
-
 
22
delete from menu 
-
 
23
where 
-
 
24
   menu.parent_id in 
-
 
25
      ( select menu_id 
-
 
26
        from ( 
-
 
27
           select distinct a.menu_id as menu_id 
-
 
28
           from menu a join menu b on a.menu_id = b.menu_id 
-
 
29
           where a.caption = 'Licenses' 
-
 
30
           ) 
-
 
31
      as c );
-
 
32
delete from menu where caption = 'Licenses';
-
 
33
insert into menu( url, caption, parent_id) values ('/modules/license/', 'Licenses', null);
-
 
34
insert into menu( url,caption,parent_id) select '/modules/license/license_bulk_load.php','Bulk Load',menu_id from menu where caption = 'Licenses';
-
 
35
insert into menu( url,caption,parent_id) select '/modules/license/add_edit.php','Edit',menu_id from menu where caption = 'Licenses';
-
 
36
 
-
 
37
 
-
 
38
/* DO NOT RUN BELOW THIS LINE */
-
 
39
 
20
select 
40
select 
21
   license.license 'License',
-
 
22
   license_product.name 'Product',
41
   license_product.name 'Product',
-
 
42
   license.license 'License',
23
   ifnull(device.name,'--- Available ---') 'Installed On'
43
   ifnull(device.name,'--- Available ---') 'Installed On',
-
 
44
   client.name 'Client'
24
from
45
from
25
   license join license_product using (license_product_id)
46
   license join license_product using (license_product_id)
26
   left outer join device using (device_id)
47
   left outer join device using (device_id)
-
 
48
   join client using ( client_id )
27
order by license_product.name, device.name;
49
order by license_product.name, device.name;
28
   
50
   
-
 
51
delete from menu 
-
 
52
where 
-
 
53
   menu.parent_id in 
-
 
54
      ( select menu_id 
-
 
55
        from ( 
-
 
56
           select distinct a.menu_id as menu_id 
-
 
57
           from menu a join menu b on a.menu_id = b.menu_id 
-
 
58
           where a.caption = 'Licenses' 
-
 
59
           ) 
-
 
60
      as c );