diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index 2b9b50fea15..d554f672d1d 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -66,6 +66,8 @@ switch ( $_GET['action'] ) $encaisse = $obj_facturation->montant_encaisse(); $obj_facturation->montant_rendu ( $encaisse - $total ); + + } else { $obj_facturation->paiement_le ($_POST['txtDatePaiement']); } @@ -266,6 +268,18 @@ switch ( $_GET['action'] ) $errmsg=$paiement->error; $error++; } + } + + if (! $error) + { + if ($invoice->total_ttc == $obj_facturation->prix_total_ttc() + && $obj_facturation->mode_reglement() != 'DIFF') + { + // We set status to payed + $result=$invoice->set_paid($user); + //print 'eeeee';exit; + } + } } else diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index c87232f4fb2..97b0dd9f9c1 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -70,7 +70,7 @@ $mesg=''; */ $dateop=-1; -if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) +if ($action == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) { if (price2num($_POST["credit"]) > 0) @@ -99,7 +99,7 @@ if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user- $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); if ($insertid > 0) { - Header("Location: account.php?account=" . $account); + Header("Location: account.php?account=" . $account."&action=addline"); exit; } else @@ -109,10 +109,10 @@ if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user- } else { - $_GET["action"]='addline'; + $action='addline'; } } -if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->rights->banque->modifier) +if ($action == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->rights->banque->modifier) { $accline=new AccountLine($db); $accline->fetch($_GET["rowid"]); @@ -329,7 +329,7 @@ if ($account || $_GET["ref"]) // Confirmation delete - if ($_GET["action"]=='delete') + if ($action == 'delete') { $text=$langs->trans('ConfirmDeleteTransaction'); $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?account='.$acct->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete'); @@ -340,14 +340,14 @@ if ($account || $_GET["ref"]) print ''; // Show title - if (! $_GET["action"]=='addline' && ! $_GET["action"]=='delete') + if ($action != 'addline' && $action =='delete') { print ''; } // Form to add a transaction with no invoice - if ($user->rights->banque->modifier && $_GET["action"]=='addline') + if ($user->rights->banque->modifier && $action == 'addline') { print ''; print ''; @@ -742,10 +742,11 @@ if ($account || $_GET["ref"]) /* * Boutons actions */ - if ($_GET["action"] != 'addline' && $_GET["action"] != 'delete') + + if ($action != 'delete') { - print '
'; - + print '
'; + if ($acct->type != 2 && $acct->rappro) // If not cash account and can be reconciliate { if ($user->rights->banque->consolidate) @@ -757,19 +758,22 @@ if ($account || $_GET["ref"]) print "trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Conciliate").""; } } - - if ($user->rights->banque->modifier) - { - print ''.$langs->trans("AddBankRecord").''; - } - else - { - print "trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("AddBankRecord").""; - } - - print '
'; + + if ($action != 'addline') + { + if ($user->rights->banque->modifier) + { + print ''.$langs->trans("AddBankRecord").''; + } + else + { + print "trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("AddBankRecord").""; + } + } + + print '
'; } - + print '
'; }
'.$navig.'