Fix: No new inside a constructor method.
This commit is contained in:
parent
ff6368b39f
commit
fc02f0f08f
@ -121,7 +121,7 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // R
|
|||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$project->fetch($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.
|
$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 $statuts;
|
||||||
var $oldcopy;
|
var $oldcopy;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -62,7 +61,6 @@ class Project extends CommonObject
|
|||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->societe = new Societe($db);
|
|
||||||
|
|
||||||
$this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
|
$this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
|
||||||
$this->statuts = 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
|
// Load source object
|
||||||
$clone_project->fetch($fromid);
|
$clone_project->fetch($fromid);
|
||||||
|
$clone_project->fetch_thirdparty();
|
||||||
|
|
||||||
$orign_dt_start=$clone_project->date_start;
|
$orign_dt_start=$clone_project->date_start;
|
||||||
$orign_project_ref=$clone_project->ref;
|
$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';
|
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.'.php';
|
||||||
$modProject = new $obj;
|
$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='';
|
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
|
||||||
|
|||||||
@ -89,7 +89,7 @@ $userstatic=new User($db);
|
|||||||
|
|
||||||
$project = new Project($db);
|
$project = new Project($db);
|
||||||
$project->fetch($projectid,$ref);
|
$project->fetch($projectid,$ref);
|
||||||
$project->societe->fetch($project->societe->id);
|
$project->fetch_thirdparty();
|
||||||
|
|
||||||
// To verify role of users
|
// To verify role of users
|
||||||
$userAccess = $project->restrictedProjectArea($user);
|
$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("Label").'</td><td>'.$project->title.'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
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 ' ';
|
else print ' ';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
|
|
||||||
print_titre($langs->trans($title));
|
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)) {
|
if (!$selectList || ($selectList<0)) {
|
||||||
setEventMessage($formproject->error,'errors');
|
setEventMessage($formproject->error,'errors');
|
||||||
@ -244,7 +244,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="100">'.$langs->trans("Ref").'</td>';
|
print '<td width="100">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td width="100" align="center">'.$langs->trans("Date").'</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
|
if ($element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice
|
||||||
}
|
}
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
if (empty($value['disableamount']))
|
if (empty($value['disableamount']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if (! $qualifiedfortotal) print '<strike>';
|
if (! $qualifiedfortotal) print '<strike>';
|
||||||
@ -304,7 +304,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
if (empty($value['disableamount']))
|
if (empty($value['disableamount']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if (! $qualifiedfortotal) print '<strike>';
|
if (! $qualifiedfortotal) print '<strike>';
|
||||||
@ -341,30 +341,30 @@ foreach ($listofreferent as $key => $value)
|
|||||||
|
|
||||||
if ($project->statut > 0)
|
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)
|
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.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddProp").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$project->thirdparty->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddProp").'</a>';
|
||||||
}
|
}
|
||||||
if ($key == 'order' && ! empty($conf->commande->enabled) && $user->rights->commande->creer)
|
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.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddCustomerOrder").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?socid='.$project->thirdparty->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddCustomerOrder").'</a>';
|
||||||
}
|
}
|
||||||
if ($key == 'invoice' && ! empty($conf->facture->enabled) && $user->rights->facture->creer)
|
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.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddCustomerInvoice").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$project->thirdparty->id.'&action=create&origin='.$project->element.'&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)
|
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.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?socid='.$project->thirdparty->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
|
||||||
}
|
}
|
||||||
if ($key == 'invoice_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->creer)
|
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.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?socid='.$project->thirdparty->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user