Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 17.0

This commit is contained in:
Laurent Destailleur 2022-12-21 19:27:50 +01:00
commit bee9244747
3 changed files with 197 additions and 44 deletions

View File

@ -92,6 +92,7 @@ class box_members_by_type extends ModeleBoxes
if ($user->rights->adherent->lire) {
$MembersToValidate = array();
$MembersPending = array();
$MembersValidated = array();
$MembersUpToDate = array();
$MembersExcluded = array();
@ -169,34 +170,63 @@ class box_members_by_type extends ModeleBoxes
}
$this->db->free($result);
}
// Members pendding (Waiting for first subscription)
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d, " . MAIN_DB_PREFIX . "adherent_type as t";
$sql .= " WHERE d.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND d.statut = 1 AND (d.datefin IS NULL AND t.subscription = 1)";
$sql .= " AND t.rowid = d.fk_adherent_type";
$sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$num2 = $this->db->num_rows($result);
$i = 0;
while ($i < $num2) {
$objp = $this->db->fetch_object($result);
$MembersPending[$objp->fk_adherent_type] = $objp->somme;
$i++;
}
$this->db->free($result);
}
$line = 0;
$this->info_box_contents[$line][] = array(
'td' => 'class=""',
'text' => '',
);
// Draft
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
$labelstatus = $langs->trans("UpToDate");
// Pending (Waiting for first subscription)
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Up to date
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus,
);
$labelstatus = $langs->trans("OutOfDate");
// Expired
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Excluded
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Resiliated
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
@ -205,7 +235,8 @@ class box_members_by_type extends ModeleBoxes
$line++;
foreach ($AdherentType as $key => $adhtype) {
$SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
$SumValidated += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0;
$SumPending += isset($MembersPending[$key]) ? $MembersPending[$key] : 0;
$SumExpired += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) - (isset($MembersPending[$key]) ? $MembersPending[$key] : 0): 0;
$SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0;
$SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0;
$SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
@ -220,6 +251,11 @@ class box_members_by_type extends ModeleBoxes
'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersPending[$key]) && $MembersPending[$key] > 0 ? $MembersPending[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
@ -260,6 +296,11 @@ class box_members_by_type extends ModeleBoxes
'text' => $SumToValidate.' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SumPending.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SumUpToDate.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
@ -267,7 +308,7 @@ class box_members_by_type extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SumValidated.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
'text' => $SumExpired.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(

View File

@ -125,7 +125,8 @@ ValidateProject=Validate projet
ConfirmValidateProject=Are you sure you want to validate this project?
CloseAProject=Close project
ConfirmCloseAProject=Are you sure you want to close this project?
AlsoCloseAProject=Also close project (keep it open if you still need to follow production tasks on it)
AlsoCloseAProject=Also close project
AlsoCloseAProjectTooltip=Keep it open if you still need to follow production tasks on it
ReOpenAProject=Open project
ConfirmReOpenAProject=Are you sure you want to re-open this project?
ProjectContact=Contacts of project
@ -168,7 +169,7 @@ OpportunityProbability=Lead probability
OpportunityProbabilityShort=Lead probab.
OpportunityAmount=Lead amount
OpportunityAmountShort=Lead amount
OpportunityWeightedAmount=Opportunity weighted amount
OpportunityWeightedAmount=Amount of opportunity, weighted by probability
OpportunityWeightedAmountShort=Opp. weighted amount
OpportunityAmountAverageShort=Average lead amount
OpportunityAmountWeigthedShort=Weighted lead amount

View File

@ -567,7 +567,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '</td></tr>';
// Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("ProjectLabel").'</span></td><td><input class="width500 maxwidth150onsmartphone" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus></td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input class="width500 maxwidth150onsmartphone" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus></td></tr>';
// Usage (opp, task, bill time, ...)
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) {
@ -602,12 +602,46 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') ? ' checked="checked"' : '') : ' checked="checked"').'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print '<label for="usage_task">'.$form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext).'</label>';
print '<script>';
print '$( document ).ready(function() {
jQuery("#usage_task").change(function() {
if (jQuery("#usage_task").prop("checked")) {
console.log("Show task fields");
jQuery(".classusetask").show();
} else {
console.log("Hide tasks fields "+jQuery("#usage_task").prop("checked"));
jQuery(".classusetask").hide();
}
});
';
if (GETPOSTISSET('usage_task') && !GETPOST('usage_task')) {
print 'jQuery(".classusetask").hide();';
}
print '});';
print '</script>';
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') ? ' checked="checked"' : '') : '').'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print '<label for="usage_bill_time">'.$form->textwithpicto($langs->trans("BillTime"), $htmltext).'</label>';
print '<script>';
print '$( document ).ready(function() {
jQuery("#usage_bill_time").change(function() {
if (jQuery("#usage_bill_time").prop("checked")) {
console.log("Show bill time fields");
jQuery(".classusebilltime").show();
} else {
console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
jQuery(".classusebilltime").hide();
}
});
';
if (GETPOSTISSET('usage_bill_time') && !GETPOST('usage_bill_time')) {
print 'jQuery(".classusebilltime").hide();';
}
print '});';
print '</script>';
print '<br>';
}
if (isModEnabled('eventorganization')) {
@ -706,24 +740,26 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '<tr class="classuseopportunity"><td>'.$langs->trans("OpportunityStatus").'</td>';
print '<td class="maxwidthonsmartphone">';
print $formproject->selectOpportunityStatus('opp_status', GETPOSTISSET('opp_status') ? GETPOST('opp_status') : $object->opp_status, 1, 0, 0, 0, '', 0, 1);
print '</tr>';
// Opportunity probability
print '<tr class="classuseopportunity"><td>'.$langs->trans("OpportunityProbability").'</td>';
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.dol_escape_htmltag(GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : '').'"><span class="hideonsmartphone"> %</span>';
print ' <input class="width50 right" type="text" id="opp_percent" name="opp_percent" title="'.dol_escape_htmltag($langs->trans("OpportunityProbability")).'" value="'.dol_escape_htmltag(GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : '').'"><span class="hideonsmartphone"> %</span>';
print '<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(GETPOSTISSET('opp_percent') ? '0' : '1').'">';
print '</td>';
print '</tr>';
// Opportunity amount
print '<tr class="classuseopportunity"><td>'.$langs->trans("OpportunityAmount").'</td>';
print '<td><input size="5" type="text" name="opp_amount" value="'.dol_escape_htmltag(GETPOSTISSET('opp_amount') ? GETPOST('opp_amount') : '').'"></td>';
print '<td><input class="width75 right" type="text" name="opp_amount" value="'.dol_escape_htmltag(GETPOSTISSET('opp_amount') ? GETPOST('opp_amount') : '').'">';
print ' '.$langs->getCurrencySymbol($conf->currency);
print '</td>';
print '</tr>';
}
// Budget
print '<tr><td>'.$langs->trans("Budget").'</td>';
print '<td><input size="5" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET('budget_amount') ? GETPOST('budget_amount') : '').'"></td>';
print '<tr class="classusetask classusebilltime"><td>'.$langs->trans("Budget").'</td>';
print '<td><input class="width75 right" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET('budget_amount') ? GETPOST('budget_amount') : '').'">';
print ' '.$langs->getCurrencySymbol($conf->currency);
print '</td>';
print '</tr>';
// Date project
@ -780,6 +816,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '</form>';
// Change probability from status or role of project
// Set also dependencies between use taks and bill time
print '<script type="text/javascript">
jQuery(document).ready(function() {
function change_percent()
@ -886,7 +923,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("ProjectLabel").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).'"></td></tr>';
// Status
@ -911,7 +948,14 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '<label for="usage_opportunity">'.$form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext).'</label>';
print '<script>';
print '$( document ).ready(function() {
jQuery("#usage_opportunity").change(function() {
jQuery("#usage_opportunity").change(function() {
set_usage_opportunity();
});
set_usage_opportunity();
function set_usage_opportunity() {
console.log("set_usage_opportunity");
if (jQuery("#usage_opportunity").prop("checked")) {
console.log("Show opportunities fields");
jQuery(".classuseopportunity").show();
@ -919,9 +963,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
jQuery(".classuseopportunity").hide();
}
});
';
print '
};
});';
print '</script>';
print '<br>';
@ -930,12 +972,52 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '<input type="checkbox" id="usage_task" name="usage_task"' . (GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')) . '"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print '<label for="usage_task">'.$form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext).'</label>';
print '<script>';
print '$( document ).ready(function() {
jQuery("#usage_task").change(function() {
set_usage_task();
});
set_usage_task();
function set_usage_task() {
console.log("set_usage_task");
if (jQuery("#usage_task").prop("checked")) {
console.log("Show task fields");
jQuery(".classusetask").show();
} else {
console.log("Hide task fields "+jQuery("#usage_task").prop("checked"));
jQuery(".classusetask").hide();
}
};
});';
print '</script>';
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')) . '"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print '<label for="usage_bill_time">'.$form->textwithpicto($langs->trans("BillTime"), $htmltext).'</label>';
print '<script>';
print '$( document ).ready(function() {
jQuery("#usage_bill_time").change(function() {
set_usage_bill_time();
});
set_usage_bill_time();
function set_usage_bill_time() {
console.log("set_usage_bill_time");
if (jQuery("#usage_bill_time").prop("checked")) {
console.log("Show bill time fields");
jQuery(".classusebilltime").show();
} else {
console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
jQuery(".classusebilltime").hide();
}
};
});';
print '</script>';
print '<br>';
}
if (isModEnabled('eventorganization')) {
@ -944,7 +1026,14 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '<label for="usage_organize_event">'.$form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext).'</label>';
print '<script>';
print '$( document ).ready(function() {
jQuery("#usage_organize_event").change(function() {
jQuery("#usage_organize_event").change(function() {
set_usage_event();
});
set_usage_event();
function set_usage_event() {
console.log("set_usage_event");
if (jQuery("#usage_organize_event").prop("checked")) {
console.log("Show organize event fields");
jQuery(".classuseorganizeevent").show();
@ -952,9 +1041,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
jQuery(".classuseorganizeevent").hide();
}
});
';
print '
};
});';
print '</script>';
}
@ -1013,32 +1100,34 @@ if ($action == 'create' && $user->rights->projet->creer) {
// Opportunity status
print '<tr class="classuseopportunity'.$classfortr.'"><td>'.$langs->trans("OpportunityStatus").'</td>';
print '<td>';
print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'inline-block valignmiddle', 0, 1);
print '<div id="divtocloseproject" class="inline-block valign" style="display: none;"> &nbsp; &nbsp; ';
print '<input type="checkbox" id="inputcloseproject" name="closeproject" />';
print '<label for="inputcloseproject">'.$langs->trans("AlsoCloseAProject").'</label>';
print '</div>';
print '</td>';
print '</tr>';
print '<div>';
print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'inline-block valignmiddle', 1, 1);
// Opportunity probability
print '<tr class="classuseopportunity'.$classfortr.'"><td>'.$langs->trans("OpportunityProbability").'</td>';
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ?vatrate($object->opp_percent) : '')).'"> %';
print '<span id="oldopppercent"></span>';
print ' <input class="width50 right" type="text" id="opp_percent" name="opp_percent" title="'.dol_escape_htmltag($langs->trans("OpportunityProbability")).'" value="'.(GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ?vatrate($object->opp_percent) : '')).'"> %';
print '<span id="oldopppercent" class="opacitymedium"></span>';
print '</div>';
print '<div id="divtocloseproject" class="inline-block valign clearboth paddingtop" style="display: none;">';
print '<input type="checkbox" id="inputcloseproject" name="closeproject" />';
print '<label for="inputcloseproject">';
print $form->textwithpicto($langs->trans("AlsoCloseAProject"), $langs->trans("AlsoCloseAProjectTooltip")).'</label>';
print ' </div>';
print '</td>';
print '</tr>';
// Opportunity amount
print '<tr class="classuseopportunity'.$classfortr.'"><td>'.$langs->trans("OpportunityAmount").'</td>';
print '<td><input size="5" type="text" name="opp_amount" value="'.(GETPOSTISSET('opp_amount') ? GETPOST('opp_amount') : (strcmp($object->opp_amount, '') ? price2num($object->opp_amount) : '')).'">';
print '<td><input class="width75 right" type="text" name="opp_amount" value="'.(GETPOSTISSET('opp_amount') ? GETPOST('opp_amount') : (strcmp($object->opp_amount, '') ? price2num($object->opp_amount) : '')).'">';
print $langs->getCurrencySymbol($conf->currency);
print '</td>';
print '</tr>';
}
// Budget
print '<tr><td>'.$langs->trans("Budget").'</td>';
print '<td><input size="5" type="text" name="budget_amount" value="'.(GETPOSTISSET('budget_amount') ? GETPOST('budget_amount') : (strcmp($object->budget_amount, '') ? price2num($object->budget_amount) : '')).'">';
print '<tr class="classusetask classusebilltime"><td>'.$langs->trans("Budget").'</td>';
print '<td><input class="width75 right" type="text" name="budget_amount" value="'.(GETPOSTISSET('budget_amount') ? GETPOST('budget_amount') : (strcmp($object->budget_amount, '') ? price2num($object->budget_amount) : '')).'">';
print $langs->getCurrencySymbol($conf->currency);
print '</td>';
print '</tr>';
@ -1180,14 +1269,13 @@ if ($action == 'create' && $user->rights->projet->creer) {
if ($code) {
print $langs->trans("OppStatus".$code);
}
print '</td></tr>';
// Opportunity percent
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
print ' <span title="'.$langs->trans("OpportunityProbability").'"> / ';
if (strcmp($object->opp_percent, '')) {
print price($object->opp_percent, 0, $langs, 1, 0).' %';
}
print '</td></tr>';
print '</span></td></tr>';
// Opportunity Amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
@ -1268,6 +1356,25 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '</form>';
// Set also dependencies between use taks and bill time
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#usage_task").change(function() {
console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
if (! jQuery("#usage_task").is(":checked")) {
jQuery("#usage_bill_time").prop("checked", false);
}
});
jQuery("#usage_bill_time").change(function() {
console.log("We click on usage to bill time");
if (jQuery("#usage_bill_time").is(":checked")) {
jQuery("#usage_task").prop("checked", true);
}
});
});
</script>';
// Change probability from status
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
// Default value to close or not when we set opp to 'WON'.
@ -1308,19 +1415,23 @@ if ($action == 'create' && $user->rights->projet->creer) {
}
/* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
console.log("oldpercent="+oldpercent);
if (oldpercent != \'\' && (parseFloat(defaultpercent) < parseFloat(oldpercent)))
{
if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->transnoentities("PreviousValue")).': \'+oldpercent+\' %\');
if (parseFloat(oldpercent) != 100) { jQuery("#opp_percent").val(oldpercent); }
else { jQuery("#opp_percent").val(defaultpercent); }
console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent+" def < old");
if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->transnoentities("PreviousValue")).': \'+price2numjs(oldpercent)+\' %\');
}
if (parseFloat(oldpercent) != 100 && elemcode != \'LOST\') { jQuery("#opp_percent").val(oldpercent); }
else { jQuery("#opp_percent").val(price2numjs(defaultpercent)); }
}
else
{
console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent);
if ((parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent)));
{
if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->transnoentities("PreviousValue")).': \'+oldpercent+\' %\');
jQuery("#opp_percent").val(defaultpercent);
if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->transnoentities("PreviousValue")).': \'+price2numjs(oldpercent)+\' %\');
jQuery("#opp_percent").val(price2numjs(defaultpercent));
}
}
}