Thursday, November 20, 2008 ..:: Forums ::.. Register  Login
 Forums Minimize
SearchForum Home
     
  Mainstream Forums  Bugs  Delete Line ite...
 Delete Line items from duplicated invoice is deleting the original one also
 
nyounaki
46 posts
Joined
12/11/2007

Delete Line items from duplicated invoice is deleting the original one also
Posted: 15 Jun 08 5:35 AM

Duplicate Invoice  ->  delete item line from the invoice ->  press save button -> check the original invoice you will see the line item has been deleted also

Please advise

support
2096 posts
1st
Joined
1/3/2006

Re: Delete Line items from duplicated invoice is deleting the original one also
Posted: 15 Jun 08 11:46 PM Modified By support  on 6/15/2008 11:49:27 PM)

We were unable to reproduce this problem.  Is it possible that you are running old code?  Here is an excerpt from ~/_controls/EditLineItemsView.ascx.cs that suggests that we are handling the issue properly.

// 04/01/2007 Paul. If we are duplicating a quote, then we must create new IDs for the line items.
// Otherwise, edits to the line items will change the old quote.
// 04/29/2007 Paul. If we are converting from one module to another, then the loading module will not match the current module.
if ( !Sql.IsEmptyGuid(gDuplicateID) || m_sMODULE != sLOAD_MODULE )
{
    foreach ( DataRow row in dtLineItems.Rows )
    {
        row[
"ID"] = Guid.NewGuid();
    }
}

nyounaki
46 posts
Joined
12/11/2007

Re: Delete Line items from duplicated invoice is deleting the original one also
Posted: 17 Jun 08 10:21 AM
I have the latest version as well as I checked the code is the same .

however, I have tried with the demo version
http://demo.splendidcrm.com/Invoices/view.aspx?id=455a6aa1-5839-4f7a-9e33-a0f7f265e4d8
its the same problem please do the following step :

open invoice (has items)
press duplicate button

delete line items from that duplicated invoice

save the invoice (duplicated one)

go to original invoice and check the items

you will not see the lines

regards
support
2096 posts
1st
Joined
1/3/2006

Re: Delete Line items from duplicated invoice is deleting the original one also
Posted: 18 Jun 08 12:23 AM

That is a tricky one.  In my tests, I was saving the duplicate before deleting the line items.  The bug only appears when you duplicate and immediately delete.  The solution is to note delete the original line items if this is a duplicate operation.  We had to fix Invoices, Orders, Quotes and Payments.  The fix will be in the next build, or you can request the updated files directly from our support team.

Here is a sample fix for Quotes.  Please keep in mind that we also saved the DuplicateID into the ViewState for the specific purpose of checking during the save operation:

// 06/17/2008 Paul. If this was a duplication operation, then don't delete the original line items.
Guid gDuplicateID = Sql.ToGuid(ViewState["DuplicateID"]);
if ( Sql.IsEmptyGuid(gDuplicateID) )
{
   foreach ( DataRow row in dtLineItems.Rows )
   {
      if ( row.RowState == DataRowState.Deleted )
      {
      // 05/26/2007 Paul. In order to access values from deleted row, use DataRowVersion.Original, 
      // otherwise accessing the data will throw an exception "Deleted row information cannot be accessed through the row."
      Guid gITEM_ID = Sql.ToGuid(row["ID", DataRowVersion.Original]);
      if ( !Sql.IsEmptyGuid(gITEM_ID) )
         SqlProcs.spQUOTES_LINE_ITEMS_Delete(gITEM_ID, trn);
      }
   }
}

 

  Mainstream Forums  Bugs  Delete Line ite...

Forum Home  Search       

Copyright (c) 2006-2008 SplendidCRM Software, Inc. All Rights Reserved.   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2008 by Perpetual Motion Interactive Systems Inc.
SplendidCRM and SplendidCRM Software are trademarks of SplendidCRM Software, Inc. SugarCRM is a trademark of SugarCRM Inc. in the United States, the European Union and other countries. All other trademarks used in this web site are the property of their respective owners.