Fix form outside table

This commit is contained in:
Laurent Destailleur 2015-08-28 00:29:46 +02:00
parent 39cbd7629f
commit 6624182361
2 changed files with 32 additions and 25 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -99,6 +99,13 @@ if ($socid > 0)
$head = societe_prepare_head($objsoc); $head = societe_prepare_head($objsoc);
print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company');
@ -119,11 +126,6 @@ if ($socid > 0)
print_fiche_titre($langs->trans("NewRelativeDiscount"),'',''); print_fiche_titre($langs->trans("NewRelativeDiscount"),'','');
print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Nouvelle valeur // Nouvelle valeur
@ -136,6 +138,8 @@ if ($socid > 0)
print "</table>"; print "</table>";
dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
if (! empty($backtopage)) if (! empty($backtopage))
@ -147,8 +151,6 @@ if ($socid > 0)
print "</form>"; print "</form>";
dol_fiche_end();
print '<br>'; print '<br>';

View File

@ -221,14 +221,14 @@ if ($socid > 0)
*/ */
$head = societe_prepare_head($objsoc); $head = societe_prepare_head($objsoc);
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">'; print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Name // Name
@ -278,6 +278,8 @@ if ($socid > 0)
print "</table>"; print "</table>";
dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">'; print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
if (! empty($backtopage)) if (! empty($backtopage))
@ -289,7 +291,6 @@ if ($socid > 0)
print '</form>'; print '</form>';
dol_fiche_end();
print '<br>'; print '<br>';
@ -329,8 +330,10 @@ if ($socid > 0)
print '<td width="50">&nbsp;</td>'; print '<td width="50">&nbsp;</td>';
print '</tr>'; print '</tr>';
$showconfirminfo=array();
$var = true; $var = true;
$i = 0 ; $i = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ($i < $num) while ($i < $num)
{ {
@ -382,24 +385,26 @@ if ($socid > 0)
if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid) if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid)
{ {
print "<tr ".$bc[$var].">"; $showconfirminfo['rowid']=$obj->rowid;
print '<td colspan="8">'; $showconfirminfo['amount_ttc']=$obj->amount_ttc;
$amount1=price2num($obj->amount_ttc/2,'MT');
$amount2=($obj->amount_ttc-$amount1);
$formquestion=array(
'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
);
$langs->load("dict");
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$obj->rowid, $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($obj->amount_ttc),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
print '</td>';
print '</tr>';
} }
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
print "</table>"; print "</table>";
if (count($showconfirminfo))
{
$amount1=price2num($showconfirminfo['amount_ttc']/2,'MT');
$amount2=($showconfirminfo['amount_ttc']-$amount1);
$formquestion=array(
'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
);
$langs->load("dict");
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
}
} }
else else
{ {