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

Fix: No new inside a constructor method.

parent ff6368b3
No related branches found
No related tags found
No related merge requests found
......@@ -121,7 +121,7 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // R
if ($id)
{
$project->fetch($id);
$project->societe->fetch($project->societe->id);
$project->fetch_thirdparty();
}
$tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0); // We want to see all task of project i am allowed to see, not only mine. Later only mine will be editable later.
......
......@@ -53,7 +53,6 @@ class Project extends CommonObject
var $statuts;
var $oldcopy;
/**
* Constructor
*
......@@ -62,7 +61,6 @@ class Project extends CommonObject
function __construct($db)
{
$this->db = $db;
$this->societe = new Societe($db);
$this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
$this->statuts = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
......@@ -982,6 +980,7 @@ class Project extends CommonObject
// Load source object
$clone_project->fetch($fromid);
$clone_project->fetch_thirdparty();
$orign_dt_start=$clone_project->date_start;
$orign_project_ref=$clone_project->ref;
......@@ -1009,7 +1008,7 @@ class Project extends CommonObject
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.'.php';
$modProject = new $obj;
$defaultref = $modProject->getNextValue($clone_project->societe->id,$clone_project);
$defaultref = $modProject->getNextValue(is_object($clone_project->thirdparty)?$clone_project->thirdparty->id:0,$clone_project);
}
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
......
......@@ -89,7 +89,7 @@ $userstatic=new User($db);
$project = new Project($db);
$project->fetch($projectid,$ref);
$project->societe->fetch($project->societe->id);
$project->fetch_thirdparty();
// To verify role of users
$userAccess = $project->restrictedProjectArea($user);
......@@ -115,7 +115,7 @@ print '</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$project->title.'</td></tr>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($project->societe->id)) print $project->societe->getNomUrl(1);
if (! empty($project->thirdparty->id)) print $project->thirdparty->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';
......@@ -229,7 +229,7 @@ foreach ($listofreferent as $key => $value)
print_titre($langs->trans($title));
$selectList=$formproject->select_element($tablename,$project->societe->id);
$selectList=$formproject->select_element($tablename,$project->thirdparty->id);
if (!$selectList || ($selectList<0)) {
setEventMessage($formproject->error,'errors');
......@@ -244,7 +244,7 @@ foreach ($listofreferent as $key => $value)
print '</form>';
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans("Ref").'</td>';
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
......@@ -272,7 +272,7 @@ foreach ($listofreferent as $key => $value)
{
if ($element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice
}
$var=!$var;
print "<tr ".$bc[$var].">";
......@@ -294,7 +294,7 @@ foreach ($listofreferent as $key => $value)
print '</td>';
// Amount
if (empty($value['disableamount']))
if (empty($value['disableamount']))
{
print '<td align="right">';
if (! $qualifiedfortotal) print '<strike>';
......@@ -304,7 +304,7 @@ foreach ($listofreferent as $key => $value)
}
// Amount
if (empty($value['disableamount']))
if (empty($value['disableamount']))
{
print '<td align="right">';
if (! $qualifiedfortotal) print '<strike>';
......@@ -341,30 +341,30 @@ foreach ($listofreferent as $key => $value)
if ($project->statut > 0)
{
if ($project->societe->prospect || $project->societe->client)
if ($project->thirdparty->prospect || $project->thirdparty->client)
{
if ($key == 'propal' && ! empty($conf->propal->enabled) && $user->rights->propale->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$project->societe->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddProp").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$project->thirdparty->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddProp").'</a>';
}
if ($key == 'order' && ! empty($conf->commande->enabled) && $user->rights->commande->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?socid='.$project->societe->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddCustomerOrder").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?socid='.$project->thirdparty->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddCustomerOrder").'</a>';
}
if ($key == 'invoice' && ! empty($conf->facture->enabled) && $user->rights->facture->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$project->societe->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddCustomerInvoice").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$project->thirdparty->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddCustomerInvoice").'</a>';
}
}
if ($project->societe->fournisseur)
if ($project->thirdparty->fournisseur)
{
if ($key == 'order_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?socid='.$project->societe->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?socid='.$project->thirdparty->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
}
if ($key == 'invoice_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?socid='.$project->societe->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?socid='.$project->thirdparty->id.'&amp;action=create&amp;origin='.$project->element.'&amp;originid='.$project->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment