Save in database.
[order_line_extra.git] / hooks.php
1 <?php
2 // ----------------------------------------------------------------
3 // $ Revision:  1.0 $
4 // Creator: Maxime Bourge
5 // date_:   2013-05-04
6 // Title:   Order Line Extra
7 // Free software under GNU GPL
8 // ----------------------------------------------------------------
9 define ('SS_ORDERLINEX', 100<<8);
10
11 class hooks_order_line_extra extends hooks {
12         var $module_name = 'order_line_extra';
13
14         /*
15                 Install additonal menu options provided by module
16         */
17     function install_tabs($app) {
18         global $path_to_root;
19
20     }
21
22     function install_options($app) {
23         global $path_to_root;
24                                 switch($app->id) {
25                                         case 'orders':
26                                                 $app->add_rapp_function(0, _('Order Extra'), 
27                                                         $path_to_root.'/modules/order_line_extra/order_lines_view.php', 'SA_SALESTRANSVIEW');
28                                 }
29     }
30
31     function install_access()
32         {
33         $security_sections[SS_ORDERLINEX] =  _("Order Line Extra");
34                 $security_areas['SA_ORDERLINEX_EDIT'] = array(SS_ORDERLINEX|1, _("Edit lines"));
35
36                 return array($security_areas, $security_sections);
37         }
38
39     /* This method is called on extension activation for company.   */
40     function activate_extension($company, $check_only=true)
41     {
42         global $db_connections;
43
44         $updates = array(
45             'alter_sales_order_details.sql' => array('sales_order_details', 'required_date')
46         );
47
48         return $this->update_databases($company, $updates, $check_only);
49     }
50
51     function deactivate_extension($company, $check_only=true)
52     {
53         global $db_connections;
54
55         $updates = array(
56             'clean_sales_order_details.sql' => array('ugly_hack') // FIXME: just an ugly hack to clean database on deactivation
57         );
58
59         return $this->update_databases($company, $updates, $check_only);
60     }
61 }
62 ?>