<?php

/**
 * @file
 * Installation functions for commerce_billy_mail
 */

/**
 * Implements hook_install().
 */
function commerce_billy_mail_install() {
  // Set general settings.
  variable_set('commerce_billy_mail_attach_pdf_invoice', module_exists('commerce_billy_pdf invoice'));
  variable_set('commerce_billy_mail_from', NULL);
  variable_set('commerce_billy_mail_cc', '');
  variable_set('commerce_billy_mail_bcc', '');
  variable_set('commerce_billy_mail_subject', t('Your invoice.'));
  variable_set('commerce_billy_mail_body', t('Find your invoice attached.'));
  variable_set('commerce_billy_mail_plaintext', 'FALSE');
}

/**
 * Implements hook_uninstall().
 */
function commerce_billy_mail_uninstall() {
  // Remove the general settings.
  $result = db_query(
      "SELECT name FROM {variable} WHERE name LIKE 'commerce_billy_mail_%'");

  // Exclude variables here!!
  $exclude = array();
  while ($var_name = $result->fetchAssoc()) {
    if (!in_array($var_name['name'], $exclude)) {
      variable_del($var_name['name']);
    }
  }
}