Merge pull request #11255 from aspangaro/10.0_accountancy2
FIX Lost functionnality - Add category to bank transaction with various payment
This commit is contained in:
commit
a7dccf1617
@ -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
|
||||||
@ -414,13 +415,13 @@ class PaymentVarious extends CommonObject
|
|||||||
$sign=1;
|
$sign=1;
|
||||||
if ($this->sens == '0') $sign=-1;
|
if ($this->sens == '0') $sign=-1;
|
||||||
|
|
||||||
$bank_line_id = $acc->addline(
|
$bank_line_id = $acc->addline(
|
||||||
$this->datep,
|
$this->datep,
|
||||||
$this->type_payment,
|
$this->type_payment,
|
||||||
$this->label,
|
$this->label,
|
||||||
$sign * abs($this->amount),
|
$sign * abs($this->amount),
|
||||||
$this->num_payment,
|
$this->num_payment,
|
||||||
'',
|
($this->category_transaction > 0 ? $this->category_transaction : 0),
|
||||||
$user
|
$user
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -45,14 +45,15 @@ $action = GETPOST('action', 'alpha');
|
|||||||
$cancel = GETPOST('cancel', 'aZ09');
|
$cancel = GETPOST('cancel', 'aZ09');
|
||||||
$backtopage = GETPOST('backtopage', 'alpha');
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
|
$accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
|
||||||
$label=GETPOST("label", "alpha");
|
$label = GETPOST("label", "alpha");
|
||||||
$sens=GETPOST("sens", "int");
|
$sens = GETPOST("sens", "int");
|
||||||
$amount=GETPOST("amount", "alpha");
|
$amount = GETPOST("amount", "alpha");
|
||||||
$paymenttype=GETPOST("paymenttype", "int");
|
$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'));
|
||||||
|
$category_transaction = GETPOST("category_transaction", '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("category_transaction", '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("RubriquesTransactions").'</td><td>';
|
||||||
|
print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 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();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user