Fix: form must not be into a closing and opening tr tag.

This commit is contained in:
Laurent Destailleur 2014-09-26 13:23:54 +02:00
parent 8e95f2e223
commit 722e939e19
2 changed files with 86 additions and 68 deletions

View File

@ -371,11 +371,11 @@ else if ($action == 'add' && $user->rights->commande->creer) {
// If some invoice's lines already known
$NBLINES = 8;
for($i = 1; $i <= $NBLINES; $i ++) {
if ($_POST ['idprod' . $i]) {
if ($_POST['idprod' . $i]) {
$xid = 'idprod' . $i;
$xqty = 'qty' . $i;
$xremise = 'remise_percent' . $i;
$object->add_product($_POST [$xid], $_POST [$xqty], $_POST [$xremise]);
$object->add_product($_POST[$xid], $_POST[$xqty], $_POST[$xremise]);
}
}
}
@ -546,7 +546,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
if (is_array($extralabelsline)) {
// Get extra fields
foreach ($extralabelsline as $key => $value) {
unset($_POST ["options_" . $key]);
unset($_POST["options_" . $key]);
}
}
@ -725,23 +725,23 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST ['prod_entry_mode']);
unset($_POST['prod_entry_mode']);
unset($_POST ['qty']);
unset($_POST ['type']);
unset($_POST ['remise_percent']);
unset($_POST ['price_ht']);
unset($_POST ['price_ttc']);
unset($_POST ['tva_tx']);
unset($_POST ['product_ref']);
unset($_POST ['product_label']);
unset($_POST ['product_desc']);
unset($_POST ['fournprice']);
unset($_POST ['buying_price']);
unset($_POST ['np_marginRate']);
unset($_POST ['np_markRate']);
unset($_POST ['dp_desc']);
unset($_POST ['idprod']);
unset($_POST['qty']);
unset($_POST['type']);
unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
unset($_POST['product_ref']);
unset($_POST['product_label']);
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST['np_marginRate']);
unset($_POST['np_markRate']);
unset($_POST['dp_desc']);
unset($_POST['idprod']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
@ -796,7 +796,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
// Unset extrafield POST Data
if (is_array($extralabelsline)) {
foreach ($extralabelsline as $key => $value) {
unset($_POST ["options_" . $key]);
unset($_POST["options_" . $key]);
}
}
@ -850,18 +850,18 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST ['qty']);
unset($_POST ['type']);
unset($_POST ['productid']);
unset($_POST ['remise_percent']);
unset($_POST ['price_ht']);
unset($_POST ['price_ttc']);
unset($_POST ['tva_tx']);
unset($_POST ['product_ref']);
unset($_POST ['product_label']);
unset($_POST ['product_desc']);
unset($_POST ['fournprice']);
unset($_POST ['buying_price']);
unset($_POST['qty']);
unset($_POST['type']);
unset($_POST['productid']);
unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
unset($_POST['product_ref']);
unset($_POST['product_label']);
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
} else {
setEventMessage($object->error, 'errors');
}
@ -1699,6 +1699,8 @@ if ($action == 'create' && $user->rights->commande->creer) {
$author = new User($db);
$author->fetch($object->user_author_id);
$res = $object->fetch_optionals($object->id, $extralabels);
$head = commande_prepare_head($object);
dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), 0, 'order');
@ -2120,30 +2122,38 @@ if ($action == 'create' && $user->rights->commande->creer) {
}
// Other attributes (TODO Move this into an include)
$res = $object->fetch_optionals($object->id, $extralabels);
$parameters = array('colspan' => ' colspan="3"');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
// hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
foreach ($extrafields->attribute_label as $key => $label) {
if ($action == 'edit_extras') {
$value = (isset($_POST ["options_" . $key]) ? $_POST ["options_" . $key] : $object->array_options ["options_" . $key]);
} else {
$value = $object->array_options ["options_" . $key];
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
foreach ($extrafields->attribute_label as $key => $label)
{
if ($action == 'edit_extras')
{
$value = (isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
}
if ($extrafields->attribute_type [$key] == 'separate') {
else
{
$value = $object->array_options["options_" . $key];
}
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
} else {
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required [$key]))
print ' class="fieldrequired"';
if (! empty($extrafields->attribute_required [$key])) print ' class="fieldrequired"';
print '>' . $label . '</td><td colspan="5">';
// Convert date into timestamp format
if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) {
$value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
if (in_array($extrafields->attribute_type [$key], array('date','datetime')))
{
$value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
}
if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key) {
if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key)
{
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formsoc">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">';
@ -2154,7 +2164,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
}
else
{
print $extrafields->showOutputField($key, $value);
if ($object->statut == 0 && $user->rights->commande->creer)
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';

View File

@ -1188,19 +1188,20 @@ if ($action=="create")
}
elseif (! empty($object->id))
{
$author = new User($db);
$author->fetch($object->user_author_id);
$societe = new Fournisseur($db);
$result=$societe->fetch($object->socid);
if ($result < 0) dol_print_error($db);
$author = new User($db);
$author->fetch($object->user_author_id);
$res=$object->fetch_optionals($object->id,$extralabels);
$head = ordersupplier_prepare_head($object);
$title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'card', $title, 0, 'order');
$res=$object->fetch_optionals($object->id,$extralabels);
/*
* Confirmation de la suppression de la commande
@ -1482,24 +1483,19 @@ elseif (! empty($object->id))
print '</tr>';
}
// Other attributes
// Other attributes (TODO Move this into an include)
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
if ($action == 'edit_extras')
{
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
}
foreach($extrafields->attribute_label as $key=>$label)
{
if ($action == 'edit_extras') {
if ($action == 'edit_extras')
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
} else {
}
else
{
$value=$object->array_options["options_".$key];
}
@ -1518,15 +1514,25 @@ elseif (! empty($object->id))
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]);
}
if ($action == 'edit_extras' && $user->rights->fournisseur->commande->creer)
if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key)
{
print $extrafields->showInputField($key,$value);
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formsoc">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value);
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
}
else
{
print $extrafields->showOutputField($key,$value);
print $extrafields->showOutputField($key, $value);
if ($object->statut == 0 && $user->rights->commande->creer)
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
}
print '</td></tr>'."\n";
}
}