diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 80b71c2a428..b0cea3318cb 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1959,7 +1959,6 @@ if ($action == 'create' && $user->rights->commande->creer) // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' // => 1), array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=3)'))); - // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneOrder'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index e0badfb9530..c7cb1dc6f78 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -198,10 +198,13 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd) // Because createFromClone modifies the object, we must clone it so that we can restore it later $orig = clone $object; - $result=$object->createFromClone($socid); + $result=$object->createFromClone($user, $object->id); if ($result > 0) { - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + $newid = 0; + if (is_object($result)) $newid = $result->id; + else $newid = $result; + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object exit; } else diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 6648e63bc6d..7b62c96ded5 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -69,6 +69,7 @@ $langs->loadLangs(array("mymodule@mymodule","other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); @@ -249,6 +250,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1); } + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneMyObject'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + // Confirmation of action xxxx if ($action == 'xxx') { @@ -258,7 +266,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)) }*/ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); } @@ -358,6 +366,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Send print '' . $langs->trans('SendMail') . ''."\n"; + // Modify if ($user->rights->mymodule->write) { print ''.$langs->trans("Modify").''."\n"; @@ -367,8 +376,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans('Modify').''."\n"; } + // Clone + if ($user->rights->mymodule->write) + { + print '
' . $langs->trans("ToClone") . '
'; + } + /* - if ($user->rights->mymodule->create) + if ($user->rights->mymodule->write) { if ($object->status == 1) { diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index ee914971857..8c768c67f0b 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -33,6 +33,7 @@ $langs->loadLangs(array("stocks","other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index a4cf96c9338..25ff7215e5d 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -48,6 +48,7 @@ $langs->loadLangs(array("website","other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha');