diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php
index 5a7ac205fe5..fad76c45d1b 100644
--- a/htdocs/compta/bank/class/paymentvarious.class.php
+++ b/htdocs/compta/bank/class/paymentvarious.class.php
@@ -63,6 +63,7 @@ class PaymentVarious extends CommonObject
public $amount;
public $type_payment;
public $num_payment;
+ public $category_transaction;
/**
* @var string various payments label
@@ -414,13 +415,13 @@ class PaymentVarious extends CommonObject
$sign=1;
if ($this->sens == '0') $sign=-1;
- $bank_line_id = $acc->addline(
+ $bank_line_id = $acc->addline(
$this->datep,
$this->type_payment,
$this->label,
$sign * abs($this->amount),
$this->num_payment,
- '',
+ ($category_transaction > 0 ? $category_transaction : 0),
$user
);
diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index a1c1d8ae349..176fea7e8db 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -45,14 +45,15 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
-$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
-$label=GETPOST("label", "alpha");
-$sens=GETPOST("sens", "int");
-$amount=GETPOST("amount", "alpha");
-$paymenttype=GETPOST("paymenttype", "int");
-$accountancy_code=GETPOST("accountancy_code", "alpha");
-$subledger_account=GETPOST("subledger_account", "alpha");
-$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
+$accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
+$label = GETPOST("label", "alpha");
+$sens = GETPOST("sens", "int");
+$amount = GETPOST("amount", "alpha");
+$paymenttype = GETPOST("paymenttype", "int");
+$accountancy_code = GETPOST("accountancy_code", "alpha");
+$subledger_account = GETPOST("subledger_account", "alpha");
+$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
+$cat1 = GETPOST("cat1", 'alpha');
// Security check
$socid = GETPOST("socid", "int");
@@ -64,8 +65,6 @@ $object = new PaymentVarious($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('variouscard','globalcard'));
-
-
/**
* Actions
*/
@@ -113,6 +112,7 @@ if (empty($reshook))
$object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
$object->num_payment=GETPOST("num_payment", 'alpha');
$object->fk_user_author=$user->id;
+ $object->category_transaction=GETPOST("cat1", 'alpha');
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
$object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "";
@@ -240,6 +240,16 @@ if ($id)
}
}
+$options = array();
+
+// Load bank groups
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
+$bankcateg = new BankCateg($db);
+
+foreach ($bankcateg->fetchAll() as $bankcategory) {
+ $options[$bankcategory->id] = $bankcategory->label;
+}
+
/* ************************************************************************** */
/* */
/* Create mode */
@@ -259,7 +269,7 @@ if ($action == 'create')
print '
';
// Date payment
- print '';
+ print ' ';
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).' ';
print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1);
print ' ';
@@ -314,17 +324,50 @@ if ($action == 'create')
print ' '."\n";
}
+ // Category
+ if (is_array($options) && count($options))
+ {
+ print ''.$langs->trans("Rubrique").' ';
+ print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
+ print ' ';
+ }
+
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $formproject=new FormProjets($db);
+
+ // Associated project
+ $langs->load("projects");
+
+ print ''.$langs->trans("Project").' ';
+
+ $numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
+
+ print ' ';
+ }
+
+ // Other attributes
+ $parameters=array();
+ $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+
+ print '';
+ print '
';
+ print ' ';
+
+ print '';
// Accountancy account
if (! empty($conf->accounting->enabled))
{
- print ''.$langs->trans("AccountAccounting").' ';
+ print ''.$langs->trans("AccountAccounting").' ';
print '';
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
print ' ';
}
else // For external software
{
- print ''.$langs->trans("AccountAccounting").' ';
+ print ''.$langs->trans("AccountAccounting").' ';
print ' ';
print ' ';
}
@@ -351,26 +394,6 @@ if ($action == 'create')
print '';
}
- // Project
- if (! empty($conf->projet->enabled))
- {
- $formproject=new FormProjets($db);
-
- // Associated project
- $langs->load("projects");
-
- print ''.$langs->trans("Project").' ';
-
- $numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
-
- print ' ';
- }
-
- // Other attributes
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
-
print '
';
dol_fiche_end();