FIX If bank module on, field must be required to register payment of

expense report.
This commit is contained in:
Laurent Destailleur 2017-02-15 23:22:47 +01:00
parent d3eff46305
commit 089aa1df33
4 changed files with 21 additions and 23 deletions

View File

@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("bills");
$langs->load("banks");
$chid=GETPOST("id");
$action=GETPOST('action');
@ -62,22 +63,22 @@ if ($action == 'add_payment')
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
if (! $_POST["fk_typepayment"] > 0)
if (! ($_POST["fk_typepayment"] > 0))
{
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")), null, 'errors');
$error++;
}
if ($datepaid == '')
{
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date"));
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")), null, 'errors');
$error++;
}
if (! empty($conf->banque->enabled) && ! $accountid > 0)
if (! empty($conf->banque->enabled) && ! ($accountid > 0))
{
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit"));
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToDebit")), null, 'errors');
$error++;
}
if (! $error)
{
$paymentid = 0;
@ -163,7 +164,6 @@ $form=new Form($db);
// Form to create expense report payment
if (GETPOST("action") == 'create')
{
$expensereport = new ExpenseReport($db);
$expensereport->fetch($chid);
@ -171,11 +171,6 @@ if (GETPOST("action") == 'create')
print load_fiche_titre($langs->trans("DoPayment"));
if ($mesg)
{
print "<div class=\"error\">$mesg</div>";
}
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.$chid.'">';
@ -222,12 +217,15 @@ if (GETPOST("action") == 'create')
print "</td>\n";
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
print '<td colspan="2">';
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list
print '</td></tr>';
if (! empty($conf->banque->enabled))
{
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
print '<td colspan="2">';
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list
print '</td></tr>';
}
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
@ -243,9 +241,7 @@ if (GETPOST("action") == 'create')
dol_fiche_end();
/*
* Autres charges impayees
*/
// List of expenses ereport not already paid completely
$num = 1;
$i = 0;

View File

@ -1700,8 +1700,10 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
else $appli.=" ".DOL_VERSION;
print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
if ($doliurl) print '<a class="help" target="_blank" href="'.$doliurl.'">';
else print '<span class="help">';
print $appli;
if ($doliurl) print '</a>';
else print '</span>';
print '</div>'."\n";
// Link to bugtrack

View File

@ -1475,7 +1475,7 @@ font.vsmenudisabled { font-size:<?php print $fontsize ?>px; font-family: <?php p
a.vsmenu:link, a.vsmenu:visited { color: #<?php echo $colortextbackvmenu; ?>; white-space: nowrap; }
font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; }
a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
.vmenu div.blockvmenufirst, .vmenu div.blockvmenulogo, .vmenu div.blockvmenusearchphone, .vmenu div.blockvmenubookmarks
{

View File

@ -1512,7 +1512,7 @@ font.vsmenudisabled { font-size:<?php print $fontsize ?>px; font-family: <?php p
a.vsmenu:link, a.vsmenu:visited { color: #<?php echo $colortextbackvmenu; ?>; white-space: nowrap; }
font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; }
a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks