Skip to content

Commit

Permalink
NEW List of projects of a thirdparty are visible on a project tab
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 24, 2015
1 parent 016dbd3 commit 3015a03
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 136 deletions.
26 changes: 17 additions & 9 deletions htdocs/core/lib/company.lib.php
Expand Up @@ -91,6 +91,13 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'agenda';
$h++;
}
if (! empty($conf->projet->enabled) && (!empty($user->rights->projet->lire) ))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Projects");
$head[$h][2] = 'project';
$h++;
}
//show categorie tab
/*if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
Expand Down Expand Up @@ -456,9 +463,10 @@ function getFormeJuridiqueLabel($code)
* @param DoliDB $db Database handler
* @param Object $object Third party object
* @param string $backtopage Url to go once contact is created
* @param int $nocreatelink 1=Hide create project link
* @return void
*/
function show_projects($conf,$langs,$db,$object,$backtopage='')
function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0)
{
global $user;
global $bc;
Expand All @@ -470,7 +478,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
$langs->load("projects");

$buttoncreate='';
if (! empty($conf->projet->enabled) && $user->rights->projet->creer)
if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink))
{
//$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject");
Expand Down Expand Up @@ -864,13 +872,13 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
/**
* Show html area with actions to do
*
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
* @param Adherent|Societe $object Object third party or member
* @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it
* @return mixed Return html part or void if noprint is 1
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
* @param Adherent|Societe $object Object third party or member
* @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it
* @return mixed Return html part or void if noprint is 1
*/
function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
{
Expand Down
4 changes: 2 additions & 2 deletions htdocs/projet/card.php
Expand Up @@ -624,7 +624,7 @@
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td><input size="40" name="title" value="'.$object->title.'"></td></tr>';

// Customer
// Thirdparty
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
$filteronlist='';
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
Expand Down Expand Up @@ -713,7 +713,7 @@

// Third party
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1);
if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1, 'project');
else print'&nbsp;';
print '</td></tr>';

Expand Down
41 changes: 22 additions & 19 deletions htdocs/societe/agenda.php
Expand Up @@ -121,17 +121,34 @@

dol_fiche_end();

/*


/*
* Barre d'action
*/

print '<div class="tabsAction">';
$objthirdparty=$object;
$objcon=new stdClass();

$out='';
$permok=$user->rights->agenda->myactions->create;
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
{
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') $out.='&amp;socid='.$objthirdparty->id;
$out.=(! empty($objcon->id)?'&amp;contactid='.$objcon->id:'').'&amp;backtopage=1&amp;percentage=-1';
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
}

print '<div class="tabsAction">';

if (! empty($conf->agenda->enabled))
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$socid.'">'.$langs->trans("AddAction").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
}
else
{
Expand All @@ -143,25 +160,11 @@

print '<br>';

$objthirdparty=$object;
$objcon=new stdClass();

$out='';
$permok=$user->rights->agenda->myactions->create;
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
{
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') $out.='&amp;socid='.$objthirdparty->id;
$out.=(! empty($objcon->id)?'&amp;contactid='.$objcon->id:'').'&amp;backtopage=1&amp;percentage=-1">';
$out.=$langs->trans("AddAnAction").' ';
$out.=img_picto($langs->trans("AddAnAction"),'filenew');
$out.="</a>";
}

print load_fiche_titre($langs->trans("ActionsOnCompany"),$out,'');
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');

// List of todo actions
show_actions_todo($conf,$langs,$db,$object);
show_actions_todo($conf,$langs,$db,$object,null,0,1);

// List of done actions
show_actions_done($conf,$langs,$db,$object);
Expand Down
14 changes: 12 additions & 2 deletions htdocs/societe/class/societe.class.php
Expand Up @@ -1747,12 +1747,12 @@ function del_commercial(User $user, $commid)
* Return a link on thirdparty (with picto)
*
* @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier')
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier', 'project')
* @param int $maxlen Max length of name
* @param integer $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto=0,$option='',$maxlen=0,$notooltip=0)
function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0)
{
global $conf,$langs;

Expand Down Expand Up @@ -1795,6 +1795,16 @@ function getNomUrl($withpicto=0,$option='',$maxlen=0,$notooltip=0)
$label.= '<u>' . $langs->trans("ShowSupplier") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id;
}
else if ($option == 'agenda')
{
$label.= '<u>' . $langs->trans("ShowAgenda") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id;
}
else if ($option == 'project')
{
$label.= '<u>' . $langs->trans("ShowProject") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id;
}
else if ($option == 'category')
{
$label.= '<u>' . $langs->trans("ShowCategory") . '</u>';
Expand Down
2 changes: 2 additions & 0 deletions htdocs/societe/notify/card.php
Expand Up @@ -195,6 +195,8 @@

print "\n";

print '<br>';

// Add notification form
print load_fiche_titre($langs->trans("AddNewNotification"),'','');

Expand Down

0 comments on commit 3015a03

Please sign in to comment.