Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Can show the list of projects having at least one contact that is a contact of the third party #28829

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dev/tools/codespell/codespell-lines-ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
$object->periode = $dateperiod;
$return .= '<br><span class="opacitymedium">'.$langs->trans("Payement").'</span> : <span class="info-box-label">'.$this->type_payment.'</span>';
$sortfield = "datea";
$sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount";
$sql .= " '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " , datee = ".(!empty($obj->datee) ? "'".$this->db->escape($obj->datee)."'" : "null");
$sql .= " AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)";
Expand Down Expand Up @@ -325,6 +326,7 @@ $usercanread = (($user->hasRight('stock', 'mouvement', 'lire')));
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
* The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere.
- New: Add proposals into referer page of thirdparty.
NEW: ModuleBuilder: Checkin comments begin and end before each actions
for /F "tokens=2 delims=," %%i in ('tasklist /FI "IMAGENAME eq php.exe" /FO CSV /NH') do (
foreach ($TWeek as $week_number) {
function checkES($IentOfi, $InumCta)
Expand Down
98 changes: 98 additions & 0 deletions htdocs/core/lib/company.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,104 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
dol_print_error($db);
}

//projects linked to that thirdpart because of a people of that company is linked to a project
if (getDolGlobalString('PROJECT_DISPLAY_LINKED_BY_CONTACT')) {
print "\n";
print load_fiche_titre($langs->trans("ProjectsLinkedToThisThirdParty"), '', '');


print '<div class="div-table-responsive">'."\n";
print '<table class="noborder centpercent">';

$sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount";
$sql .= ", cls.code as opp_status_code";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec on p.rowid = ec.element_id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sc on ec.fk_socpeople = sc.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc on ec.fk_c_type_contact = tc.rowid";
$sql .= " WHERE sc.fk_soc = ".((int) $object->id);
$sql .= " AND p.entity IN (".getEntity('project').")";
$sql .= " AND tc.element = 'project'";
$sql .= " ORDER BY p.dateo DESC";

$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);

print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td class="center">'.$langs->trans("DateStart").'</td>';
print '<td class="center">'.$langs->trans("DateEnd").'</td>';
print '<td class="right">'.$langs->trans("OpportunityAmountShort").'</td>';
print '<td class="center">'.$langs->trans("OpportunityStatusShort").'</td>';
print '<td class="right">'.$langs->trans("OpportunityProbabilityShort").'</td>';
print '<td class="right">'.$langs->trans("Status").'</td>';
print '</tr>';

if ($num > 0) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';

$projecttmp = new Project($db);

$i = 0;

while ($i < $num) {
$obj = $db->fetch_object($result);
$projecttmp->fetch($obj->id);

// To verify role of users
$userAccess = $projecttmp->restrictedProjectArea($user);

if ($user->rights->projet->lire && $userAccess > 0) {
print '<tr class="oddeven">';

// Ref
print '<td class="nowraponall">';
print $projecttmp->getNomUrl(1, '', 0, '', '-', 0, 1, '', 'project:'.$_SERVER["PHP_SELF"].'?socid=__SOCID__');
print '</td>';

// Label
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
// Date start
print '<td class="center">'.dol_print_date($db->jdate($obj->do), "day").'</td>';
// Date end
print '<td class="center">'.dol_print_date($db->jdate($obj->de), "day").'</td>';
// Opp amount
print '<td class="right">';
if ($obj->opp_status_code) {
print '<span class="amount">'.price($obj->opp_amount, 1, '', 1, -1, -1, '').'</span>';
}
print '</td>';
// Opp status
print '<td class="center">';
if ($obj->opp_status_code) {
print $langs->trans("OppStatus".$obj->opp_status_code);
}
print '</td>';
// Opp percent
print '<td class="right">';
if ($obj->opp_percent) {
print price($obj->opp_percent, 1, '', 1, 0).'%';
}
print '</td>';
// Status
print '<td class="right">'.$projecttmp->getLibStatut(5).'</td>';

print '</tr>';
}
$i++;
}
} else {
print '<tr class="oddeven"><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
$db->free($result);
} else {
dol_print_error($db);
}
}

