Skip to content

Commit

Permalink
Modify code to match new v6 structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jun 15, 2017
1 parent 4009b18 commit 097be32
Show file tree
Hide file tree
Showing 20 changed files with 433 additions and 326 deletions.
22 changes: 11 additions & 11 deletions htdocs/accountancy/admin/categories_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@

if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
{
$search_country_id = '';
$search_country_id = '';
}

// Actions add or modify an entry into a dictionary
Expand Down Expand Up @@ -479,7 +479,7 @@
else $sql.=" WHERE ";
$sql.= " c.rowid = ".$search_country_id;
}

if ($sortfield)
{
// If sort order is "country", we use country_code instead
Expand All @@ -506,7 +506,7 @@
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';

print '<table class="noborder" width="100%">';

// Form to add a new line
Expand Down Expand Up @@ -546,9 +546,9 @@
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }

if ($valuetoshow != '')
{
print '<td align="'.$align.'">';
Expand Down Expand Up @@ -617,7 +617,7 @@
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');

// There is several pages
if ($num > $listlimit)
{
Expand All @@ -632,9 +632,9 @@
foreach ($fieldlist as $field => $value)
{
$showfield=1; // By defaut

if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }

if ($showfield)
{
if ($value == 'country')
Expand All @@ -661,7 +661,7 @@
}
print '</td>';
print '</tr>';

// Title of lines
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
Expand Down Expand Up @@ -700,7 +700,7 @@
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
// Affiche nom du champ
if ($showfield)
Expand Down Expand Up @@ -754,7 +754,7 @@
{
foreach ($fieldlist as $field => $value)
{

$showfield=1;
$align="left";
$valuetoshow=$obj->{$fieldlist[$field]};
Expand Down
94 changes: 67 additions & 27 deletions htdocs/accountancy/admin/defaultaccounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,26 @@
$action = GETPOST('action', 'alpha');


$list_account_main = array (
'ACCOUNTING_ACCOUNT_SUPPLIER',
'ACCOUNTING_ACCOUNT_CUSTOMER',
);

$list_account = array (
'ACCOUNTING_ACCOUNT_SUPPLIER',
'ACCOUNTING_ACCOUNT_CUSTOMER',
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
'ACCOUNTING_VAT_BUY_ACCOUNT',
'ACCOUNTING_VAT_SOLD_ACCOUNT',
'ACCOUNTING_VAT_PAY_ACCOUNT',
'ACCOUNTING_ACCOUNT_SUSPENSE',
'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
'DONATION_ACCOUNTINGACCOUNT',
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL',
'LOAN_ACCOUNTING_ACCOUNT_INTEREST',
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
'ACCOUNTING_VAT_BUY_ACCOUNT',
'ACCOUNTING_VAT_SOLD_ACCOUNT',
'ACCOUNTING_VAT_PAY_ACCOUNT',
'ACCOUNTING_ACCOUNT_SUSPENSE',
'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
'DONATION_ACCOUNTINGACCOUNT',
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL',
'LOAN_ACCOUNTING_ACCOUNT_INTEREST',
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'
);


Expand All @@ -93,15 +96,23 @@

if ($action == 'update') {
$error = 0;
foreach ( $list_account as $constname ) {

foreach ( $list_account_main as $constname ) {
$constvalue = GETPOST($constname, 'alpha');

if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}


foreach ( $list_account as $constname ) {
$constvalue = GETPOST($constname, 'alpha');

if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}

if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
Expand All @@ -114,11 +125,11 @@
* View
*/

llxHeader();

$form = new Form($db);
$formaccounting = new FormAccounting($db);

llxHeader();

$linkback = '';
print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy');

Expand All @@ -129,18 +140,47 @@
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">';

// Define Chart of accounts

// Define main accounts for thirdparty

print '<table class="noborder" width="100%">';

foreach ( $list_account as $key ) {

foreach ($list_account_main as $key) {

print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$keydesc=$key.'_Desc';

$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
print '<td>'; // Do not force align=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';
}


print "</table>\n";


print '<br>';

// Define default accounts

print '<table class="noborder" width="100%">';

foreach ($list_account as $key) {

print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
print '<td>' . $label . '</td>';
print '<td width="50%">' . $label . '</td>';
// Value
print '<td>'; // Do not force align=right, or it align also the content of the select box
print '<td>'; // Do not force align=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';
Expand Down
27 changes: 10 additions & 17 deletions htdocs/accountancy/admin/journals_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
// Must match ids defined into eldy.lib.php
// Must match ids defined into eldy.lib.php
$sourceList = array(
'1' => $langs->trans('AccountingJournalType1'),
'2' => $langs->trans('AccountingJournalType2'),
Expand All @@ -142,7 +142,7 @@

if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
{
$search_country_id = '';
$search_country_id = '';
}

// Actions add or modify an entry into a dictionary
Expand Down Expand Up @@ -371,13 +371,6 @@

print load_fiche_titre($titre,$linkback,$titlepicto);

if (empty($id))
{
print $langs->trans("DictionaryDesc");
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
}
print "<br>\n";


// Confirmation de la suppression de la ligne
if ($action == 'delete')
Expand All @@ -400,7 +393,7 @@
else $sql.=" WHERE ";
$sql.= " c.rowid = ".$search_country_id;
}

if ($sortfield)
{
// If sort order is "country", we use country_code instead
Expand All @@ -427,7 +420,7 @@
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';

print '<table class="noborder" width="100%">';

// Form to add a new line
Expand All @@ -453,7 +446,7 @@
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }

if ($valuetoshow != '')
{
print '<td align="'.$align.'">';
Expand Down Expand Up @@ -522,7 +515,7 @@
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');

// There is several pages
if ($num > $listlimit)
{
Expand Down Expand Up @@ -582,7 +575,7 @@
}
print '</td>';
print '</tr>';

if ($num)
{
// Lines with values
Expand Down Expand Up @@ -621,7 +614,7 @@
{
foreach ($fieldlist as $field => $value)
{

$showfield=1;
$align="left";
$valuetoshow=$obj->{$fieldlist[$field]};
Expand Down Expand Up @@ -682,10 +675,10 @@
else print '<td>&nbsp;</td>';

print '<td></td>';

print '</td>';
}

print "</tr>\n";
$i++;
}
Expand Down

0 comments on commit 097be32

Please sign in to comment.