diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php index 09cc56c54e81f25c87b83f6aabff48f0e7eb5b86..c0b3743c980751e8cff2dc2889c3e4a646a4b3ef 100644 --- a/htdocs/projet/activity/list.php +++ b/htdocs/projet/activity/list.php @@ -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. diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 3279221d0c4ee84a7aa8b6ea2d82cc5ebe66b8c4..7f8fd52c5007113d23b0bbde2374fccfac8390b3 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -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=''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 53559c74333fff44415336c2e83d3fd0d8d5f31d..abdf6f81b5b047e8fc28ea44aff0c89053a8138c 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -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 ' '; 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.'&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) { - 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) { - 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) { - 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) { - 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>'; } } }