FIX missing possibility to change entity when propal cloning
This commit is contained in:
parent
9bb0ef04f5
commit
a5431a40da
@ -194,7 +194,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->createFromClone($user, $socid);
|
||||
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null));
|
||||
if ($result > 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
exit();
|
||||
@ -1832,10 +1832,9 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td class="tdtop"><input type="radio" name="createmode" value="empty" checked></td>';
|
||||
print '<td valign="top" colspan="2">'.$langs->trans("CreateEmptyPropal").'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$langs->load("bills");
|
||||
@ -1878,11 +1877,11 @@ if ($action == 'create')
|
||||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
$formquestion = array(
|
||||
// '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' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')));
|
||||
// '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' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))
|
||||
);
|
||||
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) {
|
||||
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison);
|
||||
}
|
||||
|
||||
@ -1324,9 +1324,10 @@ class Propal extends CommonObject
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $socid Id of thirdparty
|
||||
* @param int $forceentity Entity id to force
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone(User $user, $socid = 0)
|
||||
public function createFromClone(User $user, $socid = 0, $forceentity = null)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
@ -1382,6 +1383,7 @@ class Propal extends CommonObject
|
||||
|
||||
$object->id = 0;
|
||||
$object->ref = '';
|
||||
$object->entity = (! empty($forceentity) ? $forceentity : $object->entity);
|
||||
$object->statut = self::STATUS_DRAFT;
|
||||
|
||||
// Clear fields
|
||||
|
||||
Loading…
Reference in New Issue
Block a user