forked from Wavyzz/dolibarr
NEW: Add category to bank transaction in various payment
This commit is contained in:
@@ -63,6 +63,7 @@ class PaymentVarious extends CommonObject
|
|||||||
public $amount;
|
public $amount;
|
||||||
public $type_payment;
|
public $type_payment;
|
||||||
public $num_payment;
|
public $num_payment;
|
||||||
|
public $category_transaction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string various payments label
|
* @var string various payments label
|
||||||
@@ -420,7 +421,7 @@ class PaymentVarious extends CommonObject
|
|||||||
$this->label,
|
$this->label,
|
||||||
$sign * abs($this->amount),
|
$sign * abs($this->amount),
|
||||||
$this->num_payment,
|
$this->num_payment,
|
||||||
'',
|
($category_transaction > 0 ? $category_transaction : 0),
|
||||||
$user
|
$user
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ $paymenttype=GETPOST("paymenttype", "int");
|
|||||||
$accountancy_code = GETPOST("accountancy_code", "alpha");
|
$accountancy_code = GETPOST("accountancy_code", "alpha");
|
||||||
$subledger_account = GETPOST("subledger_account", "alpha");
|
$subledger_account = GETPOST("subledger_account", "alpha");
|
||||||
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
|
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
|
||||||
|
$cat1 = GETPOST("cat1", 'alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid", "int");
|
$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
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('variouscard','globalcard'));
|
$hookmanager->initHooks(array('variouscard','globalcard'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@@ -113,6 +112,7 @@ if (empty($reshook))
|
|||||||
$object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
|
$object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
|
||||||
$object->num_payment=GETPOST("num_payment", 'alpha');
|
$object->num_payment=GETPOST("num_payment", 'alpha');
|
||||||
$object->fk_user_author=$user->id;
|
$object->fk_user_author=$user->id;
|
||||||
|
$object->category_transaction=GETPOST("cat1", 'alpha');
|
||||||
|
|
||||||
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
|
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
|
||||||
$object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "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 */
|
/* Create mode */
|
||||||
@@ -259,7 +269,7 @@ if ($action == 'create')
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<tr><td>';
|
print '<tr><td class="titlefieldcreate">';
|
||||||
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
|
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||||
print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1);
|
print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -314,17 +324,50 @@ if ($action == 'create')
|
|||||||
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Category
|
||||||
|
if (is_array($options) && count($options))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Rubrique").'</td><td>';
|
||||||
|
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled))
|
||||||
|
{
|
||||||
|
$formproject=new FormProjets($db);
|
||||||
|
|
||||||
|
// Associated project
|
||||||
|
$langs->load("projects");
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||||
|
|
||||||
|
$numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 '</td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
// Accountancy account
|
// Accountancy account
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
|
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountAccounting").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
else // For external software
|
else // For external software
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("AccountAccounting").'</td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountAccounting").'</td>';
|
||||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code" value="'.$accountancy_code.'">';
|
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code" value="'.$accountancy_code.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@@ -351,26 +394,6 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project
|
|
||||||
if (! empty($conf->projet->enabled))
|
|
||||||
{
|
|
||||||
$formproject=new FormProjets($db);
|
|
||||||
|
|
||||||
// Associated project
|
|
||||||
$langs->load("projects");
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
|
||||||
|
|
||||||
$numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|||||||
Reference in New Issue
Block a user