Merge pull request #14171 from hregis/12.0_bug
FIX missing possibility to change entity when propal cloning
This commit is contained in:
commit
75409e3ed0
@ -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) {
|
if ($result > 0) {
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
exit();
|
exit();
|
||||||
@ -1832,10 +1832,9 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<tr><td class="tdtop"><input type="radio" name="createmode" value="empty" checked></td>';
|
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 '<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();
|
dol_fiche_end();
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
@ -1878,11 +1877,11 @@ if ($action == 'create')
|
|||||||
if ($action == 'clone') {
|
if ($action == 'clone') {
|
||||||
// Create an array for form
|
// Create an array for form
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
// 'text' => $langs->trans("ConfirmClone"),
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' =>
|
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||||
// 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)'))
|
||||||
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)) {
|
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);
|
$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 User $user User making the clone
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
|
* @param int $forceentity Entity id to force
|
||||||
* @return int New id of clone
|
* @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;
|
global $conf, $hookmanager;
|
||||||
|
|
||||||
@ -1382,6 +1383,7 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
$object->id = 0;
|
$object->id = 0;
|
||||||
$object->ref = '';
|
$object->ref = '';
|
||||||
|
$object->entity = (! empty($forceentity) ? $forceentity : $object->entity);
|
||||||
$object->statut = self::STATUS_DRAFT;
|
$object->statut = self::STATUS_DRAFT;
|
||||||
|
|
||||||
// Clear fields
|
// Clear fields
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user