$parameters = array('sql' => $sql, 'function' => 'show_projects');
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
Expand Down
2 changes: 2 additions & 0 deletions htdocs/langs/en_US/admin.lang
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ SearchString=Search string
NotAvailableWhenAjaxDisabled=Not available when Ajax disabled
AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party
TimesheetPreventAfterFollowingMonths=Prevent recording time spent after the following number of months
PROJECT_DISPLAY_LINKED_BY_CONTACT=Display project linked by a common contact
PROJECT_DISPLAY_LINKED_BY_CONTACT_help=That option add a new list on Project tab with all projects linked to that thirdparty via a contact relationship
JavascriptDisabled=JavaScript disabled
UsePreviewTabs=Use preview tabs
ShowPreview=Show preview
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/projects.lang
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ DoNotShowMyTasksOnly=See also tasks not assigned to me
ShowMyTasksOnly=View only tasks assigned to me
TaskRessourceLinks=Contacts of task
ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party
ProjectsLinkedToThisThirdParty=Projects having a contact that is a contact of the third party
NoTasks=No tasks for this project
LinkedToAnotherCompany=Linked to other third party
TaskIsNotAssignedToUser=Task not assigned to user. Use button '<strong>%s</strong>' to assign task now.
Expand Down
2 changes: 2 additions & 0 deletions htdocs/langs/fr_FR/admin.lang
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ SearchString=Chaîne de recherche
NotAvailableWhenAjaxDisabled=Non disponible quand Ajax est désactivé
AllowToSelectProjectFromOtherCompany=Sur les éléments d'un tiers, autorise la sélection d'un projet lié à un autre tiers
TimesheetPreventAfterFollowingMonths=Empêcher l'enregistrement du temps consacré après le nombre de mois suivant
PROJECT_DISPLAY_LINKED_BY_CONTACT=Afficher les projets liés par un contact
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rycks translations need to be in en_US, other are overwrited by transifex sync

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frederic34 oooops !

PROJECT_DISPLAY_LINKED_BY_CONTACT_help=Cette option permet d'ajouter la liste de tous les projets dans lesquels un des contact du tiers est rattaché
JavascriptDisabled=Javascript désactivé
UsePreviewTabs=Afficher les onglets "Aperçu"
ShowPreview=Afficher aperçu
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/fr_FR/projects.lang
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ DoNotShowMyTasksOnly=Voir aussi les tâches qui ne me sont pas affectées
ShowMyTasksOnly=Ne voir que les tâches qui me sont affectées
TaskRessourceLinks=Contacts de la tâche
ProjectsDedicatedToThisThirdParty=Projets dédiés à ce tiers
ProjectsLinkedToThisThirdParty=Projets liés à ce tiers par un contact commun
NoTasks=Aucune tâche pour ce projet
LinkedToAnotherCompany=Liés à autre société
TaskIsNotAssignedToUser=Tâche non assignée à l'utilisateur. Utilisez le bouton '<strong>%s</strong>' pour assigner la tâche maintenant.
Expand Down
12 changes: 12 additions & 0 deletions htdocs/projet/admin/project.php
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,18 @@
print '<input type="submit" class="button small reposition" name="PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS" value="'.$langs->trans("Modify").'">';
print '</td>';
print '</tr>';

$key = 'PROJECT_DISPLAY_LINKED_BY_CONTACT';
echo '<tr class="oddeven">',
'<td class="left">',
$form->textwithpicto($langs->transnoentities($key), $langs->transnoentities($key . '_help')),
'</td>',
'<td class="right" colspan="2">',
ajax_constantonoff($key),
'</td>',
'</tr>';


print '</table>';
print '</div>';

Expand Down
Loading