Fix edition of status were loosing old percent. We show it to allow user

to keep it if required.
This commit is contained in:
Laurent Destailleur 2016-07-09 14:58:51 +02:00
parent 03dbf6e747
commit a258663175
4 changed files with 19 additions and 6 deletions

View File

@ -569,7 +569,7 @@ class FormProjets
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$sellist .='<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'"'; $sellist .='<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'" elemcode="'.$obj->code.'"';
if ($obj->rowid == $preselected) $sellist .= ' selected="selected"'; if ($obj->rowid == $preselected) $sellist .= ' selected="selected"';
$sellist .= '>'; $sellist .= '>';
if ($useshortlabel) if ($useshortlabel)

View File

@ -488,6 +488,7 @@ ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
UPDATE llx_projet set fk_opp_status = NULL where fk_opp_status = -1; UPDATE llx_projet set fk_opp_status = NULL where fk_opp_status = -1;
UPDATE llx_c_lead_status set code = 'WON' where code = 'WIN'; UPDATE llx_c_lead_status set code = 'WON' where code = 'WIN';
UPDATE llx_c_lead_status set percent = 100 where code = 'WON';
CREATE TABLE llx_oauth_token ( CREATE TABLE llx_oauth_token (

View File

@ -84,6 +84,7 @@ SeeAbove=See above
HomeArea=Home area HomeArea=Home area
LastConnexion=Last connection LastConnexion=Last connection
PreviousConnexion=Previous connection PreviousConnexion=Previous connection
PreviousValue=Previous value
ConnectedOnMultiCompany=Connected on environment ConnectedOnMultiCompany=Connected on environment
ConnectedSince=Connected since ConnectedSince=Connected since
AuthenticationMode=Authentification mode AuthenticationMode=Authentification mode

View File

@ -710,7 +710,9 @@ else
// Opportunity probability // Opportunity probability
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>'; print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>';
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(isset($_POST['opp_percent'])?GETPOST('opp_percent'):(strcmp($object->opp_percent,'')?price($object->opp_percent,0,$langs,1,0):'')).'"> %</td>'; print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(isset($_POST['opp_percent'])?GETPOST('opp_percent'):(strcmp($object->opp_percent,'')?price($object->opp_percent,0,$langs,1,0):'')).'"> %';
print '<span id="oldopppercent"></span>';
print '</td>';
print '</tr>'; print '</tr>';
// Opportunity amount // Opportunity amount
@ -837,14 +839,23 @@ else
print '</form>'; print '</form>';
// Change probability from status // Change probability from status
print '<script type="text/javascript" language="javascript"> if (! empty($conf->use_javascript_ajax))
{
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
function change_percent() function change_percent()
{ {
var element = jQuery("#opp_status option:selected"); var element = jQuery("#opp_status option:selected");
var defaultpercent = element.attr("defaultpercent"); var defaultpercent = element.attr("defaultpercent");
/*if (jQuery("#opp_percent_not_set").val() == "") */ var elemcode = element.attr("elemcode");
jQuery("#opp_percent").val(defaultpercent); /* Change percent of default percent of new status is higher */
if (parseFloat(jQuery("#opp_percent").val()) != parseFloat(defaultpercent)
)
{
if (! jQuery("#oldopppercent").text()) jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->trans("PreviousValue")).': \'+jQuery("#opp_percent").val()+\' %\');
jQuery("#opp_percent").val(defaultpercent);
}
} }
/*init_myfunc();*/ /*init_myfunc();*/
jQuery("#opp_status").change(function() { jQuery("#opp_status").change(function() {
@ -852,7 +863,7 @@ else
}); });
}); });
</script>'; </script>';
}
/* /*
* Boutons actions * Boutons actions