diff --git a/htdocs/categories/class/api_category.class.php b/htdocs/categories/class/api_category.class.php index e17bb273758d6fc5a73cd26ce566421799348bf4..f5a5b1f037d9f942f7fec104f3f171801e5e5125 100644 --- a/htdocs/categories/class/api_category.class.php +++ b/htdocs/categories/class/api_category.class.php @@ -45,6 +45,7 @@ class CategoryApi extends DolibarrApi 2 => 'customer', 3 => 'member', 4 => 'contact', + 5 => 'account', ); /** diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 4cd38a693b66b7df5c85a5f23a348a1cf0d7e85a..b602bc0076da268d3f26838609aaaaa5b24b3d56 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * 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 * 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_CONTACT = 4; const TYPE_USER = 4; // categorie contact and user are same + // bank account + const TYPE_ACCOUNT = 5; /** * @var array ID mapping from type string @@ -62,6 +64,7 @@ class Categorie extends CommonObject 'member' => 3, 'contact' => 4, 'user' => 4, + 'account' => 5, ); /** * @var array Foreign keys mapping from type string @@ -75,6 +78,7 @@ class Categorie extends CommonObject 'member' => 'member', 'contact' => 'socpeople', 'user' => 'user', + 'account' => 'account', ); /** * @var array Category tables mapping from type string @@ -88,6 +92,7 @@ class Categorie extends CommonObject 'member' => 'member', 'contact' => 'contact', 'user' => 'user', + 'account' => 'account', ); /** * @var array Object class mapping from type string @@ -101,6 +106,7 @@ class Categorie extends CommonObject 'member' => 'Adherent', 'contact' => 'Contact', 'user' => 'User', + 'account' => 'Account', ); /** * @var array Object table mapping from type string @@ -114,6 +120,7 @@ class Categorie extends CommonObject 'member' => 'adherent', 'contact' => 'socpeople', 'user' => 'user', + 'account' => 'bank_account', ); public $element='category'; @@ -138,6 +145,8 @@ class Categorie extends CommonObject * @see Categorie::TYPE_CUSTOMER * @see Categorie::TYPE_MEMBER * @see Categorie::TYPE_CONTACT + * @see Categorie::TYPE_USER + * @see Categorie::TYPE_ACCOUNT */ var $type; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 02b83fcaef81d302d28cd2c5be1b93490699b295..f7102bc44e2063271a29666ee0ba176993c53f2e 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -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_MEMBER) $title=$langs->trans("MembersCategoriesArea"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea"); +elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea"); 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 783326c1e4f900d823423aa41956545bb26d52fc..72c184af1131ce62925a97fc2162097139af3907 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -93,12 +93,13 @@ $form = new Form($db); if ($object->id) { - $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_CUSTOMER) $title=$langs->trans("CustomersCategoryShort"); 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"); + else $title=$langs->trans("Category"); $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'photos', $title, 0, 'category'); diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index f3969793ef0fd8df9c69ab3e5843caaae5651082..9d88098e56bc6f393e83c94fb37571af1dd14d4b 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -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_MEMBER) $title=$langs->trans("MembersCategoryShort"); 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); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a1486ff344ff9707a7bdbd3f84a87effe3b0c587..284add47addfd6bd1735db16be2ede7213897e7b 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -107,7 +107,14 @@ if ($id > 0 && $removeelem > 0) $tmpobject = new Contact($db); $result = $tmpobject->fetch($removeelem); $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); 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_MEMBER) $title=$langs->trans("MembersCategoryShort"); 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); @@ -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(); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 102e6a6861a72c39fd65739e88e2e1ac430b6373..e6043167b22a9401e1d2d24ae25ed079fc3ff39d 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -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 . '/compta/bank/class/account.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 . '/accountancy/class/html.formventilation.class.php'; @@ -131,6 +132,10 @@ if ($_POST["action"] == 'add') $id = $account->create($user); if ($id > 0) { + // Category association + $categories = GETPOST('categories'); + $account->setCategories($categories); + $_GET["id"]=$id; // Force chargement page en mode visu } else { @@ -207,6 +212,10 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $result = $account->update($user); if ($result >= 0) { + // Category association + $categories = GETPOST('categories'); + $account->setCategories($categories); + $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu } else @@ -337,6 +346,20 @@ if ($action == 'create') 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>'; + // 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 print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>'; print '<td colspan="3">'; @@ -591,6 +614,13 @@ else if ($account->url) print '</a>'; 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 '<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></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 print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>'; print '<td colspan="3">'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 478633490f824de66f902a072100a781b9831263..92c21742baa512b7d05b1e2602d0ad096404f9b3 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -893,6 +893,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 diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 28c1efe8a6c6b0f031f4d7669a2b0d8ecb540245..c0fa6b9fad9fac0ce9a6cd5bee8c1df13d6f481f 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -259,10 +259,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- 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 && ($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', 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__); +-- 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 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__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7cb2eb4120028f6cf7f03c7dbb6cbf49c068686f..67708eba5fe7b2d7906602ebc3fcde7fff9677ce 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -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/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/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); $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 if (! empty($conf->prelevement->enabled)) { diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 8e0092a73c089bf9b46fef1550fee3847f4ff505..20c1c1d0de3c720af309dad8d51dc202d56c89d7 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -407,6 +407,20 @@ 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; +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 ALTER TABLE llx_product_stock DROP COLUMN pmp; diff --git a/htdocs/install/mysql/tables/llx_categorie_account.key.sql b/htdocs/install/mysql/tables/llx_categorie_account.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..ccf33bcac0905d4e379282c875d4c2fab35fd023 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_account.key.sql @@ -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); + diff --git a/htdocs/install/mysql/tables/llx_categorie_account.sql b/htdocs/install/mysql/tables/llx_categorie_account.sql new file mode 100644 index 0000000000000000000000000000000000000000..8bee67b1b4035bf9da29c72002ebba17dfacc783 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_account.sql @@ -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; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index ccf22bb5003ca9dd4d684ff764aeb69eef7f739b..0235b51ccb358733967ed8f9cac324d98e5b3c0c 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -15,6 +15,7 @@ CustomersCategoriesArea=Customers tags/categories area ThirdPartyCategoriesArea=Third parties tags/categories area MembersCategoriesArea=Members tags/categories area ContactsCategoriesArea=Contacts tags/categories area +AccountsCategoriesArea=Accounts tags/categories area MainCats=Main tags/categories SubCats=Subcategories CatStatistics=Statistics @@ -54,6 +55,8 @@ SupplierHasNoCategory=This supplier 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 +ContactHasNoCategory=This contact is not in any tags/categories +AccountHasNoCategory=This account is not in any tags/categories ClassifyInCategory=Add to tag/category NoneCategory=None NotCategorized=Without tag/category @@ -81,11 +84,13 @@ CustomersProspectsCategoriesShort=Custo./Prosp. categories ProductsCategoriesShort=Products tags/categories MembersCategoriesShort=Members tags/categories ContactCategoriesShort=Contacts tags/categories +AccountsCategoriesShort=Accounts 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. AssignedToCustomer=Assigned to a customer AssignedToTheCustomer=Assigned to the customer InternalCategory=Internal category