Il manquait quelques fichiers dans Git
This commit is contained in:
10
local/modules/CreditNote/Config/Update/sql/2.1.1.sql
Normal file
10
local/modules/CreditNote/Config/Update/sql/2.1.1.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
# This is a fix for InnoDB in MySQL >= 4.1.x
|
||||
# It "suspends judgement" for fkey relationships until are tables are set.
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
ALTER TABLE `credit_note` ADD `discount_without_tax` DECIMAL(16,6) DEFAULT 0.000000 AFTER `total_price_with_tax`, ADD `discount_with_tax` DECIMAL(16,6) DEFAULT 0.000000 AFTER `discount_without_tax`;
|
||||
ALTER TABLE `credit_note_version` ADD `discount_without_tax` DECIMAL(16,6) DEFAULT 0.000000 AFTER `total_price_with_tax`, ADD `discount_with_tax` DECIMAL(16,6) DEFAULT 0.000000 AFTER `discount_without_tax`;
|
||||
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
16
local/modules/CreditNote/Config/Update/sql/2.1.3.sql
Normal file
16
local/modules/CreditNote/Config/Update/sql/2.1.3.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
# This is a fix for InnoDB in MySQL >= 4.1.x
|
||||
# It "suspends judgement" for fkey relationships until are tables are set.
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
SELECT @max_id := IFNULL(MAX(`id`),0) FROM `credit_note_type`;
|
||||
|
||||
INSERT INTO `credit_note_type` (`id`, `code`, `position`, `color`, `required_order`, `created_at`, `updated_at`) VALUES
|
||||
(@max_id+1, 'difference_refund', @max_id+1, '#CF7973', 0, NOW(), NOW());
|
||||
|
||||
INSERT INTO `credit_note_type_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
|
||||
(@max_id+1, 'en_US', 'Difference refund', '', '', ''),
|
||||
(@max_id+1, 'fr_FR', 'Remboursement de la différence', '', '', '');
|
||||
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
18
local/modules/CreditNote/Config/Update/sql/2.3.4.sql
Normal file
18
local/modules/CreditNote/Config/Update/sql/2.3.4.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
# This is a fix for InnoDB in MySQL >= 4.1.x
|
||||
# It "suspends judgement" for fkey relationships until are tables are set.
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
ALTER TABLE credit_note
|
||||
DROP COLUMN version;
|
||||
|
||||
ALTER TABLE credit_note
|
||||
DROP COLUMN version_created_at;
|
||||
|
||||
ALTER TABLE credit_note
|
||||
DROP COLUMN version_created_by;
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_version`;
|
||||
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
50
local/modules/CreditNote/Config/config.xml
Normal file
50
local/modules/CreditNote/Config/config.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config xmlns="http://thelia.net/schema/dic/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<loops>
|
||||
<loop name="credit-note" class="CreditNote\Loop\CreditNote" />
|
||||
<loop name="credit-note-type" class="CreditNote\Loop\CreditNoteType" />
|
||||
<loop name="credit-note-status" class="CreditNote\Loop\CreditNoteStatus" />
|
||||
<loop name="credit-note-comment" class="CreditNote\Loop\CreditNoteComment" />
|
||||
<loop name="credit-note-version" class="CreditNote\Loop\CreditNoteVersion" />
|
||||
<loop name="credit-note-address" class="CreditNote\Loop\CreditNoteAddress" />
|
||||
<loop name="credit-note-detail" class="CreditNote\Loop\CreditNoteDetail" />
|
||||
<loop name="order-credit-note" class="CreditNote\Loop\OrderCreditNote" />
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
<form name="credit-note.create" class="CreditNote\Form\CreditNoteCreateForm" />
|
||||
<form name="credit-note.empty" class="CreditNote\Form\CreditNoteEmptyForm" />
|
||||
</forms>
|
||||
|
||||
<services>
|
||||
<service id="creditnote.listener" class="CreditNote\EventListener\CreditNoteListener">
|
||||
<tag name="kernel.event_subscriber" />
|
||||
</service>
|
||||
<service id="creditnote.smarty.plugin.format" class="CreditNote\Smarty\Plugins\CreditNoteFormat">
|
||||
<argument type="service" id="request_stack"/>
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<hooks>
|
||||
<hook id="creditnote.hook.back.order_edit" class="CreditNote\Hook\Back\OrderEditHook">
|
||||
<tag name="hook.event_listener" event="order.tab" type="back" method="onOrderTab" />
|
||||
<tag name="hook.event_listener" event="order-edit.bottom" type="back" method="onOrderEditBottom" />
|
||||
<tag name="hook.event_listener" event="order.edit-js" type="back" method="onOrderEditJs" />
|
||||
<tag name="hook.event_listener" event="order-edit.product-list" type="back" method="onOrderEditProductList" />
|
||||
</hook>
|
||||
|
||||
<hook id="creditnote.hook.back.customer_edit" class="CreditNote\Hook\Back\CustomerEditHook">
|
||||
<tag name="hook.event_listener" event="customer.edit" type="back" method="onCustomerEdit" />
|
||||
<tag name="hook.event_listener" event="customer-edit.bottom" type="back" method="onCustomerEditBottom" />
|
||||
<tag name="hook.event_listener" event="customer.edit-js" type="back" method="onCustomerEditJs" />
|
||||
</hook>
|
||||
|
||||
<hook id="creditnote.hook.back.main" class="CreditNote\Hook\Back\MainHook">
|
||||
<tag name="hook.event_listener" event="main.footer-js" type="back" method="onMainFooterJs" />
|
||||
</hook>
|
||||
</hooks>
|
||||
|
||||
</config>
|
||||
47
local/modules/CreditNote/Config/insert.sql
Normal file
47
local/modules/CreditNote/Config/insert.sql
Normal file
@@ -0,0 +1,47 @@
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
INSERT INTO `credit_note_status` (`id`, `code`, `position`, `color`, `invoiced`, `used`, `created_at`, `updated_at`) VALUES
|
||||
(1, 'proposed', 1, '#999966', 0, 0, NOW(), NOW()),
|
||||
(2, 'refused', 2, '#e60000', 0, 0, NOW(), NOW()),
|
||||
(3, 'accepted', 3, '#00cc00', 1, 0, NOW(), NOW()),
|
||||
(4, 'used', 4, '#3399ff', 1, 1, NOW(), NOW());
|
||||
|
||||
INSERT INTO `credit_note_status_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
|
||||
(1, 'en_US', 'Proposed', '', '', ''),
|
||||
(1, 'fr_FR', 'Proposé', '', '', ''),
|
||||
(2, 'en_US', 'Refused', '', '', ''),
|
||||
(2, 'fr_FR', 'Refusé', '', '', ''),
|
||||
(3, 'en_US', 'Accepted', '', '', ''),
|
||||
(3, 'fr_FR', 'Accepté', '', '', ''),
|
||||
(4, 'en_US', 'Used', '', '', ''),
|
||||
(4, 'fr_FR', 'Utilisé', '', '', '');
|
||||
|
||||
INSERT INTO `credit_note_status_flow` (`id`, `from_status_id`, `to_status_id`, `priority`, `root`, `created_at`, `updated_at`) VALUES
|
||||
(1, 1, 2, 1, 1, NOW(), NOW()),
|
||||
(2, 1, 3, 1, 0, NOW(), NOW()),
|
||||
(3, 2, 1, 1, 1, NOW(), NOW()),
|
||||
(4, 3, 4, 1, 0, NOW(), NOW());
|
||||
|
||||
INSERT INTO `credit_note_type` (`id`, `code`, `position`, `color`, `required_order`, `created_at`, `updated_at`) VALUES
|
||||
(1, 'order_full_refund', 1, '#1abc9c', 1, NOW(), NOW()),
|
||||
(2, 'back_product', 2, '#40d47e', 1, NOW(), NOW()),
|
||||
(3, 'billing_error', 3, '#3498db', 1, NOW(), NOW()),
|
||||
(4, 'rebate', 4, '#9b59b6', 0, NOW(), NOW()),
|
||||
(5, 'discount', 5, '#34495e', 0, NOW(), NOW()),
|
||||
(6, 'difference_refund', 5, '#CF7973', 0, NOW(), NOW());
|
||||
|
||||
INSERT INTO `credit_note_type_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
|
||||
(1, 'en_US', 'Order Full refund', '', '', ''),
|
||||
(1, 'fr_FR', 'Remboursement complet', '', '', ''),
|
||||
(2, 'en_US', 'Back Product', '', '', ''),
|
||||
(2, 'fr_FR', 'Retour produit', '', '', ''),
|
||||
(3, 'en_US', 'Billing error', '', '', ''),
|
||||
(3, 'fr_FR', 'Erreur de facturation', '', '', ''),
|
||||
(4, 'en_US', 'A rebate', '', '', ''),
|
||||
(4, 'fr_FR', 'Un rabais', '', '', ''),
|
||||
(5, 'en_US', 'A discount', '', '', ''),
|
||||
(5, 'fr_FR', 'Une remise', '', '', ''),
|
||||
(6, 'en_US', 'Difference refund', '', '', ''),
|
||||
(6, 'fr_FR', 'Remboursement de la différence', '', '', '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
26
local/modules/CreditNote/Config/module.xml
Normal file
26
local/modules/CreditNote/Config/module.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
|
||||
<fullnamespace>CreditNote\CreditNote</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Credit notes</title>
|
||||
<subtitle>Allows granting credit notes to customers</subtitle>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Avoirs</title>
|
||||
<subtitle>Permet d'accorder des avoirs aux clients</subtitle>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>2.3.6</version>
|
||||
<author>
|
||||
<name>Gilles Bourgeat</name>
|
||||
<email>gbourgeat@openstudio.fr</email>
|
||||
</author>
|
||||
<type>classic</type>
|
||||
<thelia>2.3.0</thelia>
|
||||
<stability>beta</stability>
|
||||
</module>
|
||||
50
local/modules/CreditNote/Config/routing.xml
Normal file
50
local/modules/CreditNote/Config/routing.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<routes xmlns="http://symfony.com/schema/routing" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="admin.order.pdf.invoice" path="/admin/credit-note/pdf/invoice/{creditNoteId}/{browser}">
|
||||
<default key="_controller">CreditNote:CreditNote:generateInvoicePdf</default>
|
||||
<default key="browser">0</default>
|
||||
<requirement key="browser">[0|1|2]</requirement>
|
||||
<requirement key="creditNoteId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.list" path="/admin/credit-note">
|
||||
<default key="_controller">CreditNote:CreditNote:list</default>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.ajax.modal.create" path="/admin/credit-note/ajax/modal/create">
|
||||
<default key="_controller">CreditNote:CreditNote:ajaxModalCreate</default>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.create" path="/admin/credit-note/create">
|
||||
<default key="_controller">CreditNote:CreditNote:create</default>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.view" path="/admin/credit-note/{id}">
|
||||
<default key="_controller">CreditNote:CreditNote:view</default>
|
||||
<requirement key="id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.update" path="/admin/credit-note/{id}/_update" methods="post">
|
||||
<default key="_controller">CreditNote:CreditNote:update</default>
|
||||
<requirement key="id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.delete" path="/admin/credit-note/{id}/_delete" methods="post">
|
||||
<default key="_controller">CreditNote:CreditNote:delete</default>
|
||||
<requirement key="id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.ajax.search.customer" path="/admin/credit-note/ajax/search/customer" methods="get">
|
||||
<default key="_controller">CreditNote:CreditNote:searchCustomer</default>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.ajax.search.order" path="/admin/credit-note/ajax/search/order" methods="get">
|
||||
<default key="_controller">CreditNote:CreditNote:searchOrder</default>
|
||||
</route>
|
||||
|
||||
<route id="creditnote.ajax.load.order" path="/admin/credit-note/ajax/load/order/{id}" methods="get">
|
||||
<default key="_controller">CreditNote:CreditNote:loadOrder</default>
|
||||
</route>
|
||||
</routes>
|
||||
281
local/modules/CreditNote/Config/schema.xml
Normal file
281
local/modules/CreditNote/Config/schema.xml
Normal file
@@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<database defaultIdMethod="native" name="thelia"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../../core/vendor/propel/propel/resources/xsd/database.xsd" >
|
||||
|
||||
<table name="credit_note" namespace="CreditNote\Model">
|
||||
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
|
||||
|
||||
<column name="ref" type="VARCHAR" size="45" />
|
||||
|
||||
<column name="invoice_ref" type="VARCHAR" size="45" />
|
||||
<column name="invoice_address_id" type="INTEGER" required="true" />
|
||||
<column name="invoice_date" type="TIMESTAMP" />
|
||||
|
||||
<column name="order_id" type="INTEGER" required="false" />
|
||||
<column name="customer_id" type="INTEGER" required="true" />
|
||||
<column name="parent_id" type="INTEGER" required="false" />
|
||||
<column name="type_id" type="INTEGER" required="true" />
|
||||
<column name="status_id" type="INTEGER" required="true" />
|
||||
<column name="currency_id" type="INTEGER" required="true" />
|
||||
|
||||
<column name="currency_rate" type="FLOAT" />
|
||||
<column name="total_price" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
|
||||
<column name="total_price_with_tax" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
|
||||
|
||||
<column name="discount_without_tax" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
|
||||
<column name="discount_with_tax" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
|
||||
|
||||
<column name="allow_partial_use" type="BOOLEAN" defaultValue="1" />
|
||||
|
||||
<foreign-key foreignTable="order" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="order_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="customer" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="customer_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="credit_note" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="parent_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="credit_note_type" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="type_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="credit_note_status" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="status_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="currency" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="currency_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="credit_note_address" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="invoice_address_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<unique name="ref_UNIQUE">
|
||||
<unique-column name="ref" />
|
||||
</unique>
|
||||
|
||||
<unique name="invoice_ref_UNIQUE">
|
||||
<unique-column name="invoice_ref" />
|
||||
</unique>
|
||||
|
||||
<index name="idx_order_id_fk">
|
||||
<index-column name="order_id" />
|
||||
</index>
|
||||
|
||||
<index name="idx_customer_id_fk">
|
||||
<index-column name="customer_id" />
|
||||
</index>
|
||||
|
||||
<index name="idx_parent_id_fk">
|
||||
<index-column name="parent_id" />
|
||||
</index>
|
||||
|
||||
<index name="idx_type_id_fk">
|
||||
<index-column name="type_id" />
|
||||
</index>
|
||||
|
||||
<index name="idx_status_id_fk">
|
||||
<index-column name="status_id" />
|
||||
</index>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="credit_note_address" namespace="CreditNote\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="customer_title_id" type="INTEGER" />
|
||||
<column name="company" size="255" type="VARCHAR" />
|
||||
<column name="firstname" required="true" size="255" type="VARCHAR" />
|
||||
<column name="lastname" required="true" size="255" type="VARCHAR" />
|
||||
<column name="address1" required="true" size="255" type="VARCHAR" />
|
||||
<column name="address2" size="255" type="VARCHAR" />
|
||||
<column name="address3" size="255" type="VARCHAR" />
|
||||
<column name="zipcode" required="true" size="10" type="VARCHAR" />
|
||||
<column name="city" required="true" size="255" type="VARCHAR" />
|
||||
<column name="phone" size="20" type="VARCHAR" />
|
||||
<column name="cellphone" size="20" type="VARCHAR" />
|
||||
<column name="country_id" required="true" type="INTEGER" />
|
||||
<column name="state_id" type="INTEGER" />
|
||||
|
||||
<foreign-key foreignTable="customer_title" name="fk_credit_note_address_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="customer_title_id" />
|
||||
</foreign-key>
|
||||
<foreign-key foreignTable="country" name="fk_credit_note_address_country_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="country_id" />
|
||||
</foreign-key>
|
||||
<foreign-key foreignTable="state" name="fk_credit_note_address_state_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="state_id" />
|
||||
</foreign-key>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="order_credit_note" namespace="CreditNote\Model">
|
||||
<column name="order_id" type="INTEGER" required="true" primaryKey="true" />
|
||||
<column name="credit_note_id" type="INTEGER" required="true" primaryKey="true" />
|
||||
<column name="amount_price" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
|
||||
|
||||
<foreign-key foreignTable="order" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference local="order_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="credit_note" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference local="credit_note_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="cart_credit_note" namespace="CreditNote\Model">
|
||||
<column name="cart_id" type="INTEGER" required="true" primaryKey="true" />
|
||||
<column name="credit_note_id" type="INTEGER" required="true" primaryKey="true" />
|
||||
<column name="amount_price" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
|
||||
|
||||
<foreign-key foreignTable="cart" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference local="cart_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="credit_note" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference local="credit_note_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="credit_note_status" namespace="CreditNote\Model">
|
||||
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
|
||||
|
||||
<column name="code" type="VARCHAR" size="45" />
|
||||
<column name="color" type="CHAR" size="7" />
|
||||
|
||||
<column name="invoiced" type="BOOLEAN" required="true" defaultValue="0" />
|
||||
<column name="used" type="BOOLEAN" required="true" defaultValue="0" />
|
||||
|
||||
<column name="position" type="INTEGER" size="11" />
|
||||
<column name="title" type="VARCHAR" size="255" />
|
||||
<column name="description" type="CLOB" />
|
||||
<column name="chapo" type="LONGVARCHAR" />
|
||||
<column name="postscriptum" type="LONGVARCHAR" />
|
||||
|
||||
<behavior name="i18n">
|
||||
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
||||
</behavior>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="credit_note_status_flow" namespace="CreditNote\Model">
|
||||
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
|
||||
|
||||
<column name="from_status_id" type="INTEGER" required="true" />
|
||||
|
||||
<column name="to_status_id" type="INTEGER" required="true" />
|
||||
|
||||
<column name="priority" type="INTEGER" size="11" />
|
||||
|
||||
<column name="root" type="BOOLEAN" required="true" defaultValue="0" />
|
||||
|
||||
<foreign-key name="credit_note_status_flow_credit_note_status_from" foreignTable="credit_note_status" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference local="from_status_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key name="credit_note_status_flow_credit_note_status_to" foreignTable="credit_note_status" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference local="to_status_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="credit_note_type" namespace="CreditNote\Model">
|
||||
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
|
||||
|
||||
<column name="code" type="VARCHAR" size="45" />
|
||||
<column name="color" type="CHAR" size="7" />
|
||||
<column name="position" type="INTEGER" size="11" />
|
||||
<column name="required_order" type="BOOLEAN" required="true" defaultValue="0" />
|
||||
<column name="title" type="VARCHAR" size="255" />
|
||||
<column name="description" type="CLOB" />
|
||||
<column name="chapo" type="LONGVARCHAR" />
|
||||
<column name="postscriptum" type="LONGVARCHAR" />
|
||||
|
||||
<behavior name="i18n">
|
||||
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
||||
</behavior>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="credit_note_detail" namespace="CreditNote\Model">
|
||||
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
|
||||
|
||||
<column name="credit_note_id" type="INTEGER" required="true" />
|
||||
<column name="price" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
|
||||
<column name="price_with_tax" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
|
||||
<column name="tax_rule_id" type="INTEGER" required="false" />
|
||||
|
||||
<column name="order_product_id" type="INTEGER" required="false" />
|
||||
|
||||
<column name="type" type="VARCHAR" size="55" />
|
||||
|
||||
<column name="quantity" defaultValue="0" required="true" type="INTEGER" />
|
||||
|
||||
<column name="title" type="VARCHAR" size="255" />
|
||||
|
||||
<foreign-key foreignTable="credit_note" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference local="credit_note_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="order_product" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="order_product_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="tax_rule" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference local="tax_rule_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<index name="idx_credit_note_id_fk">
|
||||
<index-column name="credit_note_id" />
|
||||
</index>
|
||||
|
||||
<index name="idx_order_product_id_fk">
|
||||
<index-column name="order_product_id" />
|
||||
</index>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="credit_note_comment" namespace="CreditNote\Model">
|
||||
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
|
||||
|
||||
<column name="credit_note_id" type="INTEGER" required="true" />
|
||||
<column name="admin_id" type="INTEGER" required="false" />
|
||||
|
||||
<column name="comment" type="CLOB" />
|
||||
|
||||
<foreign-key foreignTable="credit_note" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference local="credit_note_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<foreign-key foreignTable="admin" onDelete="SET NULL" onUpdate="RESTRICT">
|
||||
<reference local="admin_id" foreign="id" />
|
||||
</foreign-key>
|
||||
|
||||
<index name="idx_credit_note_id_fk">
|
||||
<index-column name="credit_note_id" />
|
||||
</index>
|
||||
|
||||
<index name="idx_admin_id_fk">
|
||||
<index-column name="admin_id" />
|
||||
</index>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
|
||||
</database>
|
||||
2
local/modules/CreditNote/Config/sqldb.map
Normal file
2
local/modules/CreditNote/Config/sqldb.map
Normal file
@@ -0,0 +1,2 @@
|
||||
# Sqlfile -> Database map
|
||||
thelia.sql=thelia
|
||||
358
local/modules/CreditNote/Config/thelia.sql
Normal file
358
local/modules/CreditNote/Config/thelia.sql
Normal file
@@ -0,0 +1,358 @@
|
||||
|
||||
# This is a fix for InnoDB in MySQL >= 4.1.x
|
||||
# It "suspends judgement" for fkey relationships until are tables are set.
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note`;
|
||||
|
||||
CREATE TABLE `credit_note`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`ref` VARCHAR(45),
|
||||
`invoice_ref` VARCHAR(45),
|
||||
`invoice_address_id` INTEGER NOT NULL,
|
||||
`invoice_date` DATETIME,
|
||||
`order_id` INTEGER,
|
||||
`customer_id` INTEGER NOT NULL,
|
||||
`parent_id` INTEGER,
|
||||
`type_id` INTEGER NOT NULL,
|
||||
`status_id` INTEGER NOT NULL,
|
||||
`currency_id` INTEGER NOT NULL,
|
||||
`currency_rate` FLOAT,
|
||||
`total_price` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
`total_price_with_tax` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
`discount_without_tax` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
`discount_with_tax` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
`allow_partial_use` TINYINT(1) DEFAULT 1,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `ref_UNIQUE` (`ref`),
|
||||
UNIQUE INDEX `invoice_ref_UNIQUE` (`invoice_ref`),
|
||||
INDEX `idx_order_id_fk` (`order_id`),
|
||||
INDEX `idx_customer_id_fk` (`customer_id`),
|
||||
INDEX `idx_parent_id_fk` (`parent_id`),
|
||||
INDEX `idx_type_id_fk` (`type_id`),
|
||||
INDEX `idx_status_id_fk` (`status_id`),
|
||||
INDEX `credit_note_FI_6` (`currency_id`),
|
||||
INDEX `credit_note_FI_7` (`invoice_address_id`),
|
||||
CONSTRAINT `credit_note_FK_1`
|
||||
FOREIGN KEY (`order_id`)
|
||||
REFERENCES `order` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `credit_note_FK_2`
|
||||
FOREIGN KEY (`customer_id`)
|
||||
REFERENCES `customer` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `credit_note_FK_3`
|
||||
FOREIGN KEY (`parent_id`)
|
||||
REFERENCES `credit_note` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `credit_note_FK_4`
|
||||
FOREIGN KEY (`type_id`)
|
||||
REFERENCES `credit_note_type` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `credit_note_FK_5`
|
||||
FOREIGN KEY (`status_id`)
|
||||
REFERENCES `credit_note_status` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `credit_note_FK_6`
|
||||
FOREIGN KEY (`currency_id`)
|
||||
REFERENCES `currency` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `credit_note_FK_7`
|
||||
FOREIGN KEY (`invoice_address_id`)
|
||||
REFERENCES `credit_note_address` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note_address
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_address`;
|
||||
|
||||
CREATE TABLE `credit_note_address`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`customer_title_id` INTEGER,
|
||||
`company` VARCHAR(255),
|
||||
`firstname` VARCHAR(255) NOT NULL,
|
||||
`lastname` VARCHAR(255) NOT NULL,
|
||||
`address1` VARCHAR(255) NOT NULL,
|
||||
`address2` VARCHAR(255),
|
||||
`address3` VARCHAR(255),
|
||||
`zipcode` VARCHAR(10) NOT NULL,
|
||||
`city` VARCHAR(255) NOT NULL,
|
||||
`phone` VARCHAR(20),
|
||||
`cellphone` VARCHAR(20),
|
||||
`country_id` INTEGER NOT NULL,
|
||||
`state_id` INTEGER,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `FI_credit_note_address_customer_title_id` (`customer_title_id`),
|
||||
INDEX `FI_credit_note_address_country_id` (`country_id`),
|
||||
INDEX `FI_credit_note_address_state_id` (`state_id`),
|
||||
CONSTRAINT `fk_credit_note_address_customer_title_id`
|
||||
FOREIGN KEY (`customer_title_id`)
|
||||
REFERENCES `customer_title` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_credit_note_address_country_id`
|
||||
FOREIGN KEY (`country_id`)
|
||||
REFERENCES `country` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_credit_note_address_state_id`
|
||||
FOREIGN KEY (`state_id`)
|
||||
REFERENCES `state` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- order_credit_note
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `order_credit_note`;
|
||||
|
||||
CREATE TABLE `order_credit_note`
|
||||
(
|
||||
`order_id` INTEGER NOT NULL,
|
||||
`credit_note_id` INTEGER NOT NULL,
|
||||
`amount_price` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`order_id`,`credit_note_id`),
|
||||
INDEX `order_credit_note_FI_2` (`credit_note_id`),
|
||||
CONSTRAINT `order_credit_note_FK_1`
|
||||
FOREIGN KEY (`order_id`)
|
||||
REFERENCES `order` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `order_credit_note_FK_2`
|
||||
FOREIGN KEY (`credit_note_id`)
|
||||
REFERENCES `credit_note` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- cart_credit_note
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `cart_credit_note`;
|
||||
|
||||
CREATE TABLE `cart_credit_note`
|
||||
(
|
||||
`cart_id` INTEGER NOT NULL,
|
||||
`credit_note_id` INTEGER NOT NULL,
|
||||
`amount_price` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`cart_id`,`credit_note_id`),
|
||||
INDEX `cart_credit_note_FI_2` (`credit_note_id`),
|
||||
CONSTRAINT `cart_credit_note_FK_1`
|
||||
FOREIGN KEY (`cart_id`)
|
||||
REFERENCES `cart` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `cart_credit_note_FK_2`
|
||||
FOREIGN KEY (`credit_note_id`)
|
||||
REFERENCES `credit_note` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note_status
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_status`;
|
||||
|
||||
CREATE TABLE `credit_note_status`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`code` VARCHAR(45),
|
||||
`color` CHAR(7),
|
||||
`invoiced` TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
`used` TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
`position` INTEGER(11),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note_status_flow
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_status_flow`;
|
||||
|
||||
CREATE TABLE `credit_note_status_flow`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`from_status_id` INTEGER NOT NULL,
|
||||
`to_status_id` INTEGER NOT NULL,
|
||||
`priority` INTEGER(11),
|
||||
`root` TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `FI_dit_note_status_flow_credit_note_status_from` (`from_status_id`),
|
||||
INDEX `FI_dit_note_status_flow_credit_note_status_to` (`to_status_id`),
|
||||
CONSTRAINT `credit_note_status_flow_credit_note_status_from`
|
||||
FOREIGN KEY (`from_status_id`)
|
||||
REFERENCES `credit_note_status` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `credit_note_status_flow_credit_note_status_to`
|
||||
FOREIGN KEY (`to_status_id`)
|
||||
REFERENCES `credit_note_status` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note_type
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_type`;
|
||||
|
||||
CREATE TABLE `credit_note_type`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`code` VARCHAR(45),
|
||||
`color` CHAR(7),
|
||||
`position` INTEGER(11),
|
||||
`required_order` TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note_detail
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_detail`;
|
||||
|
||||
CREATE TABLE `credit_note_detail`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`credit_note_id` INTEGER NOT NULL,
|
||||
`price` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
`price_with_tax` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
`tax_rule_id` INTEGER,
|
||||
`order_product_id` INTEGER,
|
||||
`type` VARCHAR(55),
|
||||
`quantity` INTEGER DEFAULT 0 NOT NULL,
|
||||
`title` VARCHAR(255),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_credit_note_id_fk` (`credit_note_id`),
|
||||
INDEX `idx_order_product_id_fk` (`order_product_id`),
|
||||
INDEX `credit_note_detail_FI_3` (`tax_rule_id`),
|
||||
CONSTRAINT `credit_note_detail_FK_1`
|
||||
FOREIGN KEY (`credit_note_id`)
|
||||
REFERENCES `credit_note` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `credit_note_detail_FK_2`
|
||||
FOREIGN KEY (`order_product_id`)
|
||||
REFERENCES `order_product` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `credit_note_detail_FK_3`
|
||||
FOREIGN KEY (`tax_rule_id`)
|
||||
REFERENCES `tax_rule` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note_comment
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_comment`;
|
||||
|
||||
CREATE TABLE `credit_note_comment`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`credit_note_id` INTEGER NOT NULL,
|
||||
`admin_id` INTEGER,
|
||||
`comment` LONGTEXT,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_credit_note_id_fk` (`credit_note_id`),
|
||||
INDEX `idx_admin_id_fk` (`admin_id`),
|
||||
CONSTRAINT `credit_note_comment_FK_1`
|
||||
FOREIGN KEY (`credit_note_id`)
|
||||
REFERENCES `credit_note` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `credit_note_comment_FK_2`
|
||||
FOREIGN KEY (`admin_id`)
|
||||
REFERENCES `admin` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE SET NULL
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note_status_i18n
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_status_i18n`;
|
||||
|
||||
CREATE TABLE `credit_note_status_i18n`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
|
||||
`title` VARCHAR(255),
|
||||
`description` LONGTEXT,
|
||||
`chapo` TEXT,
|
||||
`postscriptum` TEXT,
|
||||
PRIMARY KEY (`id`,`locale`),
|
||||
CONSTRAINT `credit_note_status_i18n_FK_1`
|
||||
FOREIGN KEY (`id`)
|
||||
REFERENCES `credit_note_status` (`id`)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- credit_note_type_i18n
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `credit_note_type_i18n`;
|
||||
|
||||
CREATE TABLE `credit_note_type_i18n`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
|
||||
`title` VARCHAR(255),
|
||||
`description` LONGTEXT,
|
||||
`chapo` TEXT,
|
||||
`postscriptum` TEXT,
|
||||
PRIMARY KEY (`id`,`locale`),
|
||||
CONSTRAINT `credit_note_type_i18n_FK_1`
|
||||
FOREIGN KEY (`id`)
|
||||
REFERENCES `credit_note_type` (`id`)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
Reference in New Issue
Block a user