From 815a467eb7ab5202318fd3931362a08e2244436f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 19:54:03 +0200 Subject: [PATCH] Debug clone of products --- htdocs/product/card.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2c8b70efbd1..847c6325b50 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -497,7 +497,7 @@ if (empty($reshook)) $originalId = $id; if ($object->id > 0) { - $object->ref = GETPOST('clone_ref'); + $object->ref = GETPOST('clone_ref', 'alphanohtml'); $object->status = 0; $object->status_buy = 0; $object->id = null; @@ -505,7 +505,8 @@ if (empty($reshook)) if ($object->check()) { - $id = $object->create($user); + $object->context['createfromclone'] = 'createfromclone'; + $id = $object->create($user); if ($id > 0) { if (GETPOST('clone_composition')) @@ -546,7 +547,7 @@ if (empty($reshook)) $object->fetch($id); } else - { + { $db->rollback(); if (count($object->errors)) { @@ -560,6 +561,8 @@ if (empty($reshook)) } } } + + unset($object->context['createfromclone']); } } else @@ -1966,7 +1969,7 @@ if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf- if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js || (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 260, 600); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 350, 600); }