--UPDATE FROM 8.7.0.0 TO 8.7.0.1


DROP TABLE VERSION_8_7_0_0;



/*  VERSION_8_7_0_1  */
CREATE TABLE VERSION_8_7_0_1 (
	 DUMMY	NUMBER	    NULL
)
;



COMMENT ON COLUMN XMTY.XMTY_ROLE IS '1 = A/R Number     2 = IATA Number     3 = VAT Number  4 = Frequent Flyer Cards and Loyalty Cards (differentiation will not ba handled on this level)     5 = Corporate ID (also used for V8Online IFC)     6 = Unique 3rd party Profile ID for Property Interface     7 = Rebate cards     8 = Contract number    9 = Fiscal Code (Legge Bersani, needed in Italy)    ... to be continued for special numbers';

COMMENT ON COLUMN WRPS.wrps_role IS '1=Confirmation Letter| 2=Folio Layout| 3=Message Print| 4=Shift report| 5=Conference Confirmation| 6=Registration Card| 7=Currency Exchange| 8=AR Reminders| 9=Paid Outs| 10=Activities| 11=Deposit Receipts| 12=Group Confirmation| 13=Special Reports| 14=AR Statements| 15=Mailing Hitlists| 16=CCM Participant Lists| 17=AR Compression| 18=Petty Cash | 19=Profile Letters (Correspondence) | 20=ProfileStatistic | 21=TableReservation | 22=TableReservationList | 23=TAP | 24=NotaCorrection | 25=EmailTemplate | 26=RoomKeyLabel | 27=Logbook | 28=AREgyptianInvoice | 29=menucards | 30=ar payment receipt';  

COMMENT ON COLUMN ZINN.ZINN_TYPE IS ' 1 = invoices, 2 = user definable number cycles, 3 = currency exchange (zfag_type 3), 4 = autonumber for booth telephone charges paid cash, 11 = autonumber zfag_type 1 (ar postings), 12 = autonumber zfag_type 2 (ar payments), 13 = void invoice, 14 = fattura (for italy), 15 = nota di credito (for italy or credit note for greece or portugal), 16 = proforma, 17 = fattura and nota di credito (for italy), 18 = nota korekta (for poland), 19 = Egyptian AR Invoice, 20 = AR Payment Receipt, 21 = registration cards, 31 = automatic fa numbers (zfac_autonumber), 32 = lost and found, 33 = police export, 34 = tourist export, 35 = jetweb interface';

CREATE TABLE ARPR (
    ARPR_ID NUMBER(30) NOT NULL
   ,ARPR_ZFAC_ID NUMBER(30) 
   ,ARPR_INVOICENO VARCHAR2(60)
   ,ARPR_INVOICENAME VARCHAR2(100)
   ,ARPR_INVOICEDATE DATE
   ,ARPR_ORIGINALAMOUNT NUMBER(30, 4)
   ,ARPR_ALREADYPAID NUMBER(30, 4)
   ,ARPR_PAIDNOW NUMBER(30, 4)
   ,ARPR_TOTALBALANCE NUMBER(30, 4)
   ,ARPR_AINV_ID NUMBER(30)
   ,CONSTRAINT ARPR_PK PRIMARY KEY (ARPR_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN ;
   
COMMENT ON TABLE ARPR IS 'AR Payment Receipt Data table';
   
CREATE SEQUENCE SEQ_ARPR INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;	

CREATE INDEX ARPR_ZFAC_ID ON ARPR(ARPR_ZFAC_ID) TABLESPACE V8INDEX; 

CREATE INDEX ARPR_AINV_ID ON ARPR(ARPR_AINV_ID) TABLESPACE V8INDEX; 

ALTER TABLE SAAR ADD (SAAR_PARTNER_ID NUMBER(30), SAAR_WPHS_ID NUMBER(30), SAAR_ATYP_SHORTDESC VARCHAR(3), SAAR_ATYP_LONGDESC VARCHAR(30));

ALTER TABLE SAAR DROP (SAAR_XCMS_GLOBALID);

ALTER TABLE SAAR MODIFY (SAAR_AACC_ATYP_ID NULL, SAAR_XCMS_ID NULL);

--

--!!!Following statement should be executed, if updating from version 8.6.1.0 or higher and facing tablespace problems in the past due to large pdf email-attachments stored in WTXT!!!
--!!!PLEASE NOTE: After running this statement it will not be possible anymore to open confirmation letters created with a version < 8.6!!!

--UPDATE WTXT SET WTXT_DATA = '52454D4F564544' /*REMOVED*/ WHERE EXISTS (SELECT 1 FROM WMAI WHERE WMAI.WMAI_SENT=1 AND WMAI.WMAI_ATTACHMENT_WTXT_ID=WTXT.WTXT_ID) AND WTXT.WTXT_DOCFORMAT=2;

--

ALTER TABLE WQFD ADD WQFD_DISPLORDER NUMBER(3);

UPDATE WQFD SET WQFD_DISPLORDER = ROWNUM;

COMMENT ON COLUMN WQFD.WQFD_DISPLORDER IS 'Display order';

ALTER TABLE WLOF ADD WLOF_DISPLORDER NUMBER(3);

UPDATE WLOF SET WLOF_DISPLORDER = ROWNUM;

COMMENT ON COLUMN WLOF.WLOF_DISPLORDER IS 'Display order';

