49 |
rodolico |
1 |
/* this contains the license information itself */
|
42 |
rodolico |
2 |
drop table if exists license;
|
41 |
rodolico |
3 |
create table license (
|
|
|
4 |
license_id int unsigned not null auto_increment,
|
|
|
5 |
client_id int unsigned null comment 'link to client table',
|
|
|
6 |
device_id int unsigned null comment 'link to device table',
|
|
|
7 |
license text not null comment 'the actual license text',
|
|
|
8 |
license_product_id int unsigned not null references license_product(license_product_id),
|
|
|
9 |
added_date date default null comment 'date the license used on this machine',
|
|
|
10 |
removed_date date default null comment 'date license removed from this machine',
|
|
|
11 |
primary key (license_id)
|
|
|
12 |
) comment 'Holds the license and links to machine installed on' ;
|
49 |
rodolico |
13 |
|
|
|
14 |
/* child table that contains the "name" of the product, ie Microsoft - Office 2016, etc... */
|
42 |
rodolico |
15 |
drop table if exists license_product;
|
41 |
rodolico |
16 |
create table license_product (
|
|
|
17 |
license_product_id int unsigned not null auto_increment,
|
|
|
18 |
name text comment 'name of the license',
|
|
|
19 |
primary key ( license_product_id )
|
|
|
20 |
) comment 'a list of all products we track license for';
|
|
|
21 |
|
49 |
rodolico |
22 |
/* set up the _system table to plug in the module */
|
50 |
rodolico |
23 |
delete from _system where key_name = 'License';
|
49 |
rodolico |
24 |
/* this is required, and officially installs the module */
|
50 |
rodolico |
25 |
insert into _system ( group_name,key_name,theValue,added_date) values ( 'Modules', 'License', 'modules/license/', now() );
|
49 |
rodolico |
26 |
/* we will provide data to the main screen via a callback routine. In this case, function view is located in callable.php */
|
50 |
rodolico |
27 |
insert into _system( group_name,key_name,theValue,added_date ) values ( 'device view', 'License', 'callable.php:licenseView', now() );
|
49 |
rodolico |
28 |
|
|
|
29 |
/* This has a menu entry, so add it */
|
|
|
30 |
/* first, make sure we don't have any danglies */
|
42 |
rodolico |
31 |
delete from menu
|
|
|
32 |
where
|
|
|
33 |
menu.parent_id in
|
|
|
34 |
( select menu_id
|
|
|
35 |
from (
|
|
|
36 |
select distinct a.menu_id as menu_id
|
|
|
37 |
from menu a join menu b on a.menu_id = b.menu_id
|
|
|
38 |
where a.caption = 'Licenses'
|
|
|
39 |
)
|
|
|
40 |
as c );
|
|
|
41 |
delete from menu where caption = 'Licenses';
|
49 |
rodolico |
42 |
/* create three menu options. First one is the main menu option (ie, no parent_id) */
|
42 |
rodolico |
43 |
insert into menu( url, caption, parent_id) values ('/modules/license/', 'Licenses', null);
|
49 |
rodolico |
44 |
/* two additional menu options for bulk_load and editing the license_product table */
|
43 |
rodolico |
45 |
insert into menu( url,caption,parent_id) select '/modules/license/bulk_load.html','Bulk Load',menu_id from menu where caption = 'Licenses';
|
47 |
rodolico |
46 |
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 |
47 |
|