Subversion Repositories computer_asset_manager_v1

Rev

Rev 47 | Rev 49 | 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
 
48 rodolico 20
delete from _system where key_name = 'license';
21
insert into _system ( group_name,key_name,theValue,added_date) values ( 'Modules', 'license', 'modules/license/', now() );
42 rodolico 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);
43 rodolico 34
insert into menu( url,caption,parent_id) select '/modules/license/bulk_load.html','Bulk Load',menu_id from menu where caption = 'Licenses';
47 rodolico 35
insert into menu( url,caption,parent_id) select '/modules/license/edit_license_product.html','Edit Products',menu_id from menu where caption = 'Licenses';
42 rodolico 36
 
46 rodolico 37
create or replace view view_device_systems as select * from device where device_type_id in (select device_type_id from device_type where show_as_system = 'Y');
42 rodolico 38
 
48 rodolico 39
insert into _system( group_name,key_name,theValue,added_date ) values ( 'device view', 'license', 'callable.php:view', now() );
40
 
41
 
42
 
42 rodolico 43
/* DO NOT RUN BELOW THIS LINE */
44
 
41 rodolico 45
select 
42 rodolico 46
   license_product.name 'Product',
41 rodolico 47
   license.license 'License',
42 rodolico 48
   ifnull(device.name,'--- Available ---') 'Installed On',
49
   client.name 'Client'
41 rodolico 50
from
51
   license join license_product using (license_product_id)
52
   left outer join device using (device_id)
42 rodolico 53
   join client using ( client_id )
41 rodolico 54
order by license_product.name, device.name;
55