diff --git a/htdocs/partnership/partnershipindex.php b/htdocs/partnership/partnershipindex.php
index 8076f105dbb..536729a473d 100644
--- a/htdocs/partnership/partnershipindex.php
+++ b/htdocs/partnership/partnershipindex.php
@@ -25,35 +25,7 @@
*/
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@@ -100,8 +72,7 @@ print '
';
/* BEGIN MODULEBUILDER DRAFT MYOBJECT
// Draft MyObject
-if (! empty($conf->partnership->enabled) && $user->rights->partnership->read)
-{
+if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) {
$langs->load("orders");
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
@@ -116,8 +87,7 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read)
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$total = 0;
$num = $db->num_rows($resql);
@@ -126,12 +96,9 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read)
print '
'.$langs->trans("DraftMyObjects").($num?''.$num.'':'').' | ';
$var = true;
- if ($num > 0)
- {
+ if ($num > 0) {
$i = 0;
- while ($i < $num)
- {
-
+ while ($i < $num) {
$obj = $db->fetch_object($resql);
print '| ';
@@ -150,23 +117,16 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read)
$i++;
$total += $obj->total_ttc;
}
- if ($total>0)
- {
-
+ if ($total>0) {
print ' |
| '.$langs->trans("Total").' | '.price($total)." |
";
}
- }
- else
- {
-
+ } else {
print '| '.$langs->trans("NoOrder").' |
';
}
print "
";
$db->free($resql);
- }
- else
- {
+ } else {
dol_print_error($db);
}
}
@@ -181,8 +141,7 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
// Last modified myobject
-if (! empty($conf->partnership->enabled) && $user->rights->partnership->read)
-{
+if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) {
$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."partnership_myobject as s";
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -193,8 +152,7 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read)
$sql .= $db->plimit($max, 0);
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
@@ -205,10 +163,8 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read)
print '';
print ''.$langs->trans("DateModificationShort").' | ';
print '';
- if ($num)
- {
- while ($i < $num)
- {
+ if ($num) {
+ while ($i < $num) {
$objp = $db->fetch_object($resql);
$myobjectstatic->id=$objp->rowid;