Debug split of payment salary into salary + payment

This commit is contained in:
Laurent Destailleur 2021-03-04 21:33:29 +01:00
parent d0ba10efe5
commit aee6d78928
4 changed files with 22 additions and 17 deletions

View File

@ -86,7 +86,7 @@ PaymentCustomerInvoice=Customer invoice payment
PaymentSupplierInvoice=vendor invoice payment PaymentSupplierInvoice=vendor invoice payment
PaymentSocialContribution=Social/fiscal tax payment PaymentSocialContribution=Social/fiscal tax payment
PaymentVat=VAT payment PaymentVat=VAT payment
AutomaticCreationPayment=Automatically create a total payment AutomaticCreationPayment=Automatically record the payment of the salary
ListPayment=List of payments ListPayment=List of payments
ListOfCustomerPayments=List of customer payments ListOfCustomerPayments=List of customer payments
ListOfSupplierPayments=List of vendor payments ListOfSupplierPayments=List of vendor payments

View File

@ -5,6 +5,7 @@ SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for wage paymen
CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Automatically create a total payment" when creating a Salary CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Automatically create a total payment" when creating a Salary
Salary=Salary Salary=Salary
Salaries=Salaries Salaries=Salaries
NewSalary=New salary
NewSalaryPayment=New salary card NewSalaryPayment=New salary card
AddSalaryPayment=Add salary payment AddSalaryPayment=Add salary payment
SalaryPayment=Salary payment SalaryPayment=Salary payment

View File

@ -144,12 +144,13 @@ if ($action == 'add' && empty($cancel)) {
if (empty($datev)) $datev = $datep; if (empty($datev)) $datev = $datep;
$type_payment = GETPOST("paymenttype", 'alpha'); $type_payment = GETPOST("paymenttype", 'alpha');
$amount = price2num(GETPOST("amount", 'alpha'), 'MT', 2);
$object->accountid = GETPOST("accountid", 'int') > 0 ? GETPOST("accountid", "int") : 0; $object->accountid = GETPOST("accountid", 'int') > 0 ? GETPOST("accountid", "int") : 0;
$object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", "int") : 0; $object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", "int") : 0;
$object->datev = $datev; $object->datev = $datev;
$object->datep = $datep; $object->datep = $datep;
$object->amount = $amount = price2num(GETPOST("amount", 'alpha')); $object->amount = $amount;
$object->label = GETPOST("label", 'alphanohtml'); $object->label = GETPOST("label", 'alphanohtml');
$object->datesp = $datesp; $object->datesp = $datesp;
$object->dateep = $dateep; $object->dateep = $dateep;
@ -272,7 +273,7 @@ if ($action == 'confirm_delete') {
if ($action == 'update' && !$_POST["cancel"] && $user->rights->salaries->write) { if ($action == 'update' && !$_POST["cancel"] && $user->rights->salaries->write) {
$amount = price2num(GETPOST('amount')); $amount = price2num(GETPOST('amount'), 'MT', 2);
if (empty($amount)) { if (empty($amount)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
@ -384,7 +385,7 @@ if ($action == 'create') {
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print load_fiche_titre($langs->trans("NewSalaryPayment"), '', 'salary'); print load_fiche_titre($langs->trans("NewSalary"), '', 'salary');
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
@ -424,13 +425,13 @@ if ($action == 'create') {
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).'</td><td>'; print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).'</td><td>';
$noactive = 0; // We keep active and unactive users $noactive = 0; // We keep active and unactive users
print $form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive); print img_picto('', 'user', 'class="paddingrighonly"').$form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive);
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td><td>'; print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="label" id="label" class="minwidth300" value="'.(GETPOST("label") ?GETPOST("label") : $langs->trans("SalaryPayment")).'">'; print '<input name="label" id="label" class="minwidth300" value="'.(GETPOST("label") ?GETPOST("label") : $langs->trans("Salary")).'">';
print '</td></tr>'; print '</td></tr>';
// Date start period // Date start period
@ -460,10 +461,23 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
} }
// Comments
print '<tr class="hide_if_no_auto_create_payment">';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'">'.GETPOST('note', 'restricthtml').'</textarea></td>';
print '</tr>';
print '<tr><td colspan="2"><hr></td></tr>';
// Auto create payment
print '<tr><td>'.$langs->trans('AutomaticCreationPayment').'</td>';
print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_paiement) ? '' : 'checked="checked"') . ' value="1"></td></tr>'."\n"; // Date payment
// Bank // Bank
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled)) {
print '<tr><td id="label_fk_account">'; print '<tr><td id="label_fk_account">';
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>'; print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
print img_picto('', 'bank_account', 'class="paddingrighonly"');
$form->select_comptes($accountid, "accountid", 0, '', 1); // Affiche liste des comptes courant $form->select_comptes($accountid, "accountid", 0, '', 1); // Affiche liste des comptes courant
print '</td></tr>'; print '</td></tr>';
} }
@ -474,10 +488,6 @@ if ($action == 'create') {
$form->select_types_paiements(GETPOST("paymenttype", 'aZ09'), "paymenttype", ''); $form->select_types_paiements(GETPOST("paymenttype", 'aZ09'), "paymenttype", '');
print '</td></tr>'; print '</td></tr>';
// Auto create payment
print '<tr><td>'.$langs->trans('AutomaticCreationPayment').'</td>';
print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_paiement) ? '' : 'checked="checked"') . ' value="1"></td></tr>'."\n"; // Date payment
// Date payment // Date payment
print '<tr class="hide_if_no_auto_create_payment"><td>'; print '<tr class="hide_if_no_auto_create_payment"><td>';
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>'; print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
@ -499,12 +509,6 @@ 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";
} }
// Comments
print '<tr class="hide_if_no_auto_create_payment">';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '</tr>';
// Bouton Save payment // Bouton Save payment
print '<tr class="hide_if_no_auto_create_payment"><td>'; print '<tr class="hide_if_no_auto_create_payment"><td>';
print $langs->trans("ClosePaidSalaryAutomatically"); print $langs->trans("ClosePaidSalaryAutomatically");

View File

@ -45,7 +45,7 @@ class Salary extends CommonObject
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
public $picto = 'payment'; public $picto = 'salary';
public $tms; public $tms;