diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index 1ce13c9b76e..c10348ca888 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -37,8 +37,9 @@ $langs->load('banks'); $langs->load('companies'); $langs->load('compta'); -$id = GETPOST("id"); -$ref= GETPOST("ref"); +$id =GETPOST("id"); +$ref=GETPOST("ref"); +$action=GETPOST('action'); // Security check $fieldid = isset($_GET["ref"])?'number':'rowid'; @@ -63,7 +64,7 @@ $dir=$conf->banque->dir_output.'/bordereau/'; * Actions */ -if ($_POST['action'] == 'setdate' && $user->rights->banque->cheque) +if ($action == 'setdate' && $user->rights->banque->cheque) { $remisecheque = new RemiseCheque($db); $result = $remisecheque->fetch(GETPOST('id')); @@ -84,11 +85,11 @@ if ($_POST['action'] == 'setdate' && $user->rights->banque->cheque) } } -if ($_POST['action'] == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->cheque) +if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->cheque) { if (is_array($_POST['toRemise'])) { - $remisecheque = new RemiseCheque($db); + $remisecheque = new RemiseCheque($db); $result = $remisecheque->create($user, $_POST["accountid"], 0, $_POST['toRemise']); if ($result > 0) { @@ -118,12 +119,12 @@ if ($_POST['action'] == 'create' && $_POST["accountid"] > 0 && $user->rights->ba } else { - Header("Location: ".$_SERVER["PHP_SELF"]."?action=new"); - exit; + $mesg=$langs->trans("ErrorSelectAtLeastOne"); + $action='new'; } } -if ($_GET['action'] == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $user->rights->banque->cheque) +if ($action == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $user->rights->banque->cheque) { $remisecheque = new RemiseCheque($db); $remisecheque->id = $_GET["id"]; @@ -139,7 +140,7 @@ if ($_GET['action'] == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $us } } -if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->banque->cheque) +if ($action == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->banque->cheque) { $remisecheque = new RemiseCheque($db); $remisecheque->id = $_GET["id"]; @@ -155,7 +156,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && } } -if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->banque->cheque) +if ($action == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->banque->cheque) { $remisecheque = new RemiseCheque($db); $result = $remisecheque->fetch($_GET["id"]); @@ -183,7 +184,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && } } -if ($_POST['action'] == 'builddoc' && $user->rights->banque->cheque) +if ($action == 'builddoc' && $user->rights->banque->cheque) { $remisecheque = new RemiseCheque($db); $result = $remisecheque->fetch($_GET["id"]); @@ -226,23 +227,7 @@ $html = new Form($db); $formfile = new FormFile($db); -?> - -form_confirm($_SERVER["PHP_SELF"].'?id='.$remisecheque->id, $langs->trans("DeleteCheckReceipt"), $langs->trans("ConfirmDeleteCheckReceipt"), 'confirm_delete','','',1); if ($ret == 'html') print '
'; @@ -285,7 +270,7 @@ else /* * Confirmation de la validation du bordereau */ - if ($_GET['action'] == 'valide') + if ($action == 'valide') { $facid = $_GET['facid']; $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$remisecheque->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide','','',1); @@ -293,10 +278,11 @@ else } } -if ($mesg) print $mesg.'
'; +//if ($mesg) print $mesg.'
'; +dol_htmloutput_errors($mesg); -if ($_GET['action'] == 'new') +if ($action == 'new') { $accounts = array(); $lines = array(); @@ -342,12 +328,29 @@ if ($_GET['action'] == 'new') foreach ($accounts as $bid => $account_label) { + + print ' + + '; + $num = $db->num_rows($resql); print '
'; print ''; print ''; print ''; - + print ''; print ''; print '\n"; @@ -356,9 +359,9 @@ if ($_GET['action'] == 'new') print '\n"; print '\n"; print ''; - + print "\n"; $var=true; @@ -375,12 +378,12 @@ if ($_GET['action'] == 'new') print '\n"; print '\n"; print '\n"; - print ''; + print ''; print '' ; + print ''; + print '' ; print ''; - + $i++; } print "
'.$langs->trans("DateChequeReceived")."  '.$langs->trans("Bank")."'.$langs->trans("Amount")."'.$langs->trans("Select")."
"; - if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; + if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; print '
'.$value["numero"]."'.$value["emetteur"]."'.$value["banque"]."'.price($value["amount"]).''.price($value["amount"]).''; - print ''; - print '
"; @@ -423,10 +426,10 @@ else print ''; - if ($_GET['action'] != 'editdate') print ''; + if ($action != 'editdate') print ''; print '
'; print $langs->trans('Date'); print 'id.'">'.img_edit($langs->trans('SetDate'),1).'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; print ''; - if ($_GET['action'] == 'editdate') + if ($action == 'editdate') { print ''; print ''; @@ -551,7 +554,7 @@ else print '
'; -if ($user->societe_id == 0 && sizeof($accounts) == 1 && $_GET['action'] == 'new' && $user->rights->banque->cheque) +if ($user->societe_id == 0 && sizeof($accounts) == 1 && $action == 'new' && $user->rights->banque->cheque) { print ''.$langs->trans('NewCheckReceipt').''; } @@ -570,7 +573,7 @@ print '
'; -if ($_GET['action'] != 'new') +if ($action != 'new') { if ($remisecheque->statut == 1) { diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5fa04645bff..1c916e84fc9 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -77,4 +77,5 @@ ErrorQtyTooLowForThisSupplier=Quantity too low for this supplier or no price def ErrorModuleSetupNotComplete=Setup of module looks to be uncomplete. Go on Setup - Modules to complete. ErrorBadMask=Error on mask ErrorBadMaskFailedToLocatePosOfSequence=Error, mask without sequence number -ErrorBadMaskBadRazMonth=Erreur, bad reset value \ No newline at end of file +ErrorBadMaskBadRazMonth=Error, bad reset value +ErrorSelectAtLeastOne=Error. Select at least one entry. \ No newline at end of file diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index c46edc3945b..120ebfa1860 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -78,4 +78,5 @@ ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur ou aucu ErrorModuleSetupNotComplete=La configuration du module semble incomplète. Aller dans l'espace Configuration - Modules pour corriger. ErrorBadMask=Erreur sur le masque ErrorBadMaskFailedToLocatePosOfSequence=Erreur, masque sans numéro de séquence -ErrorBadMaskBadRazMonth=Erreur, mauvais valeur de remise à zéro \ No newline at end of file +ErrorBadMaskBadRazMonth=Erreur, mauvais valeur de remise à zéro +ErrorSelectAtLeastOne=Erreur. Sélectionnez au moins une entrée. \ No newline at end of file diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index f0f56b282d1..25a5cf91dd6 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -3442,29 +3442,38 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb { global $conf, $langs; - $ret = ''; - $out = ''; + $ret=''; + $out=''; + $divstart=$divend=''; - if (is_array($mesgarray) && sizeof($mesgarray)) - { + if (empty($conf->global->MAIN_USE_JQUERY_JNOTIFY) && ! preg_match('/
/i',$out)) + { + $divstart='
'; + $divend='
'; + } + + if ((is_array($mesgarray) && sizeof($mesgarray)) || $mesgstring) + { $langs->load("errors"); - if (empty($conf->global->MAIN_USE_JQUERY_JNOTIFY)) $out.= '
'; - foreach($mesgarray as $message) - { - $ret++; - $out.= $langs->trans($message); - if ($ret < sizeof($mesgarray)) $out.= "
\n"; - } - if (empty($conf->global->MAIN_USE_JQUERY_JNOTIFY)) $out.= '
'; - } - if ($mesgstring) - { - $langs->load("errors"); - $ret++; - if (empty($conf->global->MAIN_USE_JQUERY_JNOTIFY)) $out.= '
'; - $out.= $langs->trans($mesgstring); - if (empty($conf->global->MAIN_USE_JQUERY_JNOTIFY)) $out.= '
'; - } + $out.=$divstart; + if (is_array($mesgarray) && sizeof($mesgarray)) + { + foreach($mesgarray as $message) + { + $ret++; + $out.= $langs->trans($message); + if ($ret < sizeof($mesgarray)) $out.= "
\n"; + } + } + if ($mesgstring) + { + $langs->load("errors"); + $ret++; + $out.= $langs->trans($mesgstring); + } + $out.=$divend; + } + if ($out) { if (! empty($conf->global->MAIN_USE_JQUERY_JNOTIFY) && ! $keepembedded)