Qual: doxygen

Fix: Preselected field was not selected
This commit is contained in:
Laurent Destailleur 2011-11-13 00:49:40 +01:00
parent 37b8f855e1
commit 40a4bcec04
4 changed files with 68 additions and 64 deletions

View File

@ -32,6 +32,8 @@ $langs->load("orders");
$langs->load("bills");
$langs->load("companies");
$action=GETPOST('action');
// Security check
$socid = GETPOST("id");
if ($user->societe_id > 0)
@ -50,7 +52,7 @@ if (GETPOST('cancel') && GETPOST('backtopage'))
exit;
}
if (GETPOST("action") == 'confirm_split' && GETPOST("confirm") == 'yes')
if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
{
//if ($user->rights->societe->creer)
//if ($user->rights->facture->creer)
@ -127,7 +129,7 @@ if (GETPOST("action") == 'confirm_split' && GETPOST("confirm") == 'yes')
}
}
if (GETPOST("action") == 'setremise')
if ($action == 'setremise')
{
//if ($user->rights->societe->creer)
//if ($user->rights->facture->creer)
@ -145,13 +147,13 @@ if (GETPOST("action") == 'setremise')
{
$soc = new Societe($db);
$soc->fetch($_GET["id"]);
$soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]);
$discountid=$soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]);
if ($result > 0)
if ($discountid > 0)
{
if (GETPOST("backtopage"))
{
Header("Location: ".GETPOST("backtopage"));
Header("Location: ".GETPOST("backtopage").'&discountid='.$discountid);
exit;
}
else

View File

@ -2225,12 +2225,12 @@ else
// Remise dispo de type remise fixe (not credit note)
$filter='fk_facture_source IS NULL';
print '<br>';
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' ('.$addabsolutediscount.')');
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $soc->id, $absolute_discount, $filter, $resteapayer, ' ('.$addabsolutediscount.')');
}
}
else
{
if ($absolute_creditnote > 0) // If not linke will be added later
if ($absolute_creditnote > 0) // If not, link will be added later
{
if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' ('.$addabsolutediscount.')<br>';
else print '.';

View File

@ -2701,17 +2701,17 @@ class Form
/**
* Show a select box with available absolute discounts
* Show a select box with available absolute discounts
*
* @param page Page URL where form is shown
* @param selected Value pre-selected
* @param htmlname Nom du formulaire select. Si none, non modifiable
* @param socid Third party id
* @param amount Total amount available
* @param filter SQL filter on discounts
* @param maxvalue Max value for lines that can be selected
* @param more More string to add
* @return void
* @param string $page Page URL where form is shown
* @param int $selected Value pre-selected
* @param string $htmlname Nom du formulaire select. Si none, non modifiable
* @param int $socid Third party id
* @param float $amount Total amount available
* @param string $filter SQL filter on discounts
* @param int $maxvalue Max value for lines that can be selected
* @param string $more More string to add
* @return void
*/
function form_remise_dispo($page, $selected='', $htmlname='remise_id',$socid, $amount, $filter='', $maxvalue=0, $more='')
{
@ -2725,10 +2725,9 @@ class Form
print '<tr><td nowrap="nowrap">';
if (! $filter || $filter=='fk_facture_source IS NULL') print $langs->trans("CompanyHasAbsoluteDiscount",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': ';
else print $langs->trans("CompanyHasCreditNote",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': ';
// print $langs->trans("AvailableGlobalDiscounts").': ';
$newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles
if ($filter) $newfilter.=' AND '.$filter;
$nbqualifiedlines=$this->select_remises('',$htmlname,$newfilter,$socid,$maxvalue);
$nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue);
print '</td>';
print '<td>';
if ($nbqualifiedlines > 0)

View File

@ -1217,17 +1217,18 @@ class Societe extends CommonObject
/**
* Add a discount for third party
* @param remise Montant de la remise
* @param user Utilisateur qui accorde la remise
* @param desc Motif de l'avoir
* @param tva_tx VAT rate
* @return int <0 if KO, id or record if OK
*
* @param float $remise Amount of discount
* @param User $user User adding discount
* @param string $desc Reason of discount
* @param float $tva_tx VAT rate
* @return int <0 if KO, id of discount record if OK
*/
function set_remise_except($remise, $user, $desc, $tva_tx=0)
{
global $langs;
// Nettoyage des parametres
// Clean parameters
$remise = price2num($remise);
$desc = trim($desc);
@ -1269,11 +1270,12 @@ class Societe extends CommonObject
}
/**
* \brief Renvoie montant TTC des reductions/avoirs en cours disponibles de la societe
* \param user Filtre sur un user auteur des remises
* \param filter Filtre autre
* \param maxvalue Filter on max value for discount
* \return int <0 if KO, Credit note amount otherwise
* Renvoie montant TTC des reductions/avoirs en cours disponibles de la societe
*
* @param User $user Filtre sur un user auteur des remises
* @param string $filter Filtre autre
* @param string $maxvalue Filter on max value for discount
* @return int <0 if KO, Credit note amount otherwise
*/
function getAvailableDiscounts($user='',$filter='',$maxvalue=0)
{
@ -1294,6 +1296,7 @@ class Societe extends CommonObject
/**
* Return array of sales representatives
*
* @return array Array of sales representatives of third party
*/
function getSalesRepresentatives($user='')
@ -1331,8 +1334,8 @@ class Societe extends CommonObject
/**
* Set the price level
*
* @param $price_level
* @param $user
* @param int $price_level Level of price
* @param User $user Use making change
*/
function set_price_level($price_level, $user)
{