diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 6043a90082024703ae4893d71f51800060719688..d46f9529ca709c6fcd96658f7ab95f04b5f46961 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> - * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,6 +79,15 @@ $bprev = new BonPrelevement($db); llxHeader('', $langs->trans("NewStandingOrder")); +require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php"); +if (prelevement_check_config() < 0) +{ + $langs->load("errors"); + print '<div class="error">'; + print $langs->trans("ErrorModuleSetupNotComplete"); + print '</div>'; +} + $h=0; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php'; $head[$h][1] = $langs->trans("NewStandingOrder"); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 58576dc39cccce3aaadd6111ecb265b449cd1f4b..de3b718effef8e4029565453cf941471356570c6 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> + * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,6 +51,15 @@ $result = restrictedArea($user, 'prelevement','',''); llxHeader('',$langs->trans("CustomersStandingOrdersArea")); +require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php"); +if (prelevement_check_config() < 0) +{ + $langs->load("errors"); + print '<div class="error">'; + print $langs->trans("ErrorModuleSetupNotComplete"); + print '</div>'; +} + print_fiche_titre($langs->trans("CustomersStandingOrdersArea")); print '<table border="0" width="100%" class="notopnoleftnoright">'; diff --git a/htdocs/lib/prelevement.lib.php b/htdocs/lib/prelevement.lib.php index 213840852ae3606569cb3496c702b08ecb138c01..0c6ab5dca558bb58d8b39bb6aae91ef3fa89eb42 100644 --- a/htdocs/lib/prelevement.lib.php +++ b/htdocs/lib/prelevement.lib.php @@ -1,5 +1,7 @@ <?php -/* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> +/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,4 +83,21 @@ function prelevement_prepare_head($object) return $head; } + +/** + * Check need data to create standigns orders receipt file + * @return int -1 if ko 0 if ok + */ +function prelevement_check_config() +{ + + if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1; + if(empty($conf->global->PRELEVEMENT_CODE_BANQUE)) return -1; + if(empty($conf->global->PRELEVEMENT_CODE_GUICHET)) return -1; + if(empty($conf->global->PRELEVEMENT_NUMERO_COMPTE)) return -1; + if(empty($conf->global->PRELEVEMENT_NUMBER_KEY)) return -1; + if(empty($conf->global->PRELEVEMENT_RAISON_SOCIALE)) return -1; + if(empty($conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR)) return -1; + return 0; +} ?> \ No newline at end of file