<?php
define ('SS_DILIGENT', 254<<8);
class hooks_diligent extends hooks {

    function __construct() {
        $this->module_name = 'diligent';
    }

    /*
     * Install additonal menu options provided by module
     */

    function install_options($app) {
        global $path_to_root;

        switch ($app->id) {
            case 'orders':
                $app->add_rapp_function(1, _("&Consolidated Delivery Notes Report"), $path_to_root . "/modules/".$this->module_name."/inquiry/consolidated_sales_orders_report.php?New=1", 'SA_CUSTOMER', MENU_INQUIRY);
                $app->add_rapp_function(1, _("&Goods Return Form"), $path_to_root . "/modules/".$this->module_name."/manage/print_goods_return_form.php?", 'SA_CUSTOMER', MENU_INQUIRY);
                break;
        }
    }
    
    function activate_extension($company, $check_only=true) {
        global $db_connections;
        
        $updates = array( 'update.sql' => array('diligent'));
 
        return $this->update_databases($company, $updates, $check_only);
    }
    
    function deactivate_extension($company, $check_only=true) {
        global $db_connections;

        $updates = array('remove.sql' => array('diligent'));

        return $this->update_databases($company, $updates, $check_only);
    }
    function install_access() {
        $security_sections[SS_DILIGENT] =  _('diligent');
        $security_areas['SA_GOODS_RETURN_FORM'] = array(SS_DILIGENT|1, _('Print Goods Return Form'));
        return array($security_areas, $security_sections);
    }

}
