ec_store_install

Versions
6
ec_store_install()

Implementation of hook_install().

Code

contrib-6/ecommerce/ec_store/ec_store.install, line 40

<?php
function ec_store_install() {
  $versions = drupal_get_installed_schema_version('store', FALSE, TRUE);
  if (!isset($versions['store']) || $versions['store'] == SCHEMA_UNINSTALLED) {
    drupal_install_schema('ec_store');

    $workflow = array(
      array('workflow' => 1, 'description' => 'received', 'type' => 0, 'weight' => 1,),
      array('workflow' => 2, 'description' => 'invoiced', 'type' => 0, 'weight' => 2,),
      array('workflow' => 10, 'description' => 'in picking', 'type' => 0, 'weight' => 3,),
      array('workflow' => 8, 'description' => 'packaged', 'type' => 0, 'weight' => 4,),
      array('workflow' => 3, 'description' => 'shipped', 'type' => 0, 'weight' => 5,),
      array('workflow' => 4, 'description' => 'awaiting customer response', 'type' => 1, 'weight' => 6,),
      array('workflow' => 5, 'description' => 'canceled', 'type' => 2, 'weight' => 7,),
      array('workflow' => 6, 'description' => 'completed', 'type' => 1, 'weight' => 8,),
      array('workflow' => 7, 'description' => 'security violation', 'type' => 0, 'weight' => 9,),
    );

    foreach ($workflow as $item) {
      // Instead of using drupal_write_record() this items are inserted manually
      // because drupal_write_record() doesn't support setting the primary key.
      db_query("INSERT INTO {ec_workflow_statuses} (workflow, description, type, weight) VALUES (%d, '%s', %d, %d)", $item['workflow'], $item['description'], $item['type'], $item['weight']);
    }

    actions_save('ec_store_action_set_workflow', 'transaction', array('workflow' => '3'), 'Ship Orders');
  }

  drupal_set_message(st('e-Commerce: All core modules have been installed! You still need install at least one payment gateway in order to use the e-Commerce. Good sales!'));
}
?>

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options