/**
  * Installs the specified module in the system.
  *
  * The uninstall() method is called statically.
  * To call other methods of this class from this method,
  * the static call is used, for example,
  * Configuration::getTables() instead of $this->getTables().
  */
 function uninstall()
 {
     $query = new DB_Table_Delete(Notifications::getTables());
 }
 /**
  * Gets a list of receiver addesses together with their languages.
  *
  */
 function getMLSendTo()
 {
     global $application;
     $tables = Notifications::getTables();
     $nst = $tables['notification_send_to']['columns'];
     $query = new DB_Select();
     $query->addSelectField($nst['email'], 'Email');
     $query->addSelectField($nst['code'], 'Email_Code');
     $query->WhereValue($nst['n_id'], DB_EQ, $this->notificationId);
     $result = $application->db->getDB_Result($query);
     $to = array();
     foreach ($result as $ToEmail) {
         if ($ToEmail['Email_Code'] == 'EMAIL_CUSTOMER') {
             $customerEmail = null;
             switch ($this->actionId) {
                 case '1':
                 case '2':
                 case '3':
                 case '4':
                 case '5':
                     $pushedCurrency = true;
                     $currencyId = modApiFunc('Localization', 'whichCurrencyToDisplayOrderIn', $this->orderId);
                     $orderInfo = modApiFunc('Checkout', 'getOrderInfo', $this->orderId, $currencyId);
                     modApiFunc('Localization', 'pushDisplayCurrency', $currencyId, $currencyId);
                     $customer_id = $orderInfo['PersonId'];
                     $account_name = modApiFunc('Customer_Account', 'getCustomerAccountNameByCustomerID', $customer_id);
                     $customer_obj =& $application->getInstance('CCustomerInfo', $account_name);
                     /* download links should be sent to shipping email, other info to main email */
                     $destination = $this->actionId == 5 ? 'Shipping' : 'Customer';
                     $customerEmail = $customer_obj->getPersonInfo('Email', $destination);
                     if (!$customerEmail) {
                         $customerEmail = $customer_obj->getPersonInfo('Email', 'Customer');
                     }
                     $customerLng = $customer_obj->getPersonInfo('Notification_Lng');
                     break;
                 case '6':
                     if (array_key_exists('Email', $this->customerRegData['info'])) {
                         $customerEmail = $this->customerRegData['info']['Email'];
                         $customerLng = modApiFunc('MultiLang', 'getLanguage');
                     }
                     break;
                 case '7':
                 case '8':
                 case '9':
                 case '10':
                 case '11':
                 case '12':
                 case '13':
                 case '15':
                     $customer_obj =& $application->getInstance('CCustomerInfo', $this->customerAccount);
                     $customerEmail = $customer_obj->getPersonInfo('Email', 'Customer');
                     $customerLng = $customer_obj->getPersonInfo('Notification_Lng');
                     break;
             }
             if ($customerEmail) {
                 if (!modApiFunc('MultiLang', 'checkLanguage', $customerLng)) {
                     $customerLng = modApiFunc('MultiLang', 'getDefaultLanguage');
                 }
                 if (!modApiFunc('MultiLang', 'checkLanguage', $customerLng)) {
                     $customerLng = modApiFunc('MultiLang', '_getAnyLanguage');
                 }
                 $to[] = array($customerEmail, $customerLng);
             }
         } else {
             $email = modApiFunc("Notifications", "getExtendedEmail", $ToEmail['Email'], $ToEmail['Email_Code'], true, NULL, true);
             if ($email[0]) {
                 $to[] = $email;
             }
         }
     }
     return $to;
 }