From ff37adf6f1e8468f7c32bc4631571f3c342ac3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Jun 2014 13:47:30 +0200 Subject: [PATCH] Fix: [ bug #1451 ] Interrupted order clone through trigger, loads nonexistent order --- ChangeLog | 1 + htdocs/commande/fiche.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index f77863f1de0..8b291cf3d5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ Fix: [ bug #1443 ] Payment conditions is erased after editing supplier invoice l limit date for payment Fix: [ bug #1449 ] Trigger ORDER_CREATE, LINEORDER_DELETE, LINEORDER_UPDATE and LINEORDER_INSERT ignore interception on error Fix: [ bug #1450 ] Several Customer order's triggers do not report the error from the trigger handler +Fix: [ bug #1451 ] Interrupted order clone through trigger, loads nonexistent order ***** ChangeLog for 3.5.3 compared to 3.5.2 ***** Fix: Error on field accountancy code for export profile of invoices. diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 34dcccb80b8..6630477d740 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -112,6 +112,9 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande-> { if ($object->id > 0) { + //Because createFromClone modifies the object, we must clone it so that we can restore it later + $orig = clone $object; + $result=$object->createFromClone($socid); if ($result > 0) { @@ -121,6 +124,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande-> else { setEventMessage($object->error, 'errors'); + $object = $orig; $action=''; } }