Rev 48 | Rev 50 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
/* this contains the license information itself */
drop table if exists license;
create table license (
license_id int unsigned not null auto_increment,
client_id int unsigned null comment 'link to client table',
device_id int unsigned null comment 'link to device table',
license text not null comment 'the actual license text',
license_product_id int unsigned not null references license_product(license_product_id),
added_date date default null comment 'date the license used on this machine',
removed_date date default null comment 'date license removed from this machine',
primary key (license_id)
) comment 'Holds the license and links to machine installed on' ;
/* child table that contains the "name" of the product, ie Microsoft - Office 2016, etc... */
drop table if exists license_product;
create table license_product (
license_product_id int unsigned not null auto_increment,
name text comment 'name of the license',
primary key ( license_product_id )
) comment 'a list of all products we track license for';
/* set up the _system table to plug in the module */
delete from _system where key_name = 'license';
/* this is required, and officially installs the module */
insert into _system ( group_name,key_name,theValue,added_date) values ( 'Modules', 'license', 'modules/license/', now() );
/* we will provide data to the main screen via a callback routine. In this case, function view is located in callable.php */
insert into _system( group_name,key_name,theValue,added_date ) values ( 'device view', 'license', 'callable.php:view', now() );
/* This has a menu entry, so add it */
/* first, make sure we don't have any danglies */
delete from menu
where
menu.parent_id in
( select menu_id
from (
select distinct a.menu_id as menu_id
from menu a join menu b on a.menu_id = b.menu_id
where a.caption = 'Licenses'
)
as c );
delete from menu where caption = 'Licenses';
/* create three menu options. First one is the main menu option (ie, no parent_id) */
insert into menu( url, caption, parent_id) values ('/modules/license/', 'Licenses', null);
/* two additional menu options for bulk_load and editing the license_product table */
insert into menu( url,caption,parent_id) select '/modules/license/bulk_load.html','Bulk Load',menu_id from menu where caption = 'Licenses';
insert into menu( url,caption,parent_id) select '/modules/license/edit_license_product.html','Edit Products',menu_id from menu where caption = 'Licenses';