New: Can define the new product ref when cloning

This commit is contained in:
Laurent Destailleur 2009-12-10 11:01:16 +00:00
parent 6bc320cf1d
commit bcc62447af
5 changed files with 29 additions and 24 deletions

View File

@ -12,7 +12,8 @@ For users:
- New: VAT number is stored in one field. This is more "international". - New: VAT number is stored in one field. This is more "international".
- New: task #9782 : Add possibility to delete a warehouse. - New: task #9782 : Add possibility to delete a warehouse.
- New: task #9640 : Add label for stock movements. - New: task #9640 : Add label for stock movements.
- New: task #9916 : Add FREE text for interventions card - New: task #9916 : Add FREE text for interventions card.
- New: Can define the new product ref when cloning.
- Fix: bug #28055 : Unable to modify the date of a cloned command. - Fix: bug #28055 : Unable to modify the date of a cloned command.
- Fix: bug #27891. - Fix: bug #27891.
- Fix: Change of numbering module was not effective. - Fix: Change of numbering module was not effective.

View File

@ -1639,34 +1639,35 @@ class Form
$more=''; $more='';
if ($formquestion) if ($formquestion)
{ {
$more.='<tr class="valid"><td class="valid" colspan="3">'; $more.='<tr class="valid"><td class="valid" colspan="3">'."\n";
$more.='<table class="nobordernopadding" width="100%">'; $more.='<table class="nobordernopadding" width="100%">'."\n";
$more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'; $more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'."\n";
foreach ($formquestion as $key => $input) foreach ($formquestion as $key => $input)
{ {
if ($input['type'] == 'text') if ($input['type'] == 'text')
{ {
$more.='<tr><td valign="top">'.$input['label'].'</td><td colspan="2"><input type="text" class="flat" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'"></td></tr>'; $more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="text" class="flat" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'"></td></tr>'."\n";
} }
if ($input['type'] == 'select') if ($input['type'] == 'select')
{ {
$more.='<tr><td valign="top">'; $more.='<tr><td valign="top">';
$more.=$this->selectarray($input['name'],$input['values'],'',1); $more.=$this->selectarray($input['name'],$input['values'],'',1);
$more.='</td></tr>'; $more.='</td></tr>'."\n";
} }
if ($input['type'] == 'checkbox') if ($input['type'] == 'checkbox')
{ {
$more.='<tr>'; $more.='<tr>';
$more.='<td valign="top">'.$input['label'].' &nbsp;'; //$more.='<td valign="top">'.$input['label'].' &nbsp;';
$more.='<td valign="top">'.$input['label'].' </td><td valign="top" align="left">';
$more.='<input type="checkbox" class="flat" name="'.$input['name'].'"'; $more.='<input type="checkbox" class="flat" name="'.$input['name'].'"';
//print 'xx'.$input['value'].'-'.!empty($input['value']).'-'.($input['value'] != 'false');
if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked="true"'; if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked="true"';
if (is_bool($input['value']) && $input['value']) $more.=' checked="true"'; if (is_bool($input['value']) && $input['value']) $more.=' checked="true"';
if ($input['disabled']) $more.=' disabled="true"'; if ($input['disabled']) $more.=' disabled="true"';
$more.='></td>'; $more.='>';
$more.='</td>';
//$more.='<td valign="top" align="left">&nbsp;</td>';
$more.='<td valign="top" align="left">&nbsp;</td>'; $more.='<td valign="top" align="left">&nbsp;</td>';
$more.='<td valign="top" align="left">&nbsp;</td>'; $more.='</tr>'."\n";
$more.='</tr>';
} }
if ($input['type'] == 'radio') if ($input['type'] == 'radio')
{ {
@ -1681,13 +1682,13 @@ class Form
$more.='></td>'; $more.='></td>';
$more.='<td valign="top" align="left">'; $more.='<td valign="top" align="left">';
$more.=$selval; $more.=$selval;
$more.='</td></tr>'; $more.='</td></tr>'."\n";
$i++; $i++;
} }
} }
} }
$more.='</table>'; $more.='</table>'."\n";
$more.='</td></tr>'; $more.='</td></tr>'."\n";
} }
print "\n<!-- begin form_confirm -->\n"; print "\n<!-- begin form_confirm -->\n";
@ -1705,14 +1706,14 @@ class Form
} }
else else
{ {
print '<form method="post" action="'.$page.'" class="notoptoleftroright">'; print '<form method="post" action="'.$page.'" class="notoptoleftroright">'."\n";
print '<input type="hidden" name="action" value="'.$action.'">'; print '<input type="hidden" name="action" value="'.$action.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
print '<table width="100%" class="valid">'; print '<table width="100%" class="valid">'."\n";
// Ligne titre // Ligne titre
print '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('','recent').' '.$title.'</td></tr>'; print '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('','recent').' '.$title.'</td></tr>'."\n";
// Ligne formulaire // Ligne formulaire
print $more; print $more;
@ -1725,9 +1726,9 @@ class Form
print $this->selectyesno("confirm",$newselectedchoice); print $this->selectyesno("confirm",$newselectedchoice);
print '</td>'; print '</td>';
print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td>'; print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td>';
print '</tr>'; print '</tr>'."\n";
print '</table>'; print '</table>'."\n";
if (is_array($formquestion)) if (is_array($formquestion))
{ {

View File

@ -152,3 +152,4 @@ ConfirmCloneProduct=Are you sure you want to clone product or service <b>%s</b>
CloneContentProduct=Clone all main informations of product/service CloneContentProduct=Clone all main informations of product/service
ClonePricesProduct=Clone main informations and prices ClonePricesProduct=Clone main informations and prices
ProductIsUsed=This product is used ProductIsUsed=This product is used
NewRefForClone=Ref. of new product/service

View File

@ -152,3 +152,4 @@ ConfirmCloneProduct=Etes-vous sur de vouloir cloner le produit ou service <b>%s<
CloneContentProduct=Cloner les informations générales du produit/service uniquement CloneContentProduct=Cloner les informations générales du produit/service uniquement
ClonePricesProduct=Cloner les informations générales et les prix ClonePricesProduct=Cloner les informations générales et les prix
ProductIsUsed=Ce produit est utilisé ProductIsUsed=Ce produit est utilisé
NewRefForClone=Réf. du nouveau produit/service

View File

@ -233,7 +233,7 @@ if ($_POST["action"] == 'confirm_clone' && $_POST['confirm'] == 'yes' && ($user-
$originalId = $_GET["id"]; $originalId = $_GET["id"];
if ($product->fetch($_GET["id"]) > 0) if ($product->fetch($_GET["id"]) > 0)
{ {
$product->ref = $langs->trans("CopyOf").' '.$product->ref; $product->ref = $_REQUEST["clone_ref"];
$product->status = 0; $product->status = 0;
$product->finished = 1; $product->finished = 1;
$product->id = null; $product->id = null;
@ -1206,7 +1206,8 @@ if ($_GET["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("CloneContentProduct"), 'value' => 1), array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => $langs->trans("CopyOf").' '.$product->ref, 'size'=>24),
array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1),
array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true) array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true)
); );
// Paiement incomplet. On demande si motif = escompte ou autre // Paiement incomplet. On demande si motif = escompte ou autre