Skip to content

Commit

Permalink
Schema Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pHAlkaline committed Mar 2, 2024
1 parent 0a6227b commit 32eb695
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 49 deletions.
30 changes: 12 additions & 18 deletions app/Config/Schema/update_1.10_to_1.11.sql
@@ -1,45 +1,39 @@
-- phkondo.payment_advices definition

-- phkondo_agenciafatima.payment_advices definition

CREATE TABLE `payment_advices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`document` varchar(25) DEFAULT NULL,
`document_date` date NOT NULL,
`receipt_status_id` int(11) NOT NULL,
`payment_user_id` int(11) DEFAULT NULL,
`receipt_payment_type_id` int(11) DEFAULT NULL,
`payment_date` date DEFAULT NULL,
`total_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
`due_date` date DEFAULT NULL,
`condo_id` int(11) NOT NULL,
`fraction_id` int(11) DEFAULT NULL,
`entity_id` int(11) NOT NULL,
`address` text DEFAULT NULL,
`observations` text DEFAULT NULL,
`cancel_user_id` int(11) DEFAULT NULL,
`cancel_motive` text DEFAULT NULL,
`total_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
`payment_date` date DEFAULT NULL,
`payment_type_id` int(11) DEFAULT NULL,
`receipt_id` int(11) DEFAULT NULL,
`modified` datetime DEFAULT NULL,
`created` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `CONDO` (`condo_id`),
KEY `CLIENT` (`entity_id`),
KEY `RECEIPTSTATUS` (`receipt_status_id`),
KEY `PAYMENTUSER` (`payment_user_id`),
KEY `PAYMENTTYPE` (`receipt_payment_type_id`),
KEY `PAYMENTTYPE` (`payment_type_id`),
KEY `FRACTION` (`fraction_id`),
KEY `CANCELUSER` (`cancel_user_id`),
KEY `payment_advices_ibfk_5` (`receipt_id`),
CONSTRAINT `payment_advices_ibfk_1` FOREIGN KEY (`condo_id`) REFERENCES `condos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `payment_advices_ibfk_2` FOREIGN KEY (`entity_id`) REFERENCES `entities` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_advices_ibfk_3` FOREIGN KEY (`receipt_status_id`) REFERENCES `receipt_statuses` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_advices_ibfk_4` FOREIGN KEY (`receipt_payment_type_id`) REFERENCES `receipt_payment_types` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_advices_ibfk_5` FOREIGN KEY (`payment_user_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_advices_ibfk_6` FOREIGN KEY (`cancel_user_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_advicesibfk_1` FOREIGN KEY (`fraction_id`) REFERENCES `fractions` (`id`) ON UPDATE CASCADE
CONSTRAINT `payment_advices_ibfk_3` FOREIGN KEY (`payment_type_id`) REFERENCES `receipt_payment_types` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_advices_ibfk_4` FOREIGN KEY (`fraction_id`) REFERENCES `fractions` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_advices_ibfk_5` FOREIGN KEY (`receipt_id`) REFERENCES `receipts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB;

ALTER TABLE `notes` ADD `payment_advice_id` int(11) NULL;
ALTER TABLE `notes` ADD CONSTRAINT `notes_ibfk_8` FOREIGN KEY (`payment_advice_id`) REFERENCES `payment_advices`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE `notes` DROP FOREIGN KEY `notes_ibfk_7`;
ALTER TABLE `notes` ADD CONSTRAINT `notes_ibfk_7` FOREIGN KEY (`receipt_id`) REFERENCES `receipts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE `payment_advices` ADD `due_date` DATE NULL AFTER `document_date`;

ALTER TABLE `drafts` CHANGE `content` `content` LONGTEXT NOT NULL;
ALTER TABLE `drafts` CHANGE `content_model` `content_model` LONGTEXT NOT NULL;
Expand Down
14 changes: 1 addition & 13 deletions app/Config/Schema/update_1.8_to_1.9.sql
Expand Up @@ -6,16 +6,4 @@ ALTER TABLE `movements` ADD `document_id` INT NULL AFTER `document`;
ALTER TABLE `movements` ADD `document_model` VARCHAR(50) NULL AFTER `document_id`;

ALTER TABLE `notes` DROP FOREIGN KEY `notes_ibfk_7`;
ALTER TABLE `notes` ADD CONSTRAINT `notes_ibfk_7` FOREIGN KEY (`receipt_id`) REFERENCES `receipts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

phkondo.payment_note_items definition

CREATE TABLE `payment_note_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`note_id` int(11) NOT NULL,
`modified` datetime DEFAULT NULL,
`created` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `NOTE` (`note_id`),
CONSTRAINT `payment_note_items_ibfk_1` FOREIGN KEY (`note_id`) REFERENCES `notes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `notes` ADD CONSTRAINT `notes_ibfk_7` FOREIGN KEY (`receipt_id`) REFERENCES `receipts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
7 changes: 0 additions & 7 deletions app/View/Themed/Phkondo/PaymentAdvices/add.ctp
Expand Up @@ -52,13 +52,6 @@
<div class="form-group">
<?php echo $this->Form->input('due_date', array('type' => 'text', 'class' => 'form-control datefield')); ?>
</div><!-- .form-group -->
<!--div class="form-group">
<?php //echo $this->Form->input('status_id', array('class' => 'form-control')); ?>
</div--><!-- .form-group -->
<!--div class="form-group">
<?php //echo $this->Form->input('receipt_payment_type_id', array('class' => 'form-control'));
?>
</div--><!-- .form-group -->
<div class="form-group">
<?php echo $this->Form->input('observations', array('default'=>Configure::read('PaymentAdvices.observations'),'class' => 'form-control')); ?>
</div><!-- .form-group -->
Expand Down
8 changes: 0 additions & 8 deletions app/View/Themed/Phkondo/PaymentAdvices/generate.ctp
Expand Up @@ -58,14 +58,6 @@
<div class="form-group">
<?php echo $this->Form->input('due_date', array('type' => 'text', 'class' => 'form-control datefield')); ?>
</div><!-- .form-group -->
<!--div class="form-group">
<?php //echo $this->Form->input('status_id', array('class' => 'form-control'));
?>
</div--><!-- .form-group -->
<!--div class="form-group">
<?php //echo $this->Form->input('receipt_payment_type_id', array('class' => 'form-control'));
?>
</div--><!-- .form-group -->
<div class="form-group">
<?php echo $this->Form->input('observations', array('class' => 'form-control')); ?>
</div><!-- .form-group -->
Expand Down
3 changes: 0 additions & 3 deletions app/View/Themed/Phkondo/Receipts/add.ctp
Expand Up @@ -38,9 +38,6 @@
<div class="form-group">
<?php echo $this->Form->input('receipt_status_id', array('class' => 'form-control')); ?>
</div><!-- .form-group -->
<!--div class="form-group">
<?php //echo $this->Form->input('receipt_payment_type_id', array('class' => 'form-control')); ?>
</div><!-- .form-group -->
<div class="form-group">
<?php echo $this->Form->input('observations', array('class' => 'form-control')); ?>
</div><!-- .form-group -->
Expand Down

0 comments on commit 32eb695

Please sign in to comment.