From 4b831f06c795e595be933df70df9e565b8266381 Mon Sep 17 00:00:00 2001 From: jlb Date: Fri, 5 Sep 2003 14:11:38 +0000 Subject: [PATCH] rajout de la fonctionnalite d'auto-insertion des cotisations dans le compte banquaire (configurable) --- htdocs/adherents/fiche.php | 117 +++++++++++++++++++++++++++++++++---- 1 file changed, 105 insertions(+), 12 deletions(-) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 8002e57e32b..7c969e52e9d 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -24,9 +24,10 @@ require("./pre.inc.php"); require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); -require(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php"); -require(DOL_DOCUMENT_ROOT."/paiement.class.php"); +//require(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php"); +//require(DOL_DOCUMENT_ROOT."/paiement.class.php"); require(DOL_DOCUMENT_ROOT."/adherents/XML-RPC.functions.php"); +require(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); $adho = new AdherentOptions($db); $errmsg=''; @@ -53,10 +54,37 @@ if ($HTTP_POST_VARS["action"] == 'cotisation') if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == 0){ $adh->add_to_mailman(ADHERENT_MAILMAN_LISTS_COTISANT); } - $adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); + $crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); if (defined("ADHERENT_MAIL_COTIS") && defined("ADHERENT_MAIL_COTIS_SUBJECT")){ $adh->send_an_email($adh->email,ADHERENT_MAIL_COTIS,ADHERENT_MAIL_COTIS_SUBJECT); } + // insertion dans la gestion banquaire si configure pour + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + $dateop=strftime("%Y%m%d",time()); + //$dateop="$reyear$remonth$reday"; + $amount=$cotisation; + $acct=new Account($db,ADHERENT_BANK_ACCOUNT); + $insertid=$acct->addline($dateop, $HTTP_POST_VARS["operation"], $HTTP_POST_VARS["label"], $amount, $HTTP_POST_VARS["num_chq"],ADHERENT_BANK_CATEGORIE); + if ($insertid == '') + { + print "

Probleme d'insertion : ".$db->error(); + } + else + { + // met a jour la table cotisation + $sql="UPDATE llx_cotisation SET fk_bank=$insertid WHERE rowid=$crowid "; + $result = $db->query($sql); + if ($result) + { + //Header("Location: $PHP_SELF"); + } + else + { + print "

Probleme d'insertion $sql : ".$db->error(); + } + } + } } $action = "edit"; } @@ -131,6 +159,33 @@ if ($HTTP_POST_VARS["action"] == 'add') if ($cotisation > 0) { $adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); + // insertion dans la gestion banquaire si configure pour + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + $dateop=strftime("%Y%m%d",time()); + //$dateop="$reyear$remonth$reday"; + $amount=$cotisation; + $acct=new Account($db,ADHERENT_BANK_ACCOUNT); + $insertid=$acct->addline($dateop, $HTTP_POST_VARS["operation"], $HTTP_POST_VARS["label"], $amount, $HTTP_POST_VARS["num_chq"],ADHERENT_BANK_CATEGORIE); + if ($insertid == '') + { + print "

Probleme d'insertion : ".$db->error(); + } + else + { + // met a jour la table cotisation + $sql="UPDATE llx_cotisation SET fk_bank=$insertid WHERE rowid=$crowid "; + $result = $db->query($sql); + if ($result) + { + //Header("Location: $PHP_SELF"); + } + else + { + print "

Probleme d'insertion $sql : ".$db->error(); + } + } + } } Header("Location: liste.php"); } @@ -311,14 +366,30 @@ if ($action == 'create') { print "\n"; print "Mode de paiement\n"; - $paiement = new Paiement($db); + print ''; + // $paiement = new Paiement($db); - $paiement->select("modepaiement","crédit"); + // $paiement->select("modepaiement","crédit"); print "\n"; - + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + print "Numero de cheque\n"; + print ''; + print "\n"; + } print 'Cotisation euros'; - + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + print 'Libelle'; + } print ''; print "\n"; print "\n"; @@ -680,8 +751,12 @@ if ($rowid > 0) print ''; print ''; - - print '"; print "\n"; + + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + print "\n"; + } print ''; + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + print ''; + } print ''; print "\n"; }
'; + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + print ''; + }else{ + print ''; + } /* * @@ -767,12 +842,30 @@ if ($rowid > 0) print "
Mode de paiement\n"; - $paiement = new Paiement($db); - - $paiement->select("modepaiement","crédit"); + print ''; + // $paiement = new Paiement($db); + //$paiement->select("modepaiement","crédit"); print "
Numero de cheque\n"; + print ''; + print "
Cotisation euros
Libelledatefin).'" >