Subversion Repositories computer_asset_manager_v1

Rev

Rev 41 | Rev 43 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42 rodolico 1
drop table if exists license;
41 rodolico 2
create table license (
3
   license_id int unsigned not null auto_increment,
4
   client_id  int unsigned null comment 'link to client table',
5
   device_id   int unsigned null comment 'link to device table',
6
   license text not null comment 'the actual license text',
7
   license_product_id int unsigned not null references license_product(license_product_id),
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',
10
   primary key (license_id)
11
) comment 'Holds the license and links to machine installed on' ;
12
 
42 rodolico 13
drop table if exists license_product;
41 rodolico 14
create table license_product (
15
   license_product_id int unsigned not null auto_increment,
16
   name text comment 'name of the license',
17
   primary key ( license_product_id )
18
) comment 'a list of all products we track license for';
19
 
42 rodolico 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
 
41 rodolico 40
select 
42 rodolico 41
   license_product.name 'Product',
41 rodolico 42
   license.license 'License',
42 rodolico 43
   ifnull(device.name,'--- Available ---') 'Installed On',
44
   client.name 'Client'
41 rodolico 45
from
46
   license join license_product using (license_product_id)
47
   left outer join device using (device_id)
42 rodolico 48
   join client using ( client_id )
41 rodolico 49
order by license_product.name, device.name;
50
 
42 rodolico 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 );