Update module accounting

This commit is contained in:
aspangaro 2014-10-31 07:37:59 +01:00
parent 6e0e812531
commit e43de8b815
4 changed files with 49 additions and 26 deletions

View File

@ -37,6 +37,12 @@ $mesg = '';
$action = GETPOST('action');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$search= GETPOST("search");
$search_account = GETPOST("search_account");
$search_label = GETPOST("search_label");
$search_accountparent = GETPOST("search_accountparent");
$search_pcgtype = GETPOST("search_pcgtype");
$search_pcgsubtype = GETPOST("search_pcgsubtype");
// Security check
if (!$user->admin)
@ -83,6 +89,16 @@ if ($action == 'disable') {
}
}
if (GETPOST("button_removefilter"))
{
$search="";
$search_account="";
$search_label="";
$search_accountparent="";
$search_pcgtype="";
$search_pcgsubtype="";
}
/*
* View
*
@ -96,20 +112,20 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as aa, " . MAIN_DB_PREFIX
$sql .= " WHERE aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $pcgver;
if (strlen(trim($_GET["search_account"]))) {
$sql .= " AND aa.account_number like '%" . $_GET["search_account"] . "%'";
if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
}
if (strlen(trim($_GET["search_label"]))) {
$sql .= " AND aa.label like '%" . $_GET["search_label"] . "%'";
if (strlen(trim($search_label))) {
$sql .= " AND aa.label like '%" . $search_label . "%'";
}
if (strlen(trim($_GET["search_accountparent"]))) {
$sql .= " AND aa.account_parent like '%" . $_GET["search_accountparent"] . "%'";
if (strlen(trim($search_accountparent))) {
$sql .= " AND aa.account_parent like '%" . $search_accountparent . "%'";
}
if (strlen(trim($_GET["search_pcgtype"]))) {
$sql .= " AND aa.pcg_type like '%" . $_GET["search_pcgtype"] . "%'";
if (strlen(trim($search_pcgtype))) {
$sql .= " AND aa.pcg_type like '%" . $search_pcgtype . "%'";
}
if (strlen(trim($_GET["search_pcgsubtype"]))) {
$sql .= " AND aa.pcg_subtype like '%" . $_GET["search_pcgsubtype"] . "%'";
if (strlen(trim($search_pcgsubtype))) {
$sql .= " AND aa.pcg_subtype like '%" . $search_pcgsubtype . "%'";
}
$sql .= $db->order($sortfield, $sortorder);
@ -141,18 +157,20 @@ if ($result) {
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Active"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre(" ");
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . GETPOST("search_account") . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . GETPOST("search_label") . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_accountparent" value="' . GETPOST("search_accountparent") . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgtype" value="' . GETPOST("search_pcgtype") . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgsubtype" value="' . GETPOST("search_pcgsubtype") . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_accountparent" value="' . $search_accountparent . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp; ';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</tr>';
@ -180,11 +198,13 @@ if ($result) {
}
print '</td>';
print '<td>';
// Action
print '<td align="center">';
if ($user->admin) {
print '<a href="./card.php?action=update&id=' . $obj->rowid . '">';
print img_edit();
print '</a>&nbsp;';
print '</a>';
print '&nbsp;';
print '<a href="./card.php?action=delete&id=' . $obj->rowid . '">';
print img_delete();
print '</a>';

View File

@ -181,11 +181,6 @@ else if ($id)
if ($action == 'update')
{
// WYSIWYG Editor
$htmlacc = new FormVentilation($db);
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$soc = new Societe($db);
if ($object->socid) {
$soc->fetch($object->socid);

View File

@ -952,7 +952,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->accounting->enabled))
{
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
$newmenu->add("/accountancy/admin/account.php?mainmenu=home", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
$newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount');
}
}

View File

@ -229,6 +229,14 @@ class modAccounting extends DolibarrModules
$this->rights[$r][4] = 'fiscalyear';
$this->rights[$r][5] = '';
$r++;
$this->rights[$r][0] = 50440;
$this->rights[$r][1] = 'Manage chart of accounts';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'chartofaccount';
$this->rights[$r][5] = '';
$r++;
// Main menu entries
$this->menus = array();