Fix: le montant total était mal mis à jour à cause du champs "remise"

Ajax: début ajout message de confirmation de suppression ou autre afin d'éviter de recharger la page
This commit is contained in:
Regis Houssin 2007-08-04 11:51:43 +00:00
parent 0afb6f1e30
commit db1a69e232
2 changed files with 78 additions and 91 deletions

View File

@ -1414,21 +1414,23 @@ if ($_GET['propalid'] > 0)
/* /*
* Formulaire cloture (signé ou non) * Formulaire cloture (signé ou non)
*/ */
$form_close = '<tr><td>'.$langs->trans('Note').'</td><td><textarea cols="70" rows="'.ROWS_3.'" wrap="soft" name="note">';
$form_close.= $propal->note;
$form_close.= '</textarea></td></tr>';
$form_close.= '<tr><td>'.$langs->trans("CloseAs").'</td><td>';
$form_close.= '<input type="hidden" name="action" value="setstatut">';
$form_close.= '<select name="statut">';
$form_close.= '<option value="0">&nbsp;</option>';
$form_close.= '<option value="2">'.$propal->labelstatut[2].'</option>';
$form_close.= '<option value="3">'.$propal->labelstatut[3].'</option>';
$form_close.= '</select>';
$form_close.= '</td></tr>';
if ($_GET['action'] == 'statut') if ($_GET['action'] == 'statut')
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'" method="post">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans('Note').'</td><td><textarea cols="70" rows="'.ROWS_3.'" wrap="soft" name="note">'; print $form_close;
print $propal->note;
print '</textarea></td></tr>';
print '<tr><td>'.$langs->trans("CloseAs").'</td><td>';
print '<input type="hidden" name="action" value="setstatut">';
print '<select name="statut">';
print '<option value="0">&nbsp;</option>';
print '<option value="2">'.$propal->labelstatut[2].'</option>';
print '<option value="3">'.$propal->labelstatut[3].'</option>';
print '</select>';
print '</td></tr>';
print '<tr><td align="center" colspan="2">'; print '<tr><td align="center" colspan="2">';
print '<input type="submit" class="button" name="validate" value="'.$langs->trans('Validate').'">'; print '<input type="submit" class="button" name="validate" value="'.$langs->trans('Validate').'">';
print ' &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">'; print ' &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
@ -1446,9 +1448,7 @@ if ($_GET['propalid'] > 0)
{ {
// Valid // Valid
if ($propal->statut == 0) if ($propal->statut == 0 && $propal->total_ttc > 0 && $user->rights->propale->valider)
{
if ($user->rights->propale->valider && $propal->total_ttc > 0)
{ {
print '<a class="butAction" '; print '<a class="butAction" ';
if ($conf->use_ajax) if ($conf->use_ajax)
@ -1462,16 +1462,12 @@ if ($_GET['propalid'] > 0)
} }
print '>'.$langs->trans('Validate').'</a>'; print '>'.$langs->trans('Validate').'</a>';
} }
}
// Edit // Edit
if ($propal->statut == 1) if ($propal->statut == 1 && $user->rights->propale->creer)
{
if ($user->rights->propale->creer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&amp;action=modif">'.$langs->trans('Edit').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&amp;action=modif">'.$langs->trans('Edit').'</a>';
} }
}
// Build PDF // Build PDF
if ($user->rights->propale->creer) if ($user->rights->propale->creer)
@ -1487,9 +1483,7 @@ if ($_GET['propalid'] > 0)
} }
// Send // Send
if ($propal->statut == 1) if ($propal->statut == 1 && $user->rights->propale->envoyer)
{
if ($user->rights->propale->envoyer)
{ {
$propref = sanitize_string($propal->ref); $propref = sanitize_string($propal->ref);
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf'; $file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
@ -1498,21 +1492,15 @@ if ($_GET['propalid'] > 0)
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&amp;action=presend">'.$langs->trans('SendByMail').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&amp;action=presend">'.$langs->trans('SendByMail').'</a>';
} }
} }
}
// Close // Close
if ($propal->statut != 0)
{
if ($propal->statut == 1 && $user->rights->propale->cloturer) if ($propal->statut == 1 && $user->rights->propale->cloturer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&amp;action=statut">'.$langs->trans('Close').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&amp;action=statut">'.$langs->trans('Close').'</a>';
} }
}
// Delete // Delete
if ($propal->statut == 0) if ($propal->statut == 0 && $user->rights->propale->supprimer)
{
if ($user->rights->propale->supprimer)
{ {
print '<a class="butActionDelete" '; print '<a class="butActionDelete" ';
if ($conf->use_ajax) if ($conf->use_ajax)
@ -1526,7 +1514,6 @@ if ($_GET['propalid'] > 0)
} }
print '>'.$langs->trans('Delete').'</a>'; print '>'.$langs->trans('Delete').'</a>';
} }
}
} }

View File

@ -621,7 +621,7 @@ class Propal extends CommonObject
$sql .= " total_ht=".price2num($this->total_ht).","; $sql .= " total_ht=".price2num($this->total_ht).",";
$sql .= " tva=". price2num($this->total_tva).","; $sql .= " tva=". price2num($this->total_tva).",";
$sql .= " total=". price2num($this->total_ttc).","; $sql .= " total=". price2num($this->total_ttc).",";
$sql .= " remise=". price2num($this->total_remise).","; // \TODO A virer //$sql .= " remise=". price2num($this->total_remise).","; // \TODO A virer
$sql .= " price=". price2num($this->total_ht); // \TODO A virer $sql .= " price=". price2num($this->total_ht); // \TODO A virer
$sql .=" WHERE rowid = ".$this->id; $sql .=" WHERE rowid = ".$this->id;