Skip to content

Commit

Permalink
Merge branch '3.5' of git@github.com:Dolibarr/dolibarr.git into 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
FHenry committed May 19, 2014
2 parents 5a5c858 + 5641540 commit ff1eb98
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 36 deletions.
41 changes: 20 additions & 21 deletions htdocs/admin/boxes.php
Expand Up @@ -57,7 +57,7 @@

$db->begin();

// Initialize distinctfkuser with all already existing values of fk_user (user that use a personalized view of boxes for pos)
// Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos")
$distinctfkuser=array();
if (! $error)
{
Expand Down Expand Up @@ -85,14 +85,31 @@
}
}

$distinctfkuser['0']='0'; // Add entry for fk_user = 0. We must use string as key and val

foreach($distinctfkuser as $fk_user)
{
if (! $error && $fk_user != 0) // We will add fk_user = 0 later.
if (! $error && $fk_user != '')
{
$nbboxonleft=$nbboxonright=0;
$sql = "SELECT box_order FROM ".MAIN_DB_PREFIX."boxes WHERE position = ".GETPOST("pos","alpha")." AND fk_user = ".$fk_user." AND entity = ".$conf->entity;
dol_syslog("boxes.php activate box sql=".$sql);
$resql = $db->query($sql);
if ($resql)
{
while($obj = $db->fetch_object($resql))
{
$boxorder=$obj->box_order;
if (preg_match('/A/',$boxorder)) $nbboxonleft++;
if (preg_match('/B/',$boxorder)) $nbboxonright++;
}
}
else dol_print_error($db);

$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
$sql.= "box_id, position, box_order, fk_user, entity";
$sql.= ") values (";
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', ".$fk_user.", ".$conf->entity;
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
$sql.= ")";

dol_syslog("boxes.php activate box sql=".$sql);
Expand All @@ -105,24 +122,6 @@
}
}

// If value 0 was not included, we add it.
if (! $error)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
$sql.= "box_id, position, box_order, fk_user, entity";
$sql.= ") values (";
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', 0, ".$conf->entity;
$sql.= ")";

dol_syslog("boxes.php activate box sql=".$sql);
$resql = $db->query($sql);
if (! $resql)
{
$errmesg=$db->lasterror();
$error++;
}
}

if (! $error)
{
header("Location: boxes.php");
Expand Down
2 changes: 1 addition & 1 deletion test/phpunit/CategorieTest.php
Expand Up @@ -336,4 +336,4 @@ public function testCategorieStatic()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/CompanyBankAccountTest.php
Expand Up @@ -233,4 +233,4 @@ public function testCompanyBankAccountOther($localobject)
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/CoreTest.php
Expand Up @@ -297,4 +297,4 @@ function test_sql_and_script_inject($val, $type)
$this->assertEquals($result,$expectedresult);
}
}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/DateLibTzFranceTest.php
Expand Up @@ -199,4 +199,4 @@ public function testDolPrintDateTzFrance()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/ExportTest.php
Expand Up @@ -265,4 +265,4 @@ public function testExportModulesDatasets()
return true;
}
}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/FactureTest.php
Expand Up @@ -329,4 +329,4 @@ public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('
return $retAr;
}
}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/FactureTestRounding.php
Expand Up @@ -333,4 +333,4 @@ public function testFactureAddLine3()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/ImportTest.php
Expand Up @@ -134,4 +134,4 @@ public function testImportSample1()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/JsonLibTest.php
Expand Up @@ -170,4 +170,4 @@ public function testJsonEncode()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/ModulesTest.php
Expand Up @@ -146,4 +146,4 @@ public function testModulesInit()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/PropalTest.php
Expand Up @@ -287,4 +287,4 @@ public function testVerifyNumRef()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/WebservicesInvoicesTest.php
Expand Up @@ -176,4 +176,4 @@ public function testWSInvoicesXxx()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/WebservicesOrdersTest.php
Expand Up @@ -175,4 +175,4 @@ public function testWSOrderXxx()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/WebservicesOtherTest.php
Expand Up @@ -176,4 +176,4 @@ public function testWSOtherGetVersions()
}

}
?>
?>
2 changes: 1 addition & 1 deletion test/phpunit/WebservicesThirdpartyTest.php
Expand Up @@ -176,4 +176,4 @@ public function testWSThirdpartyXxx()
}

}
?>
?>

0 comments on commit ff1eb98

Please sign in to comment.