Skip to content

Commit

Permalink
continur working
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-florian committed Aug 29, 2016
1 parent a4ce756 commit cd1f78c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
2 changes: 1 addition & 1 deletion htdocs/categories/class/categorie.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Categorie extends CommonObject
'contact' => 'socpeople',
'user' => 'user',
'account' => 'bank_account',
'project' => 'project',
'project' => 'projet',
);

public $element='category';
Expand Down
55 changes: 55 additions & 0 deletions htdocs/categories/viewcat.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,61 @@
}
}

// List of Project
if ($object->type == Categorie::TYPE_PROJECT)
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';

$projects = $object->getObjectsInCateg("project");
if ($projects < 0)
{
dol_print_error($db, $object->error, $object->errors);
}
else
{
print "<br>";
print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Project")."</td></tr>\n";

if (count($projects) > 0)
{
$var=true;
foreach ($projects as $key => $project)
{
$var=!$var;
print "\t<tr ".$bc[$var].">\n";
print '<td class="nowrap" valign="top">';
print $project->getNomUrl(1,0);
print "</td>\n";
print '<td valign="top">'.$project->ref."</td>\n";
print '<td valign="top">'.$project->title."</td>\n";
// Link to delete from category
print '<td align="right">';
$typeid=$object->type;
$permission=0;
if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($typeid == Categorie::TYPE_ACCOUNT) $permission=$user->rights->banque->configurer;
if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
if ($permission)
{
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$project->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' ';
print $langs->trans("DeleteFromCat")."</a>";
}
print "</tr>\n";
}
}
else
{
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoProject").'</td></tr>';
}
print "</table>\n";
}
}

llxFooter();

$db->close();
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/categories.lang
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CustomersCategoriesArea=Customers tags/categories area
MembersCategoriesArea=Members tags/categories area
ContactsCategoriesArea=Contacts tags/categories area
AccountsCategoriesArea=Accounts tags/categories area
PeojectCategoriesArea=Projects tags/categories area
ProjectsCategoriesArea=Projects tags/categories area
SubCats=Subcategories
CatList=List of tags/categories
NewCategory=New tag/category
Expand Down

0 comments on commit cd1f78c

Please sign in to comment.