diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php
index 8af76ce8647..5ec318aca52 100644
--- a/htdocs/categories/card.php
+++ b/htdocs/categories/card.php
@@ -58,6 +58,7 @@ if ($origin)
if ($type == Categorie::TYPE_CUSTOMER) $idCompanyOrigin = $origin;
if ($type == Categorie::TYPE_MEMBER) $idMemberOrigin = $origin;
if ($type == Categorie::TYPE_CONTACT) $idContactOrigin = $origin;
+ if ($type == Categorie::TYPE_PROJECT) $idProjectOrigin = $origin;
}
if ($catorigin && $type == Categorie::TYPE_PRODUCT) $idCatOrigin = $catorigin;
@@ -116,6 +117,11 @@ if ($action == 'add' && $user->rights->categorie->creer)
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type);
exit;
}
+ else if ($idProjectOrigin)
+ {
+ header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type);
+ exit;
+ }
else
{
header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
@@ -201,6 +207,11 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
exit;
}
+ else if ($idProjectOrigin)
+ {
+ header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
+ exit;
+ }
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$result.'&type='.$type);
exit;
@@ -259,7 +270,7 @@ if ($user->rights->categorie->creer)
print '
| '.$langs->trans("AddIn").' | ';
print $form->select_all_categories($type, $catorigin);
diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index c347b4863c7..f472570f308 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -88,6 +88,13 @@ if ($id || $ref)
$dbtablename = 'socpeople&societe';
$fieldid = ! empty($ref)?'ref':'rowid';
}
+ elseif ($type == Categorie::TYPE_PROJECT) {
+ $elementtype = 'project';
+ $objecttype = 'project';
+ $objectid = isset($id)?$id:(isset($ref)?$ref:'');
+ $dbtablename = '&project';
+ $fieldid = ! empty($ref)?'ref':'rowid';
+ }
}
// Security check
@@ -145,6 +152,13 @@ if (empty($reshook))
$result = $object->fetch($objectid);
$elementtype = 'contact';
}
+ if ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer)
+ {
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ $object = new Project($db);
+ $result = $object->fetch($objectid);
+ $elementtype = 'project';
+ }
$cat = new Categorie($db);
$result=$cat->fetch($removecat);
@@ -192,6 +206,13 @@ if (empty($reshook))
$result = $object->fetch($objectid);
$elementtype = 'contact';
}
+ if ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer)
+ {
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ $object = new Project($db);
+ $result = $object->fetch($objectid);
+ $elementtype = 'project';
+ }
$cat = new Categorie($db);
$result=$cat->fetch($parent);
@@ -607,6 +628,75 @@ else if ($id || $ref)
formCategory($db,$object,4,$socid, $user->rights->societe->creer);
}
+
+ if ($type == Categorie::TYPE_PROJECT)
+ {
+ $langs->load("products");
+
+ /*
+ * Category card for product
+ */
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+
+ // Product
+ $product = new Product($db);
+ $result = $product->fetch($id, $ref);
+
+ llxHeader("","",$langs->trans("Project"));
+
+
+ $head=project_prepare_head($product);
+ $titre=$langs->trans("Project");
+ $picto=($object->public?'projectpub':'project');
+ dol_fiche_head($head, 'category', $titre,0,$picto);
+
+
+ print '';
+
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ // Ref
+ print '| '.$langs->trans("Ref").' | ';
+ // Define a complementary filter for search of next/prev ref.
+ if (! $user->rights->projet->all->lire)
+ {
+ $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
+ $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
+ }
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
+ print ' | ';
+
+ // Label
+ print '| '.$langs->trans("Label").' | '.$object->title.' | ';
+
+ // Third party
+ print '| '.$langs->trans("ThirdParty").' | ';
+ if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1, 'project');
+ else print' ';
+ print ' | ';
+
+ // Visibility
+ print '| '.$langs->trans("Visibility").' | ';
+ if ($object->public) print $langs->trans('SharedProject');
+ else print $langs->trans('PrivateProject');
+ print ' | ';
+
+ // Statut
+ print '| '.$langs->trans("Status").' | '.$object->getLibStatut(4).' | ';
+
+ // Date start
+ print '| '.$langs->trans("DateStart").' | ';
+ print dol_print_date($object->date_start,'day');
+ print ' | ';
+
+ // Date end
+ print '| '.$langs->trans("DateEnd").' | ';
+ print dol_print_date($object->date_end,'day');
+ print ' | ';
+
+ formCategory($db,$product,0,$socid,($user->rights->projet->creer));
+ }
}
@@ -630,6 +720,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort");
if ($typeid == Categorie::TYPE_MEMBER) $title = $langs->trans("MembersCategoriesShort");
if ($typeid == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort");
+ if ($typeid == Categorie::TYPE_PROJECT) $title = $langs->trans("ProjectsCategoriesShort");
$linktocreate='';
if ($showclassifyform && $user->rights->categorie->creer)
@@ -674,6 +765,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
if ($typeid == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CompanyIsInCustomersCategories");
if ($typeid == Categorie::TYPE_MEMBER) $title=$langs->trans("MemberIsInCategories");
if ($typeid == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactIsInCategories");
+ if ($typeid == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectIsInCategories");
print "\n";
print '';
print '| '.$title.': | ';
@@ -699,6 +791,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($typeid == Categorie::TYPE_CONTACT) $permission=$user->rights->societe->creer;
+ if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removecat=".$cat->id."'>";
@@ -727,6 +820,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
if ($typeid == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CompanyHasNoCategory");
if ($typeid == Categorie::TYPE_MEMBER) $title=$langs->trans("MemberHasNoCategory");
if ($typeid == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactHasNoCategory");
+ if ($typeid == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectHasNoCategory");
print $title;
print " ";
}
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 60e132f3051..e926611ccd4 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -50,6 +50,7 @@ class Categorie extends CommonObject
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account'
+ const TYPE_PROJECT = 6;
/**
* @var array ID mapping from type string
@@ -64,6 +65,7 @@ class Categorie extends CommonObject
'contact' => 4,
'user' => 4,
'account' => 5,
+ 'project' => 6,
);
/**
* @var array Foreign keys mapping from type string
@@ -78,6 +80,7 @@ class Categorie extends CommonObject
'contact' => 'socpeople',
'user' => 'user',
'account' => 'account',
+ 'project' => 'project',
);
/**
* @var array Category tables mapping from type string
@@ -92,6 +95,7 @@ class Categorie extends CommonObject
'contact' => 'contact',
'user' => 'user',
'account' => 'account',
+ 'project' => 'project',
);
/**
* @var array Object class mapping from type string
@@ -106,6 +110,7 @@ class Categorie extends CommonObject
'contact' => 'Contact',
'user' => 'User',
'account' => 'Account',
+ 'project' => 'Project',
);
/**
* @var array Object table mapping from type string
@@ -120,6 +125,7 @@ class Categorie extends CommonObject
'contact' => 'socpeople',
'user' => 'user',
'account' => 'bank_account',
+ 'project' => 'project',
);
public $element='category';
@@ -146,6 +152,7 @@ class Categorie extends CommonObject
* @see Categorie::TYPE_CONTACT
* @see Categorie::TYPE_USER
* @see Categorie::TYPE_ACCOUNT
+ * @see Categorie::TYPE_PROJECT
*/
var $type;
@@ -514,6 +521,18 @@ class Categorie extends CommonObject
$error++;
}
}
+ if (! $error)
+ {
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_project";
+ $sql .= " WHERE fk_category = ".$this->id;
+ if (!$this->db->query($sql))
+ {
+ $this->error=$this->db->lasterror();
+ dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
+ $error++;
+ }
+ }
+
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang";
@@ -1029,11 +1048,11 @@ class Categorie extends CommonObject
/**
- * Returns all categories
+ * Returns all categories
*
* @param int $type Type of category
* @param boolean $parent Just parent categories if true
- * @return array Table of Object Category
+ * @return array Table of Object Category
*/
function get_all_categories($type=null, $parent=false)
{
@@ -1183,7 +1202,7 @@ class Categorie extends CommonObject
}
}
}
-
+
if ($url == '')
{
$link = '';
@@ -1196,7 +1215,7 @@ class Categorie extends CommonObject
}
}
$newcategwithpath = preg_replace('/toreplace/', $forced_color, implode($sep, $w));
-
+
$ways[] = $newcategwithpath;
}
@@ -1239,8 +1258,8 @@ class Categorie extends CommonObject
}
/**
- * Returns in a table all possible paths to get to the category
- * starting with the major categories represented by Tables of categories
+ * Returns in a table all possible paths to get to the category
+ * starting with the major categories represented by Tables of categories
*
* @return array
*/
@@ -1415,7 +1434,7 @@ class Categorie extends CommonObject
$b = hexdec($hex[4].$hex[5]);
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
if ($bright >= 0.5) $forced_color='categtextblack'; // Higher than 60%
- }
+ }
$link = '';
$linkend='';
diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index a2c7186933e..07c586e3b11 100644
--- a/htdocs/categories/index.php
+++ b/htdocs/categories/index.php
@@ -54,6 +54,7 @@ elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCateg
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea");
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea");
+elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesArea");
else $title=$langs->trans("CategoriesArea");
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php
index d3b1f8854b9..6da030db893 100644
--- a/htdocs/categories/photos.php
+++ b/htdocs/categories/photos.php
@@ -101,6 +101,7 @@ if ($object->id)
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
+ elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type);
@@ -140,7 +141,7 @@ if ($object->id)
print $langs->trans("Color").'';
print $formother->showColor($object->color);
print ' | ';
-
+
print " \n";
print "\n";
diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php
index 25fb000a594..38ff45d043d 100644
--- a/htdocs/categories/traduction.php
+++ b/htdocs/categories/traduction.php
@@ -152,6 +152,7 @@ elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCateg
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
+elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type);
@@ -207,7 +208,7 @@ if ($action == 'edit')
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create();
print '';
-
+
print '';
print ' ';
}
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index f5cb88f85f4..fdde86ff1f9 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -115,6 +115,13 @@ if ($id > 0 && $removeelem > 0)
$result = $tmpobject->fetch($removeelem);
$elementtype = 'account';
}
+ else if ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer)
+ {
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ $tmpobject = new Project($db);
+ $result = $tmpobject->fetch($removeelem);
+ $elementtype = 'project';
+ }
$result=$object->del_type($tmpobject,$elementtype);
if ($result < 0) dol_print_error('',$object->error);
@@ -178,6 +185,7 @@ elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCateg
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
+elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type);
@@ -360,6 +368,7 @@ if ($object->type == Categorie::TYPE_PRODUCT)
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_PROJECT) $permission=$user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$prod->id."'>";
@@ -410,6 +419,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER)
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_PROJECT) $permission=$user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$soc->id."'>";
@@ -464,6 +474,7 @@ if($object->type == Categorie::TYPE_CUSTOMER)
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_PROJECT) $permission=$user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$soc->id."'>";
@@ -519,6 +530,7 @@ if ($object->type == Categorie::TYPE_MEMBER)
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_PROJECT) $permission=$user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$member->id."'>";
@@ -571,6 +583,7 @@ if($object->type == Categorie::TYPE_CONTACT)
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($typeid == Categorie::TYPE_CONTACT) $permission=$user->rights->societe->creer;
+ if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$contact->id."'>";
@@ -626,6 +639,7 @@ if ($object->type == Categorie::TYPE_ACCOUNT)
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 "id."&type=".$typeid."&removeelem=".$account->id."'>";
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 7b2b131a59e..386328c0929 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -57,13 +57,13 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$showmode=1;
$classname = 'class="tmenu menuhider"';
$idsel='menu';
-
+
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry('', 1, '#', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
}
-
+
// Home
$showmode=1;
$classname="";
@@ -132,8 +132,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
if (! empty($conf->contrat->enabled)) $menuqualified++;
if (! empty($conf->ficheinter->enabled)) $menuqualified++;
$tmpentry=array(
- 'enabled'=>$menuqualified,
- 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)),
+ 'enabled'=>$menuqualified,
+ 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)),
'module'=>'propal|commande|supplier_order|contrat|ficheinter');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
@@ -343,7 +343,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
function print_start_menu_array()
{
global $conf;
-
+
print ''."\n";
print "\n";
}
-
+
/**
* We update newmenu with entries found into database
* --------------------------------------------------
@@ -504,7 +504,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Home - dashboard
$newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("Dashboard"), 0, 1, '', $mainmenu, 'home');
-
+
// Setup
$newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup');
if (empty($leftmenu) || $leftmenu=="setup")
@@ -528,7 +528,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1);
$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
-
+
$newmenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"),1);
$newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"),1);
$newmenu->add("/admin/delais.php?mainmenu=home",$langs->trans("Alerts"),1);
@@ -568,7 +568,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"),1);
$newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('About'), 1);
- if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
+ if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
$langs->load("products");
$newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
@@ -579,7 +579,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$langs->load("accountancy");
$newmenu->add("/accountancy/admin/productaccount.php?mainmenu=home&leftmenu=admintools", $langs->trans("InitAccountancy"), 1, $user->admin);
}
-
+
$newmenu->add("/support/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("HelpCenter"),1,1,'targethelp');
}
@@ -747,7 +747,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusOrderCanceled"), 2, $user->rights->fournisseur->commande->lire);
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusOrderRefused"), 2, $user->rights->fournisseur->commande->lire);
// Billed is another field. We should add instead a dedicated filter on list. if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("StatusOrderBilled"), 2, $user->rights->fournisseur->commande->lire);
-
+
$newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
}
@@ -773,7 +773,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200);
$newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
$newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
-
+
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
}
@@ -910,7 +910,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
}
}
-
+
// Salaries
if (! empty($conf->salaries->enabled))
{
@@ -919,7 +919,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->write);
if (empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read);
}
-
+
// Loan
if (! empty($conf->loan->enabled))
{
@@ -1212,6 +1212,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/projet/tasks/list.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/activity/perweek.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->lire);
}
+
+ // Categories
+ if (! empty($conf->categorie->enabled))
+ {
+ $langs->load("categories");
+ $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat');
+ $newmenu->add("/categories/card.php?action=create&type=6", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
+ //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
+ }
}
}
@@ -1338,7 +1347,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$menuArbo = new Menubase($db,'eldy');
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,(empty($user->societe_id)?0:1),'eldy',$tabMenu);
//var_dump($newmenu->liste); //
-
+
// We update newmenu for special dynamic menus
if (!empty($user->rights->banque->lire) && $mainmenu == 'bank') // Entry for each bank account
{
@@ -1410,7 +1419,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$nbentry = count($menu_array);
while (findNextEntryForLevel($menu_array, $cursor, $position, $level))
{
-
+
$cursor++;
}*/
@@ -1431,7 +1440,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$altok++;
$blockvmenuopened=true;
$lastopened=true;
- for($j = ($i + 1); $j < $num; $j++)
+ for($j = ($i + 1); $j < $num; $j++)
{
if (empty($menu_array[$j]['level'])) $lastopened=false;
}
@@ -1457,7 +1466,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
$url = $shorturl = $menu_array[$i]['url'];
-
+
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$menu_array[$i]['url']))
{
$tmp=explode('?',$menu_array[$i]['url'],2);
@@ -1465,11 +1474,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link
// Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined.
- if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu']))
+ if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu']))
{
$param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';
}
- if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($menu_array[$i]['mainmenu']))
+ if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($menu_array[$i]['mainmenu']))
{
$param.=($param?'&':'').'leftmenu=';
}
@@ -1477,12 +1486,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$url = dol_buildpath($url,1).($param?'?'.$param:'');
$shorturl = $shorturl.($param?'?'.$param:'');
}
-
+
$url=preg_replace('/__LOGIN__/',$user->login,$url);
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
$url=preg_replace('/__USERID__/',$user->id,$url);
$shorturl=preg_replace('/__USERID__/',$user->id,$shorturl);
-
+
print ''."\n";
// Menu niveau 0
@@ -1528,7 +1537,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($blockvmenuopened) { print ''."\n"; $blockvmenuopened=false; }
}
}
-
+
if ($altok) print '';
}
@@ -1541,7 +1550,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
print ''."\n";
print "\n";
}
-
+
return count($menu_array);
}
diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang
index 976c8a50d93..351a730104f 100644
--- a/htdocs/langs/en_US/categories.lang
+++ b/htdocs/langs/en_US/categories.lang
@@ -14,6 +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
SubCats=Subcategories
CatList=List of tags/categories
NewCategory=New tag/category
@@ -36,6 +37,7 @@ ProductHasNoCategory=This product/service is not in any tags/categories
CompanyHasNoCategory=This thirdparty is not in any tags/categories
MemberHasNoCategory=This member is not in any tags/categories
ContactHasNoCategory=This contact is not in any tags/categories
+ProjectHasNoCategory=This project is not in any tags/categories
ClassifyInCategory=Add to tag/category
NotCategorized=Without tag/category
CategoryExistsAtSameLevel=This category already exists with this ref
@@ -56,12 +58,14 @@ ProductsCategoriesShort=Products tags/categories
MembersCategoriesShort=Members tags/categories
ContactCategoriesShort=Contacts tags/categories
AccountsCategoriesShort=Accounts tags/categories
+ProjectsCategoriesShort=Projects tags/categories
ThisCategoryHasNoProduct=This category does not contain any product.
ThisCategoryHasNoSupplier=This category does not contain any supplier.
ThisCategoryHasNoCustomer=This category does not contain any customer.
ThisCategoryHasNoMember=This category does not contain any member.
ThisCategoryHasNoContact=This category does not contain any contact.
ThisCategoryHasNoAccount=This category does not contain any account.
+ThisCategoryHasNoProject=This category does not contain any project.
CategId=Tag/category id
CatSupList=List of supplier tags/categories
CatCusList=List of customer/prospect tags/categories
@@ -71,6 +75,7 @@ CatContactList=List of contact tags/categories
CatSupLinks=Links between suppliers and tags/categories
CatCusLinks=Links between customers/prospects and tags/categories
CatProdLinks=Links between products/services and tags/categories
+CatProJectLinks=Links between projects and tags/categories
DeleteFromCat=Remove from tags/category
ExtraFieldsCategories=Complementary attributes
CategoriesSetup=Tags/categories setup
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index fa89e06f398..67463b27222 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("projects");
$langs->load('companies');
@@ -170,6 +171,17 @@ if (empty($reshook))
setEventMessages($langs->trans($object->error), null, 'errors');
$error++;
}
+ if (! $error && !empty($object->id) > 0)
+ {
+ // Category association
+ $categories = GETPOST('categories');
+ $result=$object->setCategories($categories);
+ if ($result<0) {
+ $langs->load("errors");
+ setEventMessages($object->error, $object->errors, 'errors');
+ $error++;
+ }
+ }
if (! $error)
{
@@ -235,7 +247,7 @@ if (empty($reshook))
if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount'));
if (isset($_POST['opp_status'])) $object->opp_status = $opp_status;
if (isset($_POST['opp_percent'])) $object->opp_percent = $opp_percent;
-
+
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
@@ -246,7 +258,7 @@ if (empty($reshook))
$error++;
setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
}
-
+
if (! $error)
{
$result=$object->update($user);
@@ -254,6 +266,15 @@ if (empty($reshook))
{
$error++;
setEventMessages($object->error, $object->errors,'errors');
+ }else {
+ // Category association
+ $categories = GETPOST('categories');
+ $result=$object->setCategories($categories);
+ if ($result < 0)
+ {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
}
}
@@ -310,7 +331,7 @@ if (empty($reshook))
if ($object->id > 0)
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
+
$langs->load("other");
$upload_dir = $conf->projet->dir_output;
$file = $upload_dir . '/' . GETPOST('file');
@@ -377,7 +398,7 @@ if (empty($reshook))
$clone_notes=GETPOST('clone_notes')?1:0;
$move_date=GETPOST('move_date')?1:0;
$clone_thirdparty=GETPOST('socid','int')?GETPOST('socid','int'):0;
-
+
$result=$object->createFromClone($object->id,$clone_contacts,$clone_tasks,$clone_project_files,$clone_task_files,$clone_notes,$move_date,0,$clone_thirdparty);
if ($result <= 0)
{
@@ -486,7 +507,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print ' '.$langs->trans("AddThirdParty").'';
print ' |
';
}
-
+
// Status
if ($status != '')
{
@@ -526,7 +547,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print '