<?php

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup = $this;
$fieldList = array('is_reservation');
foreach ($fieldList as $field) {
    $installer->updateAttribute('catalog_product', $field, 'required', '1');
    $installer->updateAttribute('catalog_product', $field, 'default_value', null);
    $installer->updateAttribute('catalog_product', $field, 'class', 'required-entry select');
}
$configValuesMap = array('payperrentals/notificationemails/send_queue_email' => 'payperrentals_notification_send_queue');
foreach ($configValuesMap as $configPath => $configValue) {
    $installer->setConfigData($configPath, $configValue);
}
$installer->run("\n\tDROP TABLE IF EXISTS {$this->getTable('payperrentals/mailinglog')};\n\n\tCREATE TABLE {$this->getTable('payperrentals/mailinglog')} (\n\t\t`id` INT( 11 ) NOT NULL auto_increment,\n\t\t`is_cron` int(11) NOT NULL DEFAULT '0',\n\t\t`from_name` varchar(250) NOT NULL,\n\t\t`from_email` varchar(250) NOT NULL,\n\t\t`to_name` varchar(250) NOT NULL,\n\t\t`to_email` varchar(250) NOT NULL,\n\t\t`subject` TEXT,\n\t\t`message` TEXT,\n\t\t`message_error` TEXT,\n\t\t`created_at` DATETIME NOT NULL ,\n\t\tPRIMARY KEY ( `id` )\n\n\t) DEFAULT CHARSET utf8 ENGINE = InnoDB;\n\n\t");
$installer->endSetup();
$installer2 = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$installer2->startSetup();
$installer2->addAttribute('order', 'start_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true));
$installer2->addAttribute('order', 'end_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true));
$installer2->addAttribute('order', 'send_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true));
$installer2->addAttribute('order', 'return_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true));
$installer2->addAttribute('order', 'estimate_send', array('type' => 'datetime', 'grid' => true, 'unsigned' => true));
$installer2->addAttribute('order', 'estimate_return', array('type' => 'datetime', 'grid' => true, 'unsigned' => true));
$installer2->addAttribute('quote', 'start_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true));
$installer2->addAttribute('quote', 'end_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true));
$installer2->getConnection()->addColumn($installer2->getTable('sales/quote'), 'start_datetime', 'DATETIME');
$installer2->getConnection()->addColumn($installer2->getTable('sales/order'), 'end_datetime', 'DATETIME');
$installer2->getConnection()->addColumn($installer2->getTable('sales/quote'), 'end_datetime', 'DATETIME');
$installer2->getConnection()->addColumn($installer2->getTable('sales/order'), 'start_datetime', 'DATETIME');