forked from Wavyzz/dolibarr
categories account like other categories
This commit is contained in:
@@ -45,6 +45,7 @@ class CategoryApi extends DolibarrApi
|
|||||||
2 => 'customer',
|
2 => 'customer',
|
||||||
3 => 'member',
|
3 => 'member',
|
||||||
4 => 'contact',
|
4 => 'contact',
|
||||||
|
5 => 'account',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -49,6 +49,8 @@ class Categorie extends CommonObject
|
|||||||
const TYPE_MEMBER = 3;
|
const TYPE_MEMBER = 3;
|
||||||
const TYPE_CONTACT = 4;
|
const TYPE_CONTACT = 4;
|
||||||
const TYPE_USER = 4; // categorie contact and user are same
|
const TYPE_USER = 4; // categorie contact and user are same
|
||||||
|
// bank account
|
||||||
|
const TYPE_ACCOUNT = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array ID mapping from type string
|
* @var array ID mapping from type string
|
||||||
@@ -62,6 +64,7 @@ class Categorie extends CommonObject
|
|||||||
'member' => 3,
|
'member' => 3,
|
||||||
'contact' => 4,
|
'contact' => 4,
|
||||||
'user' => 4,
|
'user' => 4,
|
||||||
|
'account' => 5,
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Foreign keys mapping from type string
|
* @var array Foreign keys mapping from type string
|
||||||
@@ -75,6 +78,7 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'socpeople',
|
'contact' => 'socpeople',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
|
'account' => 'account',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Category tables mapping from type string
|
* @var array Category tables mapping from type string
|
||||||
@@ -88,6 +92,7 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'contact',
|
'contact' => 'contact',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
|
'account' => 'account',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Object class mapping from type string
|
* @var array Object class mapping from type string
|
||||||
@@ -101,6 +106,7 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'Adherent',
|
'member' => 'Adherent',
|
||||||
'contact' => 'Contact',
|
'contact' => 'Contact',
|
||||||
'user' => 'User',
|
'user' => 'User',
|
||||||
|
'account' => 'Account',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Object table mapping from type string
|
* @var array Object table mapping from type string
|
||||||
@@ -114,6 +120,7 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'adherent',
|
'member' => 'adherent',
|
||||||
'contact' => 'socpeople',
|
'contact' => 'socpeople',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
|
'account' => 'bank_account',
|
||||||
);
|
);
|
||||||
|
|
||||||
public $element='category';
|
public $element='category';
|
||||||
@@ -138,6 +145,8 @@ class Categorie extends CommonObject
|
|||||||
* @see Categorie::TYPE_CUSTOMER
|
* @see Categorie::TYPE_CUSTOMER
|
||||||
* @see Categorie::TYPE_MEMBER
|
* @see Categorie::TYPE_MEMBER
|
||||||
* @see Categorie::TYPE_CONTACT
|
* @see Categorie::TYPE_CONTACT
|
||||||
|
* @see Categorie::TYPE_USER
|
||||||
|
* @see Categorie::TYPE_ACCOUNT
|
||||||
*/
|
*/
|
||||||
var $type;
|
var $type;
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
|
|||||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea");
|
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea");
|
||||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea");
|
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea");
|
||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea");
|
||||||
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea");
|
||||||
else $title=$langs->trans("CategoriesArea");
|
else $title=$langs->trans("CategoriesArea");
|
||||||
|
|
||||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||||
|
|||||||
@@ -93,12 +93,13 @@ $form = new Form($db);
|
|||||||
|
|
||||||
if ($object->id)
|
if ($object->id)
|
||||||
{
|
{
|
||||||
$title=$langs->trans("ProductsCategoryShort");
|
|
||||||
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
|
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
|
||||||
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
|
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
|
||||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
||||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
dol_fiche_head($head, 'photos', $title, 0, 'category');
|
dol_fiche_head($head, 'photos', $title, 0, 'category');
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
|
|||||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
||||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
else $title=$langs->trans("Category");
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
|
|||||||
@@ -107,7 +107,14 @@ if ($id > 0 && $removeelem > 0)
|
|||||||
$tmpobject = new Contact($db);
|
$tmpobject = new Contact($db);
|
||||||
$result = $tmpobject->fetch($removeelem);
|
$result = $tmpobject->fetch($removeelem);
|
||||||
$elementtype = 'contact';
|
$elementtype = 'contact';
|
||||||
}
|
}
|
||||||
|
else if ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
$tmpobject = new Account($db);
|
||||||
|
$result = $tmpobject->fetch($removeelem);
|
||||||
|
$elementtype = 'account';
|
||||||
|
}
|
||||||
|
|
||||||
$result=$object->del_type($tmpobject,$elementtype);
|
$result=$object->del_type($tmpobject,$elementtype);
|
||||||
if ($result < 0) dol_print_error('',$object->error);
|
if ($result < 0) dol_print_error('',$object->error);
|
||||||
@@ -169,6 +176,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
|
|||||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
||||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
else $title=$langs->trans("Category");
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
@@ -580,6 +588,59 @@ if($object->type == Categorie::TYPE_CONTACT)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List of accounts
|
||||||
|
if ($object->type == Categorie::TYPE_ACCOUNT)
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
|
$accounts = $object->getObjectsInCateg("account");
|
||||||
|
if ($accounts < 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db, $accounts->error, $accounts->errors);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<br>";
|
||||||
|
print "<table class='noborder' width='100%'>\n";
|
||||||
|
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account")."</td></tr>\n";
|
||||||
|
|
||||||
|
if (count($accounts) > 0)
|
||||||
|
{
|
||||||
|
$var=true;
|
||||||
|
foreach ($accounts as $key => $account)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print "\t<tr ".$bc[$var].">\n";
|
||||||
|
print '<td class="nowrap" valign="top">';
|
||||||
|
print $account->getNomUrl(1,0);
|
||||||
|
print "</td>\n";
|
||||||
|
print '<td valign="top">'.$account->bank."</td>\n";
|
||||||
|
print '<td valign="top">'.$account->number."</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 ($permission)
|
||||||
|
{
|
||||||
|
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$account->id."'>";
|
||||||
|
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||||
|
print $langs->trans("DeleteFromCat")."</a>";
|
||||||
|
}
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("ThisCategoryHasNoAccount")."</td></tr>";
|
||||||
|
}
|
||||||
|
print "</table>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||||
|
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||||
|
|
||||||
@@ -131,6 +132,10 @@ if ($_POST["action"] == 'add')
|
|||||||
$id = $account->create($user);
|
$id = $account->create($user);
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
|
// Category association
|
||||||
|
$categories = GETPOST('categories');
|
||||||
|
$account->setCategories($categories);
|
||||||
|
|
||||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -207,6 +212,10 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||||||
$result = $account->update($user);
|
$result = $account->update($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
|
// Category association
|
||||||
|
$categories = GETPOST('categories');
|
||||||
|
$account->setCategories($categories);
|
||||||
|
|
||||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -337,6 +346,20 @@ if ($action == 'create')
|
|||||||
print '<tr><td>'.$langs->trans("Web").'</td>';
|
print '<tr><td>'.$langs->trans("Web").'</td>';
|
||||||
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
|
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
|
||||||
|
|
||||||
|
// Tags-Categories
|
||||||
|
if ($conf->categorie->enabled)
|
||||||
|
{
|
||||||
|
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||||
|
$c = new Categorie($db);
|
||||||
|
$cats = $c->containing($account->id,Categorie::TYPE_ACCOUNT);
|
||||||
|
foreach($cats as $cat) {
|
||||||
|
$arrayselected[] = $cat->id;
|
||||||
|
}
|
||||||
|
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
// Comment
|
// Comment
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
@@ -591,6 +614,13 @@ else
|
|||||||
if ($account->url) print '</a>';
|
if ($account->url) print '</a>';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
// Categories
|
||||||
|
if($conf->categorie->enabled) {
|
||||||
|
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
|
print $form->showCategories($account->id,'account',1);
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||||
print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>';
|
print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>';
|
||||||
|
|
||||||
@@ -834,6 +864,20 @@ else
|
|||||||
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$account->url).'">';
|
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$account->url).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Tags-Categories
|
||||||
|
if ($conf->categorie->enabled)
|
||||||
|
{
|
||||||
|
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||||
|
$c = new Categorie($db);
|
||||||
|
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
||||||
|
foreach($cats as $cat) {
|
||||||
|
$arrayselected[] = $cat->id;
|
||||||
|
}
|
||||||
|
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
// Comment
|
// Comment
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
|
|||||||
@@ -892,6 +892,49 @@ class Account extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets object to supplied categories.
|
||||||
|
*
|
||||||
|
* Deletes object from existing categories not supplied.
|
||||||
|
* Adds it to non existing supplied categories.
|
||||||
|
* Existing categories are left untouch.
|
||||||
|
*
|
||||||
|
* @param int[]|int $categories Category or categories IDs
|
||||||
|
*/
|
||||||
|
public function setCategories($categories) {
|
||||||
|
// Handle single category
|
||||||
|
if (! is_array($categories)) {
|
||||||
|
$categories = array($categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get current categories
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
|
$c = new Categorie($this->db);
|
||||||
|
$existing = $c->containing($this->id, Categorie::TYPE_ACCOUNT, 'id');
|
||||||
|
|
||||||
|
// Diff
|
||||||
|
if (is_array($existing)) {
|
||||||
|
$to_del = array_diff($existing, $categories);
|
||||||
|
$to_add = array_diff($categories, $existing);
|
||||||
|
} else {
|
||||||
|
$to_del = array(); // Nothing to delete
|
||||||
|
$to_add = $categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process
|
||||||
|
foreach($to_del as $del) {
|
||||||
|
if ($c->fetch($del) > 0) {
|
||||||
|
$c->del_type($this, 'account');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($to_add as $add) {
|
||||||
|
if ($c->fetch($add) > 0) {
|
||||||
|
$c->add_type($this, 'account');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete bank account from database
|
* Delete bank account from database
|
||||||
|
|||||||
@@ -259,10 +259,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
-- Bank
|
-- Bank
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__);
|
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/virement.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/virement.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
|
||||||
|
-- Account - Categories
|
||||||
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'cat', 14__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=5', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
|
||||||
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/categories/card.php?action=create&type=5', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
|
||||||
-- Project
|
-- Project
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||||
|
|||||||
@@ -1049,14 +1049,19 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank');
|
$newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank');
|
||||||
|
|
||||||
$newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
|
$newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
|
||||||
$newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer);
|
|
||||||
|
|
||||||
$newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
|
$newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
|
||||||
$newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
|
$newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
|
||||||
|
|
||||||
$newmenu->add("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer);
|
$newmenu->add("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->categorie->enabled)) {
|
||||||
|
$langs->load("categories");
|
||||||
|
//$newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer);
|
||||||
|
$newmenu->add("/categories/index.php?type=5",$langs->trans("Rubriques"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags');
|
||||||
|
$newmenu->add("/categories/card.php?action=create&type=5",$langs->trans("NewCategory"),1,$user->rights->categorie->creer);
|
||||||
|
}
|
||||||
|
|
||||||
// Prelevements
|
// Prelevements
|
||||||
if (! empty($conf->prelevement->enabled))
|
if (! empty($conf->prelevement->enabled))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -394,5 +394,19 @@ ALTER TABLE llx_product_fournisseur_price ADD supplier_reputation varchar(10) NU
|
|||||||
|
|
||||||
ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price;
|
ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price;
|
||||||
|
|
||||||
|
CREATE TABLE llx_categorie_account
|
||||||
|
(
|
||||||
|
fk_categorie integer NOT NULL,
|
||||||
|
fk_account integer NOT NULL,
|
||||||
|
import_key varchar(14)
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_categorie_account ADD PRIMARY KEY pk_categorie_account (fk_categorie, fk_account);
|
||||||
|
ALTER TABLE llx_categorie_account ADD INDEX idx_categorie_account_fk_categorie (fk_categorie);
|
||||||
|
ALTER TABLE llx_categorie_account ADD INDEX idx_categorie_account_fk_account (fk_account);
|
||||||
|
|
||||||
|
ALTER TABLE llx_categorie_account ADD CONSTRAINT fk_categorie_account_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
|
||||||
|
ALTER TABLE llx_categorie_account ADD CONSTRAINT fk_categorie_account_fk_account FOREIGN KEY (fk_account) REFERENCES llx_bank_account (rowid);
|
||||||
|
|
||||||
-- Delete old deprecated field
|
-- Delete old deprecated field
|
||||||
ALTER TABLE llx_product_stock DROP COLUMN pmp;
|
ALTER TABLE llx_product_stock DROP COLUMN pmp;
|
||||||
|
|||||||
26
htdocs/install/mysql/tables/llx_categorie_account.key.sql
Normal file
26
htdocs/install/mysql/tables/llx_categorie_account.key.sql
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
|
-- Copyright (C) 2016 Frederic France <frederic.france@free.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
ALTER TABLE llx_categorie_account ADD PRIMARY KEY pk_categorie_account (fk_categorie, fk_account);
|
||||||
|
ALTER TABLE llx_categorie_account ADD INDEX idx_categorie_account_fk_categorie (fk_categorie);
|
||||||
|
ALTER TABLE llx_categorie_account ADD INDEX idx_categorie_account_fk_account (fk_account);
|
||||||
|
|
||||||
|
ALTER TABLE llx_categorie_account ADD CONSTRAINT fk_categorie_account_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
|
||||||
|
ALTER TABLE llx_categorie_account ADD CONSTRAINT fk_categorie_account_fk_account FOREIGN KEY (fk_account) REFERENCES llx_bank_account (rowid);
|
||||||
|
|
||||||
25
htdocs/install/mysql/tables/llx_categorie_account.sql
Normal file
25
htdocs/install/mysql/tables/llx_categorie_account.sql
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
|
-- Copyright (C) 2016 Frederic France <frederic.france@free.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ===========================================================================
|
||||||
|
|
||||||
|
CREATE TABLE llx_categorie_account
|
||||||
|
(
|
||||||
|
fk_categorie integer NOT NULL,
|
||||||
|
fk_account integer NOT NULL,
|
||||||
|
import_key varchar(14)
|
||||||
|
) ENGINE=innodb;
|
||||||
@@ -15,6 +15,7 @@ CustomersCategoriesArea=Customers tags/categories area
|
|||||||
ThirdPartyCategoriesArea=Third parties tags/categories area
|
ThirdPartyCategoriesArea=Third parties tags/categories area
|
||||||
MembersCategoriesArea=Members tags/categories area
|
MembersCategoriesArea=Members tags/categories area
|
||||||
ContactsCategoriesArea=Contacts tags/categories area
|
ContactsCategoriesArea=Contacts tags/categories area
|
||||||
|
AccountsCategoriesArea=Accounts tags/categories area
|
||||||
MainCats=Main tags/categories
|
MainCats=Main tags/categories
|
||||||
SubCats=Subcategories
|
SubCats=Subcategories
|
||||||
CatStatistics=Statistics
|
CatStatistics=Statistics
|
||||||
@@ -54,6 +55,8 @@ SupplierHasNoCategory=This supplier is not in any tags/categories
|
|||||||
CompanyHasNoCategory=This thirdparty is not in any tags/categories
|
CompanyHasNoCategory=This thirdparty is not in any tags/categories
|
||||||
MemberHasNoCategory=This member is not in any tags/categories
|
MemberHasNoCategory=This member is not in any tags/categories
|
||||||
ContactHasNoCategory=This contact is not in any tags/categories
|
ContactHasNoCategory=This contact is not in any tags/categories
|
||||||
|
ContactHasNoCategory=This contact is not in any tags/categories
|
||||||
|
AccountHasNoCategory=This account is not in any tags/categories
|
||||||
ClassifyInCategory=Add to tag/category
|
ClassifyInCategory=Add to tag/category
|
||||||
NoneCategory=None
|
NoneCategory=None
|
||||||
NotCategorized=Without tag/category
|
NotCategorized=Without tag/category
|
||||||
@@ -81,11 +84,13 @@ CustomersProspectsCategoriesShort=Custo./Prosp. categories
|
|||||||
ProductsCategoriesShort=Products tags/categories
|
ProductsCategoriesShort=Products tags/categories
|
||||||
MembersCategoriesShort=Members tags/categories
|
MembersCategoriesShort=Members tags/categories
|
||||||
ContactCategoriesShort=Contacts tags/categories
|
ContactCategoriesShort=Contacts tags/categories
|
||||||
|
AccountsCategoriesShort=Accounts tags/categories
|
||||||
ThisCategoryHasNoProduct=This category does not contain any product.
|
ThisCategoryHasNoProduct=This category does not contain any product.
|
||||||
ThisCategoryHasNoSupplier=This category does not contain any supplier.
|
ThisCategoryHasNoSupplier=This category does not contain any supplier.
|
||||||
ThisCategoryHasNoCustomer=This category does not contain any customer.
|
ThisCategoryHasNoCustomer=This category does not contain any customer.
|
||||||
ThisCategoryHasNoMember=This category does not contain any member.
|
ThisCategoryHasNoMember=This category does not contain any member.
|
||||||
ThisCategoryHasNoContact=This category does not contain any contact.
|
ThisCategoryHasNoContact=This category does not contain any contact.
|
||||||
|
ThisCategoryHasNoAccount=This category does not contain any account.
|
||||||
AssignedToCustomer=Assigned to a customer
|
AssignedToCustomer=Assigned to a customer
|
||||||
AssignedToTheCustomer=Assigned to the customer
|
AssignedToTheCustomer=Assigned to the customer
|
||||||
InternalCategory=Internal category
|
InternalCategory=Internal category
|
||||||
|
|||||||
Reference in New Issue
Block a user