#1103 Contact delete may delete wrong contact

1.4
closed
None
9
2014-06-04
2014-03-30
Erik Huelsmann
No

Execute the following steps:

  1. open the contact screen
  2. select an account
  3. go to the "contact info" screen
  4. click on "Edit" for an item which is linked to the Company
  5. Change the "type" (or link?) to "Account"
  6. Click Save
  7. Verify that there are now 2 items with the same content, one with an X in the "This account" column
  8. Click on Delete for the item which does NOT have the X mark
  9. Verify that the one WITH THE x MARK has been deleted

So, that's the wrong one, because we clicked on the one without the X mark....

Discussion

  • Erik Huelsmann
    Erik Huelsmann
    2014-05-17

    • Priority: 5 --> 9
     
  • turtle
    turtle
    2014-05-19

    In step 6 I think you mean save as new since it wont allow duplicates?
    I get the error upon clicking save as new:
    Action Not Defined: save_contact_new at lsmb-request.pl line 106.
    LedgerSMB::Handler::try {...} () called at /usr/lib64/perl5/vendor_perl/5.18.2/Try/Tiny.pm line 81 eval {...} called at /usr/lib64/perl5/vendor_perl/5.18.2/Try/Tiny.pm line 72 Try::Tiny::try('CODE(0x2992d78)', 'Try::Tiny::Catch=REF(0x3ae49d8)') called at lsmb-request.pl line 120 LedgerSMB::Handler::call_script('contact.pl', 'LedgerSMB=HASH(0x53e3080)') called at lsmb-request.pl line 84 require lsmb-request.pl called at /var/www/localhost/htdocs/ledgersmb-1.4/contact.pl line 8

     
  • turtle
    turtle
    2014-05-19

    OK I see now if you change the drop-down "Attach to" From entity to credit you can get a X in the "this account" column, now if I have a item of type "secondary phone" with and attach to of "entity" then edit it changing only "type" I will have two items "secondary phone" the original will be unchanged.

    EDIT FOR CLARITY: I had to go to the credit accounts tab and click "save" thus adding a credit account for anything the dropdown "Attach to" to appear

     
    Last edit: turtle 2014-05-19
  • turtle
    turtle
    2014-05-19

    OK got it I see what you mean now.

     
  • turtle
    turtle
    2014-05-19

    It is only saved one time in the db.
    Checking the table entity_to_contact

     
  • turtle
    turtle
    2014-05-19

    in contact.pm copying sub save_contact to sub save_contact_new got rid of the save as new error:

    sub save_contact_new {
    }

    However the array $request probably needs different modifications like deleting a $request->{credit_id} ?

     
    Last edit: turtle 2014-05-19
  • Erik Huelsmann
    Erik Huelsmann
    2014-05-19

    Hi Turtle,

    moved the "save as new" part to its own ticket (#1144).

    Regards,

    Erik.

     
  • turtle
    turtle
    2014-05-19

    Ok, well I ran out of time for now. I did notice that the delete never succeeds unless there is the X there under 'this account' or the is_for_credit variable.
    So I am unable to delete anything unless there is some variable value to is_for_credit.

    Also looking at the table entity_to_contact I am not sure how the abstraction to the "attach_to" or is_for_credit variable would work without adding a column.
    cheers
    turtle

     
  • Chris Travers
    Chris Travers
    2014-06-04

    • status: open --> closed
    • assigned_to: Erik Huelsmann