Removed old code (Function select_pcgtype/subtype)
This commit is contained in:
parent
ba7e754174
commit
a086b82f84
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card of accounting account
|
||||
*/
|
||||
|
||||
@ -59,7 +59,7 @@ if (GETPOST('cancel'))
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
{
|
||||
if (! $cancel) {
|
||||
@ -86,7 +86,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
} else {
|
||||
$account_parent = GETPOST('account_parent','int');
|
||||
}
|
||||
|
||||
|
||||
$object->fk_pcg_version = $obj->pcg_version;
|
||||
$object->pcg_type = GETPOST('pcg_type');
|
||||
$object->pcg_subtype = GETPOST('pcg_subtype');
|
||||
@ -95,7 +95,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
$object->account_category = GETPOST('account_category');
|
||||
$object->label = GETPOST('label', 'alpha');
|
||||
$object->active = 1;
|
||||
|
||||
|
||||
$res = $object->create($user);
|
||||
if ($res == - 3) {
|
||||
$error = 1;
|
||||
@ -124,9 +124,9 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
} else if ($action == 'edit' && $user->rights->accounting->chartofaccount) {
|
||||
if (! $cancel) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
|
||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result2 = $db->query($sql);
|
||||
$obj = $db->fetch_object($result2);
|
||||
@ -156,9 +156,9 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
$object->account_parent = $account_parent;
|
||||
$object->account_category = GETPOST('account_category');
|
||||
$object->label = GETPOST('label', 'alpha');
|
||||
|
||||
|
||||
$result = $object->update($user);
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
$urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id);
|
||||
header("Location: " . $urltogo);
|
||||
@ -205,13 +205,13 @@ $accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
// Create mode
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans('NewAccountingAccount'));
|
||||
|
||||
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Chart of account
|
||||
@ -219,8 +219,7 @@ if ($action == 'create') {
|
||||
print '<td>';
|
||||
print $accountsystem->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
// Account number
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"></td></tr>';
|
||||
@ -245,56 +244,54 @@ if ($action == 'create') {
|
||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">';
|
||||
//print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of acounts subtype
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">';
|
||||
//print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
} else if ($id) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
|
||||
$head = accounting_prepare_head($object);
|
||||
|
||||
|
||||
// Edit mode
|
||||
if ($action == 'update')
|
||||
{
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
|
||||
|
||||
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="edit">';
|
||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Account number
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
|
||||
|
||||
|
||||
// Label
|
||||
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
|
||||
print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>';
|
||||
|
||||
|
||||
// Account parent
|
||||
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
||||
print '<td>';
|
||||
@ -302,15 +299,14 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print '</td></tr>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||
print '<td>';
|
||||
//print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1);
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -318,29 +314,27 @@ if ($action == 'create') {
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">';
|
||||
//print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
|
||||
// View mode
|
||||
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
|
||||
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Account number
|
||||
print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>';
|
||||
print '<td>' . $object->account_number . '</td>';
|
||||
@ -378,31 +372,30 @@ if ($action == 'create') {
|
||||
} else {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
}*/
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Actions buttons
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
if (! empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>';
|
||||
}
|
||||
|
||||
|
||||
if (! empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -146,36 +146,35 @@ if ($result) {
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
||||
print '<td align="left">';
|
||||
print $objp->accounting;
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="left">';
|
||||
print '<input name="label" size="30" value="">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Colonne choix du compte
|
||||
print '<td>';
|
||||
print $htmlacc->select_account($accounting->account_parent, 'AccountParent');
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcgType');
|
||||
print '<input type="text" name="pcgType" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$accounting->pcg_type).'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcgSubType');
|
||||
print '<input type="text" name="pcgSubType" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$accounting->pcg_subtype).'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Colonne choix ligne a ventiler
|
||||
|
||||
$checked = ('label' == 'O') ? ' checked' : '';
|
||||
|
||||
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="mesCasesCochees[]" ' . $checked . ' value="' . $objp->accounting . '"/>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
|
||||
@ -151,97 +151,6 @@ class FormVentilation extends Form
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of accounts with label by class of accounts
|
||||
*
|
||||
* @param string $selectid Preselected pcg_type
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
*
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) {
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT DISTINCT pcg_type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " ORDER BY pcg_type";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if ($obj->pcg_type != '-1')
|
||||
{
|
||||
$options[$obj->pcg_type] = $obj->pcg_type;
|
||||
}
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200');
|
||||
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of accounts with label by sub_class of accounts
|
||||
*
|
||||
* @param string $selectid Preselected pcg_type
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
*
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array())
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT DISTINCT pcg_subtype ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " ORDER BY pcg_subtype";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if ($obj->pcg_type != '-1')
|
||||
{
|
||||
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
|
||||
}
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200');
|
||||
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of auxilary thirdparty accounts
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user