Merge pull request #1910 from FHenry/develop
Better accountancy auto find accountancy code feature (work with several
This commit is contained in:
commit
d0da5ef047
@ -112,8 +112,9 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
|||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||||
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
|
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
|
||||||
|
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL)";
|
||||||
if (! empty($conf->multicompany->enabled)) {
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||||
}
|
}
|
||||||
@ -219,7 +220,7 @@ if ($result) {
|
|||||||
|
|
||||||
// Colonne choix ligne a ventiler
|
// Colonne choix ligne a ventiler
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->code_sell ? "checked" : "") . '/>';
|
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -114,7 +114,9 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
|||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_buy = aa.account_number";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_buy = aa.account_number";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||||
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
|
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
|
||||||
|
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL)";
|
||||||
|
|
||||||
if (! empty($conf->multicompany->enabled)) {
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||||
@ -199,7 +201,7 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
// Colonne choix ligne a ventiler
|
// Colonne choix ligne a ventiler
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->code_buy ? "checked" : "") . '/>';
|
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|||||||
@ -601,6 +601,11 @@ else
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
||||||
|
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dunning
|
* Dunning
|
||||||
@ -633,8 +638,8 @@ if ($result)
|
|||||||
|
|
||||||
$total_ht += $obj->amount;
|
$total_ht += $obj->amount;
|
||||||
$total_ttc += $obj->amount;
|
$total_ttc += $obj->amount;
|
||||||
$subtotal_ht -= $obj->amount;
|
$subtotal_ht += $obj->amount;
|
||||||
$subtotal_ttc -= $obj->amount;
|
$subtotal_ttc += $obj->amount;
|
||||||
|
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
@ -661,8 +666,8 @@ else
|
|||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" align="right">'.price($subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
print '<td colspan="3" align="right">'.price($subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -120,6 +120,7 @@ TypeContact_project_task_internal_TASKCONTRIBUTOR=Contributor
|
|||||||
TypeContact_project_task_external_TASKCONTRIBUTOR=Contributor
|
TypeContact_project_task_external_TASKCONTRIBUTOR=Contributor
|
||||||
SelectElement=Select element
|
SelectElement=Select element
|
||||||
AddElement=Link to element
|
AddElement=Link to element
|
||||||
|
UnlinkElement=Unlink element
|
||||||
# Documents models
|
# Documents models
|
||||||
DocumentModelBaleine=A complete project's report model (logo...)
|
DocumentModelBaleine=A complete project's report model (logo...)
|
||||||
PlannedWorkload = Planned workload
|
PlannedWorkload = Planned workload
|
||||||
@ -128,3 +129,4 @@ ProjectReferers=Refering objects
|
|||||||
SearchAProject=Search a project
|
SearchAProject=Search a project
|
||||||
ProjectMustBeValidatedFirst=Project must be validated first
|
ProjectMustBeValidatedFirst=Project must be validated first
|
||||||
ProjectDraft=Draft projects
|
ProjectDraft=Draft projects
|
||||||
|
FirstAddRessourceToAllocateTime=Associate a ressource to allocate time
|
||||||
@ -119,7 +119,8 @@ TypeContact_project_task_external_TASKEXECUTIVE=Responsable
|
|||||||
TypeContact_project_task_internal_TASKCONTRIBUTOR=Contributeur
|
TypeContact_project_task_internal_TASKCONTRIBUTOR=Contributeur
|
||||||
TypeContact_project_task_external_TASKCONTRIBUTOR=Contributeur
|
TypeContact_project_task_external_TASKCONTRIBUTOR=Contributeur
|
||||||
SelectElement=Séléctionnez l'élément
|
SelectElement=Séléctionnez l'élément
|
||||||
AddElement=Link to element
|
AddElement=Associer l'élément
|
||||||
|
UnlinkElement=Délier l'element
|
||||||
# Documents models
|
# Documents models
|
||||||
DocumentModelBaleine=Modèle de rapport de projet complet (logo...)
|
DocumentModelBaleine=Modèle de rapport de projet complet (logo...)
|
||||||
PlannedWorkload = Charge de travail prévue
|
PlannedWorkload = Charge de travail prévue
|
||||||
@ -128,3 +129,4 @@ ProjectReferers=Objets associés
|
|||||||
SearchAProject=Rechercher un projet
|
SearchAProject=Rechercher un projet
|
||||||
ProjectMustBeValidatedFirst=Le projet doit être validé d'abord
|
ProjectMustBeValidatedFirst=Le projet doit être validé d'abord
|
||||||
ProjectDraft=Projets brouillons
|
ProjectDraft=Projets brouillons
|
||||||
|
FirstAddRessourceToAllocateTime=Associer une ressource pour allouer du temps consomée
|
||||||
@ -322,6 +322,7 @@ class Project extends CommonObject
|
|||||||
$this->note_private = $obj->note_private;
|
$this->note_private = $obj->note_private;
|
||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
|
$this->societe=(object)array();// To avoid warning on next line
|
||||||
$this->societe->id = $obj->fk_soc; // TODO For backward compatibility
|
$this->societe->id = $obj->fk_soc; // TODO For backward compatibility
|
||||||
$this->user_author_id = $obj->fk_user_creat;
|
$this->user_author_id = $obj->fk_user_creat;
|
||||||
$this->public = $obj->public;
|
$this->public = $obj->public;
|
||||||
@ -1276,23 +1277,23 @@ class Project extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Associate element to a project
|
* Associate element to a project
|
||||||
*
|
*
|
||||||
* @param string $TableName Table of the element to update
|
* @param string $tableName Table of the element to update
|
||||||
* @param int $ElementSelectId Key-rowid of the line of the element to update
|
* @param int $elementSelectId Key-rowid of the line of the element to update
|
||||||
* @return int 1 if OK or < 0 if KO
|
* @return int 1 if OK or < 0 if KO
|
||||||
*/
|
*/
|
||||||
function update_element($TableName, $ElementSelectId)
|
function update_element($tableName, $elementSelectId)
|
||||||
{
|
{
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX.$TableName;
|
$sql="UPDATE ".MAIN_DB_PREFIX.$tableName;
|
||||||
|
|
||||||
if ($TableName=="actioncomm")
|
if ($TableName=="actioncomm")
|
||||||
{
|
{
|
||||||
$sql.= " SET fk_project=".$this->id;
|
$sql.= " SET fk_project=".$this->id;
|
||||||
$sql.= " WHERE id=".$ElementSelectId;
|
$sql.= " WHERE id=".$elementSelectId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql.= " SET fk_projet=".$this->id;
|
$sql.= " SET fk_projet=".$this->id;
|
||||||
$sql.= " WHERE rowid=".$ElementSelectId;
|
$sql.= " WHERE rowid=".$elementSelectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update_element", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update_element", LOG_DEBUG);
|
||||||
@ -1305,5 +1306,38 @@ class Project extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associate element to a project
|
||||||
|
*
|
||||||
|
* @param string $tableName Table of the element to update
|
||||||
|
* @param int $elementSelectId Key-rowid of the line of the element to update
|
||||||
|
* @return int 1 if OK or < 0 if KO
|
||||||
|
*/
|
||||||
|
function remove_element($tableName, $elementSelectId)
|
||||||
|
{
|
||||||
|
$sql="UPDATE ".MAIN_DB_PREFIX.$tableName;
|
||||||
|
|
||||||
|
if ($TableName=="actioncomm")
|
||||||
|
{
|
||||||
|
$sql.= " SET fk_project=NULL";
|
||||||
|
$sql.= " WHERE id=".$elementSelectId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql.= " SET fk_projet=NULL";
|
||||||
|
$sql.= " WHERE rowid=".$elementSelectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::remove_element", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -215,6 +215,15 @@ if ($action=="addelement")
|
|||||||
if ($result<0) {
|
if ($result<0) {
|
||||||
setEventMessage($mailchimp->error,'errors');
|
setEventMessage($mailchimp->error,'errors');
|
||||||
}
|
}
|
||||||
|
}elseif ($action == "unlink") {
|
||||||
|
|
||||||
|
$tablename = GETPOST("tablename");
|
||||||
|
$elementselectid = GETPOST("elementselect");
|
||||||
|
|
||||||
|
$result = $project->remove_element($tablename, $elementselectid);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessage($project->error, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($listofreferent as $key => $value)
|
foreach ($listofreferent as $key => $value)
|
||||||
@ -247,7 +256,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
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" colspan="2">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
|
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
|
||||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||||
if (empty($value['disableamount'])) print '<td align="right" width="120">'.$langs->trans("AmountHT").'</td>';
|
if (empty($value['disableamount'])) print '<td align="right" width="120">'.$langs->trans("AmountHT").'</td>';
|
||||||
@ -276,7 +285,9 @@ foreach ($listofreferent as $key => $value)
|
|||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
|
print '<td width="1%">';
|
||||||
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $projectid . '&action=unlink&tablename=' . $tablename . '&elementselect=' . $element->id . '">' . img_picto($langs->trans('Unlink'), 'editdelete') . '</a>';
|
||||||
|
print "</td>\n";
|
||||||
// Ref
|
// Ref
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print $element->getNomUrl(1);
|
print $element->getNomUrl(1);
|
||||||
@ -326,7 +337,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Number").': '.$i.'</td>';
|
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Number").': '.$i.'</td>';
|
||||||
if (empty($value['disableamount'])) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
|
if (empty($value['disableamount'])) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
|
||||||
if (empty($value['disableamount'])) print '<td align="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
|
if (empty($value['disableamount'])) print '<td align="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|||||||
@ -300,7 +300,8 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
|
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
|
||||||
print $form->select_dolusers($user->id,'userid',1);
|
$contactsofproject=$object->getListContactId('internal');
|
||||||
|
$form->select_users($user->id,'userid',0,'',0,'',$contactsofproject);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
|
|||||||
@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($object->fetch($id) > 0)
|
if ($object->fetch($id) > 0)
|
||||||
{
|
{
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = dol_clone($projectstatic);
|
$object->project = dol_clone($projectstatic);
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Define a complementary filter for search of next/prev ref.
|
// Define a complementary filter for search of next/prev ref.
|
||||||
if (! $user->rights->projet->all->lire)
|
if (! $user->rights->projet->all->lire)
|
||||||
{
|
{
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,0);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
||||||
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||||
}
|
}
|
||||||
print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1');
|
print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1');
|
||||||
@ -188,7 +188,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||||
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1);
|
if (! empty($projectstatic->thridparty->id)) print $projectstatic->thridparty->getNomUrl(1);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -239,7 +239,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||||
if (! GETPOST('withproject') || empty($projectstatic->id))
|
if (! GETPOST('withproject') || empty($projectstatic->id))
|
||||||
{
|
{
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
|
||||||
$object->next_prev_filter=" fk_projet in (".$projectsListId.")";
|
$object->next_prev_filter=" fk_projet in (".$projectsListId.")";
|
||||||
}
|
}
|
||||||
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
|
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
|
||||||
@ -259,7 +259,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Customer
|
// Customer
|
||||||
print "<tr><td>".$langs->trans("ThirdParty")."</td>";
|
print "<tr><td>".$langs->trans("ThirdParty")."</td>";
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1);
|
if ($projectstatic->thridparty->id > 0) print $projectstatic->thridparty->getNomUrl(1);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -202,7 +202,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$res=$object->fetch_optionals($object->id,$extralabels);
|
$res=$object->fetch_optionals($object->id,$extralabels);
|
||||||
|
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = dol_clone($projectstatic);
|
$object->project = dol_clone($projectstatic);
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||||
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1);
|
if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -195,7 +195,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($object->fetch($id) >= 0)
|
if ($object->fetch($id) >= 0)
|
||||||
{
|
{
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = dol_clone($projectstatic);
|
$object->project = dol_clone($projectstatic);
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||||
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1);
|
if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -302,7 +302,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
print '<td>'.$langs->trans("ThirdParty").'</td><td>';
|
print '<td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||||
if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1);
|
if ($projectstatic->thirdparty->id) print $projectstatic->thirdparty->getNomUrl(1);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -345,13 +345,14 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Contributor
|
// Contributor
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$restrictaddtimetocontactoftask=0;
|
|
||||||
if (empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS))
|
|
||||||
{
|
|
||||||
$restrictaddtimetocontactoftask=$object->getListContactId('internal');
|
|
||||||
}
|
|
||||||
print img_object('','user');
|
print img_object('','user');
|
||||||
print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$restrictaddtimetocontactoftask); // Note: If user is not allowed it will be disabled into combo list and userid not posted
|
$contactsoftask=$object->getListContactId('internal');
|
||||||
|
if (count($contactsoftask)>0) {
|
||||||
|
$userid=$contactsoftask[0];
|
||||||
|
$form->select_users($userid,'userid',0,'',0,'',$contactsoftask);
|
||||||
|
}else {
|
||||||
|
print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
@ -440,7 +441,15 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid)
|
if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid)
|
||||||
{
|
{
|
||||||
print $form->select_dolusers($task_time->fk_user,'userid_line');
|
$contactsoftask=$object->getListContactId('internal');
|
||||||
|
if (!in_array($task_time->fk_user,$contactsoftask)) {
|
||||||
|
$contactsoftask[]=$task_time->fk_user;
|
||||||
|
}
|
||||||
|
if (count($contactsoftask)>0) {
|
||||||
|
$form->select_users($task_time->fk_user,'userid_line',0,'',0,'',$contactsoftask);
|
||||||
|
}else {
|
||||||
|
print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -126,7 +126,7 @@ class AllTests
|
|||||||
require_once dirname(__FILE__).'/ContratTest.php';
|
require_once dirname(__FILE__).'/ContratTest.php';
|
||||||
$suite->addTestSuite('ContratTest');
|
$suite->addTestSuite('ContratTest');
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/FichinterTest.php';
|
require_once dirname(__FILE__).'/FichInterTest.php';
|
||||||
$suite->addTestSuite('FichinterTest');
|
$suite->addTestSuite('FichinterTest');
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/PropalTest.php';
|
require_once dirname(__FILE__).'/PropalTest.php';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user