Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0004804Openbravo ERPZ. Otherspublic2008-09-03 18:242009-03-26 13:04
egoitz 
Hennadzi 
normalminoralways
closedfixed 
5
pi 
2.40 
Core
No
0004804: m_get_offers_name function does not work on postgreSQL
The m_get_offers_name function does not work on postgresql
I tried to use this function defined to do a develop.
I defined a new Price adjustemnt and assigned a product to this price adjustment. I execute the next order and it didn't return nothing.
select m_get_offers_name(to_date(now()),anypartner_id,the_id_of_the_productassigned) from dual;
The problem is that the next variable is initialized with NULL and then a String is concatened to this variable, and it is not possible in postgre.

v_Names VARCHAR(10000) := NULL;
...
...
    LOOP
      IF v_Names IS NOT NULL THEN
        v_Names := v_Names||'
';
      END IF;
      v_Names := v_Names||Cur_Offer.name;
    END LOOP;

To solve it you have to use an empty string instead of NULL and the compare the v_Names with an empty string instead of compare with NULL.
Posible solution:

v_Names VARCHAR(10000) := '';
...
...
 IF v_Names <> '' THEN
        v_Names := v_Names||'<b r/>& nbsp;';
      END IF;
      v_Names := v_Names||Cur_Offer.name;
    END LOOP;
No tags attached.
blocks defect 0000490pi closed Hennadzi m_get_offers_name function does not work on postgreSQL 
Issue History
2008-09-03 18:24cromeroNew Issue
2008-09-03 18:24cromeroAssigned To => egoitz
2008-09-03 18:24cromeroStatusnew => scheduled
2008-11-13 22:47rafarodaAssigned Toegoitz => Hennadzi
2008-11-24 17:45svnbotCheckin
2008-11-24 17:45svnbotNote Added: 0010581
2008-11-24 17:45svnbotStatusscheduled => resolved
2008-11-24 17:45svnbotResolutionopen => fixed
2008-11-24 17:45svnbotsvn_revision => 10483
2008-11-25 16:17svnbotCheckin
2008-11-25 16:17svnbotNote Added: 0010651
2008-11-25 16:17svnbotsvn_revision10483 => 10556
2009-01-27 17:13rafarodaNote Added: 0012696
2009-01-27 17:14rafarodaNote Edited: 0012696
2009-02-02 16:13rafarodaNote Deleted: 0010651
2009-03-03 17:32psarobeFixed in Version => 2.40MP3
2009-03-24 11:01psarobeFixed in Version2.40MP3 => 2.40MP4
2009-03-26 13:04sureshbabuRegression testing => No
2009-03-26 13:04sureshbabuStatusresolved => closed
2009-03-26 13:04sureshbabuNote Added: 0015003

Notes
(0010581)
svnbot   
2008-11-24 17:45   
Repository: openbravo
Revision: 10483
Author: hennadzi
Date: 2008-11-24 17:44:56 +0100 (Mon, 24 Nov 2008)

bug fixed 0004804: m_get_offers_name function does not work on postgreSQL

---
U branches/r2.40/src-db/database/model/functions/M_GET_OFFERS_NAME.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=10483&sc=1 [^]
(0012696)
rafaroda   
2009-01-27 17:13   
(edited on: 2009-01-27 17:14)
To test the fix within Openbravo ERP using PostgreSQL:

1) Create a price adjustment in 'Master Data Management || Pricing || Price Adjustments || Adjustments' with values:
* Starting date = 01-01-2000
* Discount % = 50
* Min Quantity = 499
* Business Partner = All Selected
* Product = All Selected
2) Move to Business Partner tab and select one business partner
3) Move to Product tab and select one product
4) Create a new Sales or Purchase Order for the business partner of the price adjustment
5) Create one line for the product of the price adjustment
6) Save this line
7) Change quantity to 500. Unit Price should have half amount
8) Go to the header of the order and complete it
9) Create a new order for the same business partner
10) Click on Copy Lines and select the product of the previous order

Notice that in Copy Lines pop up the name of the offer appears in Offer column.

(0015003)
sureshbabu   
2009-03-26 13:04   
Fixed, working fine