Skip to content
Snippets Groups Projects
Commit 2ddc3cb3 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Using a select with checkbox will not be compatible when we will

add feature to put box on other pages.
parent 58621e7e
Branches
Tags
No related merge requests found
...@@ -46,17 +46,20 @@ $boxes = array(); ...@@ -46,17 +46,20 @@ $boxes = array();
*/ */
if ($action == 'addconst') if ($action == 'addconst')
{ {
dolibarr_set_const($db, "MAIN_BOXES_MAXLINES",$_POST["MAIN_BOXES_MAXLINES"],'',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_BOXES_MAXLINES",$_POST["MAIN_BOXES_MAXLINES"],'',0,'',$conf->entity);
} }
if ($action == 'add') { if ($action == 'add')
{
$error=0; $error=0;
$db->begin(); $db->begin();
if (isset($_POST['boxid']) && is_array($_POST['boxid'])) { if (isset($_POST['boxid']) && is_array($_POST['boxid']))
foreach($_POST['boxid'] as $boxid) { {
if ($boxid['active']=='on') { foreach($_POST['boxid'] as $boxid)
{
if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) // 0=Home, 1=...
{
$pos = $boxid['pos']; $pos = $boxid['pos'];
// Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos") // Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos")
...@@ -330,7 +333,7 @@ print '<tr class="liste_titre">'; ...@@ -330,7 +333,7 @@ print '<tr class="liste_titre">';
print '<td width="300">'.$langs->trans("Box").'</td>'; print '<td width="300">'.$langs->trans("Box").'</td>';
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>'; print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
print '<td>'.$langs->trans("SourceFile").'</td>'; print '<td>'.$langs->trans("SourceFile").'</td>';
print '<td class="center" width="160">'.$langs->trans("ActivateOn").'</td>'; print '<td width="160" align="center">'.$langs->trans("ActivateOn").'</td>';
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
foreach($boxtoadd as $box) foreach($boxtoadd as $box)
...@@ -363,17 +366,17 @@ foreach($boxtoadd as $box) ...@@ -363,17 +366,17 @@ foreach($boxtoadd as $box)
// Pour chaque position possible, on affiche un lien d'activation si boite non deja active pour cette position // Pour chaque position possible, on affiche un lien d'activation si boite non deja active pour cette position
print '<td class="center">'; print '<td class="center">';
print $form->selectarray("boxid[".$box->box_id."][pos]",$pos_name,0,0,0,0,'',1)."\n"; print $form->selectarray("boxid[".$box->box_id."][pos]", $pos_name, 0, 1, 0, 0, '', 1)."\n";
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n"; print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
print '<input type="checkbox" class="flat" name="boxid['.$box->box_id.'][active]">'."\n"; //print '<input type="checkbox" class="flat" name="boxid['.$box->box_id.'][active]">'."\n";
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
} }
print '</table>'."\n"; print '</table>'."\n";
print '<br><div class="right">'; print '<div class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Activate").'">'; print '<input type="submit" class="button"'.(count($boxtoadd)?'':' disabled="disabled"').' value="'.$langs->trans("Activate").'">';
print '</div>'."\n"; print '</div>'."\n";
print '</form>'; print '</form>';
print "\n".'<!-- End Boxes Available -->'."\n"; print "\n".'<!-- End Boxes Available -->'."\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment