Debug clone of products

This commit is contained in:
Laurent Destailleur 2019-05-22 19:54:03 +02:00
parent c131363dd1
commit 815a467eb7

View File

@ -497,7 +497,7 @@ if (empty($reshook))
$originalId = $id; $originalId = $id;
if ($object->id > 0) if ($object->id > 0)
{ {
$object->ref = GETPOST('clone_ref'); $object->ref = GETPOST('clone_ref', 'alphanohtml');
$object->status = 0; $object->status = 0;
$object->status_buy = 0; $object->status_buy = 0;
$object->id = null; $object->id = null;
@ -505,6 +505,7 @@ if (empty($reshook))
if ($object->check()) if ($object->check())
{ {
$object->context['createfromclone'] = 'createfromclone';
$id = $object->create($user); $id = $object->create($user);
if ($id > 0) if ($id > 0)
{ {
@ -560,6 +561,8 @@ if (empty($reshook))
} }
} }
} }
unset($object->context['createfromclone']);
} }
} }
else 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 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 || (! 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);
} }