2007-02-03 23:40:04 +01:00
< ? php
2012-09-29 12:07:07 +02:00
/* Copyright ( C ) 2001 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2002 - 2003 Jean - Louis Bergamo < jlb @ j1b . org >
2014-04-06 14:22:08 +02:00
* Copyright ( C ) 2004 - 2014 Laurent Destailleur < eldy @ users . sourceforge . net >
2012-12-30 15:13:49 +01:00
* Copyright ( C ) 2012 Regis Houssin < regis . houssin @ capnetworks . com >
2007-02-03 23:40:04 +01:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2007-02-03 23:40:04 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-01 00:21:57 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2007-02-03 23:40:04 +01:00
*/
/**
2008-11-15 01:10:42 +01:00
* \file htdocs / adherents / card_subscriptions . php
2009-10-10 18:00:35 +02:00
* \ingroup member
2010-03-01 09:55:43 +01:00
* \brief Onglet d 'ajout, edition, suppression des adhesions d' un adherent
2008-11-15 01:10:42 +01:00
*/
2007-02-03 23:40:04 +01:00
2012-08-22 23:24:21 +02:00
require '../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php' ;
2014-12-01 13:26:05 +01:00
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php' ;
2007-02-03 23:40:04 +01:00
$langs -> load ( " companies " );
$langs -> load ( " bills " );
2010-05-02 19:05:07 +02:00
$langs -> load ( " members " );
2007-02-03 23:40:04 +01:00
$langs -> load ( " users " );
2007-02-06 10:20:11 +01:00
$langs -> load ( " mails " );
2007-02-03 23:40:04 +01:00
2010-09-07 03:32:20 +02:00
2012-07-02 19:30:37 +02:00
$action = GETPOST ( 'action' , 'alpha' );
2012-09-29 12:07:07 +02:00
$confirm = GETPOST ( 'confirm' , 'alpha' );
2012-07-02 19:30:37 +02:00
$rowid = GETPOST ( 'rowid' , 'int' );
2012-04-15 11:28:21 +02:00
$typeid = GETPOST ( 'typeid' , 'int' );
2010-09-07 03:32:20 +02:00
// Security check
2013-01-02 18:43:59 +01:00
$result = restrictedArea ( $user , 'adherent' , $rowid , '' , 'cotisation' );
2010-09-07 03:32:20 +02:00
2012-03-04 01:09:39 +01:00
$object = new Adherent ( $db );
$extrafields = new ExtraFields ( $db );
2007-02-28 00:06:18 +01:00
$adht = new AdherentType ( $db );
2007-02-03 23:40:04 +01:00
$errmsg = '' ;
2015-04-27 11:46:30 +02:00
$errmsgs = array ();
2007-02-03 23:40:04 +01:00
2007-09-05 09:43:43 +02:00
$defaultdelay = 1 ;
$defaultdelayunit = 'y' ;
2010-09-07 03:32:20 +02:00
if ( $rowid )
{
// Load member
2012-03-04 01:09:39 +01:00
$result = $object -> fetch ( $rowid );
2010-09-07 03:32:20 +02:00
// Define variables to know what current user can do on users
$canadduser = ( $user -> admin || $user -> rights -> user -> user -> creer );
// Define variables to know what current user can do on properties of user linked to edited member
2012-03-04 01:09:39 +01:00
if ( $object -> user_id )
2010-09-07 03:32:20 +02:00
{
2012-03-04 01:09:39 +01:00
// $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite
$caneditfielduser = ( (( $user -> id == $object -> user_id ) && $user -> rights -> user -> self -> creer )
|| (( $user -> id != $object -> user_id ) && $user -> rights -> user -> user -> creer ) );
$caneditpassworduser = ( (( $user -> id == $object -> user_id ) && $user -> rights -> user -> self -> password )
|| (( $user -> id != $object -> user_id ) && $user -> rights -> user -> user -> password ) );
2010-09-07 03:32:20 +02:00
}
}
// Define variables to know what current user can do on members
$canaddmember = $user -> rights -> adherent -> creer ;
// Define variables to know what current user can do on properties of a member
if ( $rowid )
{
$caneditfieldmember = $user -> rights -> adherent -> creer ;
}
2014-05-07 10:33:10 +02:00
// PDF
$hidedetails = ( GETPOST ( 'hidedetails' , 'int' ) ? GETPOST ( 'hidedetails' , 'int' ) : ( ! empty ( $conf -> global -> MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS ) ? 1 : 0 ));
$hidedesc = ( GETPOST ( 'hidedesc' , 'int' ) ? GETPOST ( 'hidedesc' , 'int' ) : ( ! empty ( $conf -> global -> MAIN_GENERATE_DOCUMENTS_HIDE_DESC ) ? 1 : 0 ));
$hideref = ( GETPOST ( 'hideref' , 'int' ) ? GETPOST ( 'hideref' , 'int' ) : ( ! empty ( $conf -> global -> MAIN_GENERATE_DOCUMENTS_HIDE_REF ) ? 1 : 0 ));
2007-02-03 23:40:04 +01:00
/*
* Actions
*/
2011-02-26 10:51:53 +01:00
// Create third party from a member
2012-09-29 12:07:07 +02:00
if ( $action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user -> rights -> societe -> creer )
2011-02-26 10:51:53 +01:00
{
if ( $result > 0 )
{
// Creation user
$company = new Societe ( $db );
2012-03-04 01:09:39 +01:00
$result = $company -> create_from_member ( $object , $_POST [ " companyname " ]);
2011-03-06 14:55:47 +01:00
2011-02-26 10:51:53 +01:00
if ( $result < 0 )
{
$langs -> load ( " errors " );
$errmsg = $langs -> trans ( $company -> error );
2014-07-20 01:43:46 +02:00
setEventMessage ( $company -> errors , 'errors' );
2011-02-26 10:51:53 +01:00
}
else
{
$action = 'addsubscription' ;
}
}
else
{
2012-03-04 01:09:39 +01:00
$errmsg = $object -> error ;
2011-02-26 10:51:53 +01:00
}
}
2010-09-07 03:32:20 +02:00
2011-02-26 10:51:53 +01:00
if ( $action == 'setuserid' && ( $user -> rights -> user -> self -> creer || $user -> rights -> user -> user -> creer ))
2010-09-07 03:32:20 +02:00
{
$error = 0 ;
if ( empty ( $user -> rights -> user -> user -> creer )) // If can edit only itself user, we can link to itself only
{
2012-03-04 01:09:39 +01:00
if ( $_POST [ " userid " ] != $user -> id && $_POST [ " userid " ] != $object -> user_id )
2010-09-07 03:32:20 +02:00
{
$error ++ ;
2014-07-20 01:09:43 +02:00
setEventMessage ( $langs -> trans ( " ErrorUserPermissionAllowsToLinksToItselfOnly " ), 'errors' );
2010-09-07 03:32:20 +02:00
}
}
if ( ! $error )
{
2012-03-04 01:09:39 +01:00
if ( $_POST [ " userid " ] != $object -> user_id ) // If link differs from currently in database
2010-09-07 03:32:20 +02:00
{
2012-03-04 01:09:39 +01:00
$result = $object -> setUserId ( $_POST [ " userid " ]);
2014-05-26 09:07:18 +02:00
if ( $result < 0 ) dol_print_error ( '' , $object -> error );
2010-09-07 03:32:20 +02:00
$_POST [ 'action' ] = '' ;
$action = '' ;
}
}
}
2011-02-26 10:51:53 +01:00
if ( $action == 'setsocid' )
2010-09-07 03:32:20 +02:00
{
$error = 0 ;
if ( ! $error )
{
2012-03-04 01:09:39 +01:00
if ( GETPOST ( 'socid' , 'int' ) != $object -> fk_soc ) // If link differs from currently in database
2010-09-07 03:32:20 +02:00
{
$sql = " SELECT rowid FROM " . MAIN_DB_PREFIX . " adherent " ;
2012-02-27 22:26:22 +01:00
$sql .= " WHERE fk_soc = ' " . GETPOST ( 'socid' , 'int' ) . " ' " ;
2010-09-07 03:32:20 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
{
$obj = $db -> fetch_object ( $resql );
if ( $obj && $obj -> rowid > 0 )
{
$othermember = new Adherent ( $db );
$othermember -> fetch ( $obj -> rowid );
$thirdparty = new Societe ( $db );
2012-02-27 22:26:22 +01:00
$thirdparty -> fetch ( GETPOST ( 'socid' , 'int' ));
2010-09-07 03:32:20 +02:00
$error ++ ;
2014-07-20 01:09:43 +02:00
setEventMessage ( $langs -> trans ( " ErrorMemberIsAlreadyLinkedToThisThirdParty " , $othermember -> getFullName ( $langs ), $othermember -> login , $thirdparty -> name ), 'errors' );
2010-09-07 03:32:20 +02:00
}
}
if ( ! $error )
{
2012-03-04 01:09:39 +01:00
$result = $object -> setThirdPartyId ( GETPOST ( 'socid' , 'int' ));
2014-05-26 09:07:18 +02:00
if ( $result < 0 ) dol_print_error ( '' , $object -> error );
2010-09-07 03:32:20 +02:00
$_POST [ 'action' ] = '' ;
$action = '' ;
}
}
}
}
2011-02-26 10:51:53 +01:00
if ( $user -> rights -> adherent -> cotisation -> creer && $action == 'cotisation' && ! $_POST [ " cancel " ])
2007-02-03 23:40:04 +01:00
{
2010-09-05 21:22:00 +02:00
$error = 0 ;
$langs -> load ( " banks " );
2007-05-28 13:11:46 +02:00
2012-03-04 01:09:39 +01:00
$result = $object -> fetch ( $rowid );
$result = $adht -> fetch ( $object -> typeid );
2010-09-09 01:50:52 +02:00
// Subscription informations
$datecotisation = 0 ;
$datesubend = 0 ;
2011-03-23 19:39:05 +01:00
$paymentdate = 0 ;
2010-09-09 01:50:52 +02:00
if ( $_POST [ " reyear " ] && $_POST [ " remonth " ] && $_POST [ " reday " ])
{
$datecotisation = dol_mktime ( 0 , 0 , 0 , $_POST [ " remonth " ], $_POST [ " reday " ], $_POST [ " reyear " ]);
}
if ( $_POST [ " endyear " ] && $_POST [ " endmonth " ] && $_POST [ " endday " ])
{
$datesubend = dol_mktime ( 0 , 0 , 0 , $_POST [ " endmonth " ], $_POST [ " endday " ], $_POST [ " endyear " ]);
}
2011-03-23 19:25:53 +01:00
if ( $_POST [ " paymentyear " ] && $_POST [ " paymentmonth " ] && $_POST [ " paymentday " ])
{
$paymentdate = dol_mktime ( 0 , 0 , 0 , $_POST [ " paymentmonth " ], $_POST [ " paymentday " ], $_POST [ " paymentyear " ]);
}
2010-09-09 01:50:52 +02:00
$cotisation = $_POST [ " cotisation " ]; // Amount of subscription
$label = $_POST [ " label " ];
2011-03-23 19:39:05 +01:00
// Payment informations
$accountid = $_POST [ " accountid " ];
$operation = $_POST [ " operation " ]; // Payment mode
$num_chq = $_POST [ " num_chq " ];
$emetteur_nom = $_POST [ " chqemetteur " ];
$emetteur_banque = $_POST [ " chqbank " ];
$option = $_POST [ " paymentsave " ];
if ( empty ( $option )) $option = 'none' ;
// Check parameters
2010-09-09 01:50:52 +02:00
if ( ! $datecotisation )
{
$error ++ ;
2011-08-27 18:41:30 +02:00
$langs -> load ( " errors " );
$errmsg = $langs -> trans ( " ErrorBadDateFormat " , $langs -> transnoentitiesnoconv ( " DateSubscription " ));
$action = 'addsubscription' ;
}
if ( GETPOST ( 'end' ) && ! $datesubend )
{
$error ++ ;
$langs -> load ( " errors " );
$errmsg = $langs -> trans ( " ErrorBadDateFormat " , $langs -> transnoentitiesnoconv ( " DateEndSubscription " ));
2010-09-09 01:50:52 +02:00
$action = 'addsubscription' ;
}
if ( ! $datesubend )
{
$datesubend = dol_time_plus_duree ( dol_time_plus_duree ( $datecotisation , $defaultdelay , $defaultdelayunit ), - 1 , 'd' );
}
2011-03-23 19:39:05 +01:00
if (( $option == 'bankviainvoice' || $option == 'bankdirect' ) && ! $paymentdate )
{
$error ++ ;
$errmsg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentitiesnoconv ( " DatePayment " ));
$action = 'addsubscription' ;
}
2008-11-15 01:10:42 +01:00
2010-09-09 01:50:52 +02:00
// Check if a payment is mandatory or not
if ( ! $error && $adht -> cotisation ) // Type adherent soumis a cotisation
{
if ( ! is_numeric ( $_POST [ " cotisation " ]))
{
// If field is '' or not a numeric value
$errmsg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Amount " ));
2010-09-05 21:22:00 +02:00
$error ++ ;
2010-09-09 01:50:52 +02:00
$action = 'addsubscription' ;
}
else
{
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> banque -> enabled ) && $_POST [ " paymentsave " ] != 'none' )
2010-09-09 01:50:52 +02:00
{
if ( $_POST [ " cotisation " ])
{
if ( ! $_POST [ " label " ]) $errmsg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " ));
2010-09-10 00:56:41 +02:00
if ( $_POST [ " paymentsave " ] != 'invoiceonly' && ! $_POST [ " operation " ]) $errmsg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " PaymentMode " ));
if ( $_POST [ " paymentsave " ] != 'invoiceonly' && ! $_POST [ " accountid " ]) $errmsg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " FinancialAccount " ));
2010-09-09 01:50:52 +02:00
}
else
{
if ( $_POST [ " accountid " ]) $errmsg = $langs -> trans ( " ErrorDoNotProvideAccountsIfNullAmount " );
}
if ( $errmsg ) $action = 'addsubscription' ;
}
}
}
if ( ! $error && $action == 'cotisation' )
{
$db -> begin ();
2010-09-10 00:45:05 +02:00
// Create subscription
2014-09-19 14:36:55 +02:00
$crowid = $object -> cotisation ( $datecotisation , $cotisation , $accountid , $operation , $label , $num_chq , $emetteur_nom , $emetteur_banque , $datesubend );
2010-09-09 01:50:52 +02:00
if ( $crowid <= 0 )
{
$error ++ ;
2012-03-04 01:09:39 +01:00
$errmsg = $object -> error ;
2015-04-27 11:46:30 +02:00
setEventMessages ( $object -> error , $object -> errors , 'errors' );
2010-09-09 01:50:52 +02:00
}
if ( ! $error )
{
2010-09-10 00:45:05 +02:00
// Insert into bank account directlty (if option choosed for) + link to llx_cotisation if option is 'bankdirect'
if ( $option == 'bankdirect' && $accountid )
{
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
2010-09-10 00:45:05 +02:00
$acct = new Account ( $db );
$result = $acct -> fetch ( $accountid );
2011-03-23 19:39:05 +01:00
$dateop = $paymentdate ;
2010-09-10 00:45:05 +02:00
$insertid = $acct -> addline ( $dateop , $operation , $label , $cotisation , $num_chq , '' , $user , $emetteur_nom , $emetteur_banque );
if ( $insertid > 0 )
{
2014-09-18 21:18:25 +02:00
$inserturlid = $acct -> add_url_line ( $insertid , $object -> id , DOL_URL_ROOT . '/adherents/card.php?rowid=' , $object -> getFullname ( $langs ), 'member' );
2010-09-10 00:45:05 +02:00
if ( $inserturlid > 0 )
{
// Met a jour la table cotisation
$sql = " UPDATE " . MAIN_DB_PREFIX . " cotisation SET fk_bank= " . $insertid ;
$sql .= " WHERE rowid= " . $crowid ;
2014-06-12 11:31:53 +02:00
dol_syslog ( " card_subscriptions::cotisation " , LOG_DEBUG );
2010-09-10 00:45:05 +02:00
$resql = $db -> query ( $sql );
if ( ! $resql )
{
2012-01-11 01:52:00 +01:00
$error ++ ;
$errmsg = $db -> lasterror ();
2010-09-10 00:45:05 +02:00
}
}
else
2014-12-01 13:26:05 +01:00
{
2012-01-11 01:52:00 +01:00
$error ++ ;
$errmsg = $acct -> error ;
2015-04-27 11:46:30 +02:00
$errmsgs = $acct -> errors ;
2010-09-10 00:45:05 +02:00
}
}
else
2014-12-01 13:26:05 +01:00
{
2012-01-11 01:52:00 +01:00
$error ++ ;
$errmsg = $acct -> error ;
2015-04-27 11:46:30 +02:00
$errmsgs = $acct -> errors ;
2010-09-10 00:45:05 +02:00
}
}
// If option choosed, we create invoice
if (( $option == 'bankviainvoice' && $accountid ) || $option == 'invoiceonly' )
2010-09-09 01:50:52 +02:00
{
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/paymentterm.class.php' ;
2010-09-05 21:22:00 +02:00
2010-09-09 01:50:52 +02:00
$invoice = new Facture ( $db );
2010-09-05 21:22:00 +02:00
$customer = new Societe ( $db );
2014-04-06 14:22:08 +02:00
if ( ! $error )
2010-09-05 21:22:00 +02:00
{
2014-04-06 14:22:08 +02:00
if ( ! ( $object -> fk_soc > 0 ))
{
$langs -> load ( " errors " );
$errmsg = $langs -> trans ( " ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst " );
2014-05-05 00:42:52 +02:00
$error ++ ;
2014-04-06 14:22:08 +02:00
}
2010-09-05 21:22:00 +02:00
}
2014-04-06 14:22:08 +02:00
if ( ! $error )
2010-09-05 21:22:00 +02:00
{
2014-04-06 14:22:08 +02:00
$result = $customer -> fetch ( $object -> fk_soc );
if ( $result <= 0 )
{
$errmsg = $customer -> error ;
2015-04-27 11:46:30 +02:00
$errmsgs = $acct -> errors ;
2014-04-06 14:22:08 +02:00
$error ++ ;
}
2010-09-05 21:22:00 +02:00
}
2014-05-05 00:42:52 +02:00
2014-04-06 14:22:08 +02:00
if ( ! $error )
2013-03-06 17:16:26 +01:00
{
2014-04-06 14:22:08 +02:00
// Create draft invoice
$invoice -> type = Facture :: TYPE_STANDARD ;
$invoice -> cond_reglement_id = $customer -> cond_reglement_id ;
if ( empty ( $invoice -> cond_reglement_id ))
{
$paymenttermstatic = new PaymentTerm ( $db );
$invoice -> cond_reglement_id = $paymenttermstatic -> getDefaultId ();
if ( empty ( $invoice -> cond_reglement_id ))
{
$error ++ ;
$errmsg = 'ErrorNoPaymentTermRECEPFound' ;
}
}
$invoice -> socid = $object -> fk_soc ;
$invoice -> date = $datecotisation ;
2014-05-05 00:42:52 +02:00
2014-04-06 14:22:08 +02:00
$result = $invoice -> create ( $user );
if ( $result <= 0 )
{
$errmsg = $invoice -> error ;
2015-04-27 11:46:30 +02:00
$errmsgs = $invoice -> errors ;
2014-04-06 14:22:08 +02:00
$error ++ ;
}
2013-03-06 17:16:26 +01:00
}
2014-05-05 00:42:52 +02:00
2014-04-06 14:22:08 +02:00
if ( ! $error )
2010-09-05 21:22:00 +02:00
{
2014-04-06 14:22:08 +02:00
// Add line to draft invoice
$idprodsubscription = 0 ;
2014-12-01 13:26:05 +01:00
if ( ! empty ( $conf -> global -> ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS ) && ( ! empty ( $conf -> product -> enabled ) || ! empty ( $conf -> service -> enabled ))) $idprodsubscription = $conf -> global -> ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS ;
2014-04-06 14:22:08 +02:00
$vattouse = 0 ;
if ( isset ( $conf -> global -> ADHERENT_VAT_FOR_SUBSCRIPTIONS ) && $conf -> global -> ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry' )
{
$vattouse = get_default_tva ( $mysoc , $mysoc , $idprodsubscription );
}
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
$result = $invoice -> addline ( $label , 0 , 1 , $vattouse , 0 , 0 , $idprodsubscription , 0 , $datecotisation , $datesubend , 0 , 0 , '' , 'TTC' , $cotisation , 1 );
if ( $result <= 0 )
{
$errmsg = $invoice -> error ;
$error ++ ;
}
2014-05-07 10:33:10 +02:00
}
2014-05-05 00:42:52 +02:00
2014-05-07 10:33:10 +02:00
if ( ! $error )
{
2014-04-06 14:22:08 +02:00
// Validate invoice
$result = $invoice -> validate ( $user );
2014-05-07 10:33:10 +02:00
if ( $result <= 0 )
{
$errmsg = $invoice -> error ;
2015-04-27 11:46:30 +02:00
$errmsgs = $invoice -> errors ;
2014-05-07 10:33:10 +02:00
$error ++ ;
}
2010-09-05 21:22:00 +02:00
}
2014-05-05 00:42:52 +02:00
2011-03-23 19:39:05 +01:00
// Add payment onto invoice
2010-09-10 00:45:05 +02:00
if ( $option == 'bankviainvoice' && $accountid )
2010-09-09 01:50:52 +02:00
{
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php' ;
2010-09-09 01:50:52 +02:00
$amounts [ $invoice -> id ] = price2num ( $cotisation );
$paiement = new Paiement ( $db );
2011-03-23 19:39:05 +01:00
$paiement -> datepaye = $paymentdate ;
2010-09-09 01:50:52 +02:00
$paiement -> amounts = $amounts ;
2011-02-26 12:08:42 +01:00
$paiement -> paiementid = dol_getIdFromCode ( $db , $operation , 'c_paiement' );
2010-09-09 01:50:52 +02:00
$paiement -> num_paiement = $num_chq ;
$paiement -> note = $label ;
if ( ! $error )
{
2014-05-07 10:33:10 +02:00
// Create payment line for invoice
$paiement_id = $paiement -> create ( $user );
2010-09-09 01:50:52 +02:00
if ( ! $paiement_id > 0 )
{
$errmsg = $paiement -> error ;
2015-04-27 11:46:30 +02:00
$errmsgs = $paiement -> errors ;
2010-09-09 01:50:52 +02:00
$error ++ ;
}
}
if ( ! $error )
{
2014-05-07 10:33:10 +02:00
// Add transaction into bank account
2010-09-10 00:45:05 +02:00
$bank_line_id = $paiement -> addPaymentToBank ( $user , 'payment' , '(SubscriptionPayment)' , $accountid , $emetteur_nom , $emetteur_banque );
2012-10-15 21:42:17 +02:00
if ( ! ( $bank_line_id > 0 ))
2010-09-09 01:50:52 +02:00
{
$errmsg = $paiement -> error ;
2015-04-27 11:46:30 +02:00
$errmsgs = $paiement -> errors ;
setEventMessages ( $paiement -> error , $paiement -> errors , 'errors' );
2010-09-09 01:50:52 +02:00
$error ++ ;
}
2012-10-15 21:31:46 +02:00
}
2010-09-10 00:45:05 +02:00
2012-10-15 21:31:46 +02:00
if ( ! $error )
{
2014-05-07 10:33:10 +02:00
// Update fk_bank into subscription table
2011-11-23 21:25:02 +01:00
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'cotisation SET fk_bank=' . $bank_line_id ;
2010-09-10 00:45:05 +02:00
$sql .= ' WHERE rowid=' . $crowid ;
2014-07-02 21:29:07 +02:00
$result = $db -> query ( $sql );
2010-09-10 00:45:05 +02:00
if ( ! $result )
{
$error ++ ;
}
2010-09-09 01:50:52 +02:00
}
2014-05-07 10:33:10 +02:00
if ( ! $error )
{
// Set invoice as paid
$invoice -> set_paid ( $user );
}
if ( ! $error )
{
// Define output language
$outputlangs = $langs ;
$newlang = '' ;
2014-05-12 12:10:52 +02:00
if ( $conf -> global -> MAIN_MULTILANGS && empty ( $newlang ) && ! empty ( $_REQUEST [ 'lang_id' ]))
$newlang = $_REQUEST [ 'lang_id' ];
2014-05-07 10:33:10 +02:00
if ( $conf -> global -> MAIN_MULTILANGS && empty ( $newlang ))
$newlang = $customer -> default_lang ;
if ( ! empty ( $newlang )) {
$outputlangs = new Translate ( " " , $conf );
$outputlangs -> setDefaultLang ( $newlang );
}
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
2014-09-16 20:49:05 +02:00
$invoice -> generateDocument ( $invoice -> modelpdf , $outputlangs , $hidedetails , $hidedesc , $hideref );
2014-05-07 10:33:10 +02:00
}
2010-09-09 01:50:52 +02:00
}
}
}
if ( ! $error )
{
$db -> commit ();
}
else
{
$db -> rollback ();
$action = 'addsubscription' ;
}
// Send email
if ( ! $error )
{
2010-09-05 21:22:00 +02:00
// Send confirmation Email
2012-03-04 01:09:39 +01:00
if ( $object -> email && $_POST [ " sendmail " ])
2010-09-05 21:22:00 +02:00
{
2012-03-04 01:09:39 +01:00
$subjecttosend = $object -> makeSubstitution ( $conf -> global -> ADHERENT_MAIL_COTIS_SUBJECT );
$texttosend = $object -> makeSubstitution ( $adht -> getMailOnSubscription ());
2010-09-05 21:22:00 +02:00
2012-03-04 01:09:39 +01:00
$result = $object -> send_an_email ( $texttosend , $subjecttosend , array (), array (), array (), " " , " " , 0 , - 1 );
2015-04-27 11:46:30 +02:00
if ( $result < 0 )
{
$errmsg = $object -> error ;
}
2010-09-05 21:22:00 +02:00
}
$_POST [ " cotisation " ] = '' ;
$_POST [ " accountid " ] = '' ;
$_POST [ " operation " ] = '' ;
$_POST [ " label " ] = '' ;
$_POST [ " num_chq " ] = '' ;
2010-09-09 01:50:52 +02:00
}
}
2007-02-03 23:40:04 +01:00
}
2010-09-07 03:32:20 +02:00
2009-08-12 14:59:14 +02:00
/*
* View
*/
2007-02-03 23:40:04 +01:00
2011-11-08 10:18:45 +01:00
$form = new Form ( $db );
2007-02-03 23:40:04 +01:00
2011-01-15 03:39:31 +01:00
$now = dol_now ();
2010-09-06 20:56:13 +02:00
llxHeader ( '' , $langs -> trans ( " Subscriptions " ), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros' );
2007-02-03 23:40:04 +01:00
2010-09-06 20:56:13 +02:00
if ( $rowid )
{
2012-11-13 12:32:05 +01:00
$res = $object -> fetch ( $rowid );
2012-03-04 01:09:39 +01:00
if ( $res < 0 ) { dol_print_error ( $db , $object -> error ); exit ; }
2007-02-03 23:40:04 +01:00
2012-03-04 01:09:39 +01:00
$adht -> fetch ( $object -> typeid );
2007-02-03 23:40:04 +01:00
2012-03-04 01:09:39 +01:00
$head = member_prepare_head ( $object );
2007-02-03 23:40:04 +01:00
2010-09-06 20:56:13 +02:00
dol_fiche_head ( $head , 'subscription' , $langs -> trans ( " Member " ), 0 , 'user' );
2007-02-03 23:40:04 +01:00
2014-04-06 14:22:08 +02:00
$rowspan = 10 ;
if ( empty ( $conf -> global -> ADHERENT_LOGIN_NOT_REQUIRED )) $rowspan ++ ;
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> societe -> enabled )) $rowspan ++ ;
2011-03-06 14:55:47 +01:00
2010-09-07 03:32:20 +02:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2010-09-06 20:56:13 +02:00
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
2012-03-04 01:09:39 +01:00
print '<input type="hidden" name="rowid" value="' . $object -> id . '">' ;
2010-09-06 20:56:13 +02:00
print '<table class="border" width="100%">' ;
2007-02-03 23:40:04 +01:00
2014-09-18 20:33:37 +02:00
$linkback = '<a href="' . DOL_URL_ROOT . '/adherents/list.php">' . $langs -> trans ( " BackToList " ) . '</a>' ;
2012-07-28 21:49:47 +02:00
2010-09-06 20:56:13 +02:00
// Ref
print '<tr><td width="20%">' . $langs -> trans ( " Ref " ) . '</td>' ;
2011-03-06 14:55:47 +01:00
print '<td class="valeur" colspan="2">' ;
2012-07-28 21:49:47 +02:00
print $form -> showrefnav ( $object , 'rowid' , $linkback );
2010-09-06 20:56:13 +02:00
print '</td></tr>' ;
2007-02-03 23:40:04 +01:00
2013-04-12 14:55:40 +02:00
$showphoto = '<td rowspan="' . $rowspan . '" class="hideonsmartphone" align="center" valign="middle" width="25%">' . $form -> showphoto ( 'memberphoto' , $object ) . '</td>' ;
2011-06-16 23:15:45 +02:00
2011-03-06 14:55:47 +01:00
// Login
if ( empty ( $conf -> global -> ADHERENT_LOGIN_NOT_REQUIRED ))
{
2012-03-04 01:09:39 +01:00
print '<tr><td>' . $langs -> trans ( " Login " ) . ' / ' . $langs -> trans ( " Id " ) . '</td><td class="valeur">' . $object -> login . ' </td>' ;
2011-06-16 23:15:45 +02:00
print $showphoto ; $showphoto = '' ;
print '</tr>' ;
2011-03-06 14:55:47 +01:00
}
// Morphy
2012-03-04 01:09:39 +01:00
print '<tr><td>' . $langs -> trans ( " Nature " ) . '</td><td class="valeur" >' . $object -> getmorphylib () . '</td>' ;
2011-06-16 23:15:45 +02:00
print $showphoto ; $showphoto = '' ;
2011-03-06 14:55:47 +01:00
print '</tr>' ;
// Type
print '<tr><td>' . $langs -> trans ( " Type " ) . '</td><td class="valeur">' . $adht -> getNomUrl ( 1 ) . " </td></tr> \n " ;
// Company
2012-03-04 01:09:39 +01:00
print '<tr><td>' . $langs -> trans ( " Company " ) . '</td><td class="valeur">' . $object -> societe . '</td></tr>' ;
2011-03-06 14:55:47 +01:00
// Civility
2012-03-04 01:09:39 +01:00
print '<tr><td>' . $langs -> trans ( " UserTitle " ) . '</td><td class="valeur">' . $object -> getCivilityLabel () . ' </td>' ;
2011-03-06 14:55:47 +01:00
print '</tr>' ;
2013-06-04 23:19:04 +02:00
// Lastname
2012-03-04 01:09:39 +01:00
print '<tr><td>' . $langs -> trans ( " Lastname " ) . '</td><td class="valeur">' . $object -> lastname . ' </td>' ;
2010-09-06 20:56:13 +02:00
print '</tr>' ;
2007-02-03 23:40:04 +01:00
2011-02-26 03:17:29 +01:00
// Firstname
2012-03-04 01:09:39 +01:00
print '<tr><td>' . $langs -> trans ( " Firstname " ) . '</td><td class="valeur">' . $object -> firstname . ' </td>' ;
2010-09-06 20:56:13 +02:00
print '</tr>' ;
2007-02-03 23:40:04 +01:00
2013-06-05 16:24:32 +02:00
// EMail
print '<tr><td>' . $langs -> trans ( " EMail " ) . '</td><td class="valeur">' . dol_print_email ( $object -> email , 0 , $object -> fk_soc , 1 ) . '</td></tr>' ;
2013-07-10 17:29:54 +02:00
2010-09-06 20:56:13 +02:00
// Status
2012-03-04 01:09:39 +01:00
print '<tr><td>' . $langs -> trans ( " Status " ) . '</td><td class="valeur">' . $object -> getLibStatut ( 4 ) . '</td></tr>' ;
2007-02-03 23:40:04 +01:00
2010-09-07 02:38:03 +02:00
// Date end subscription
print '<tr><td>' . $langs -> trans ( " SubscriptionEndDate " ) . '</td><td class="valeur">' ;
2012-03-04 01:09:39 +01:00
if ( $object -> datefin )
2010-09-07 02:38:03 +02:00
{
2012-03-04 01:09:39 +01:00
print dol_print_date ( $object -> datefin , 'day' );
if ( $object -> datefin < ( $now - $conf -> adherent -> cotisation -> warning_delay ) && $object -> statut > 0 ) print " " . img_warning ( $langs -> trans ( " Late " )); // Affiche picto retard uniquement si non brouillon et non resilie
2010-09-07 02:38:03 +02:00
}
else
{
print $langs -> trans ( " SubscriptionNotReceived " );
2012-03-04 01:09:39 +01:00
if ( $object -> statut > 0 ) print " " . img_warning ( $langs -> trans ( " Late " )); // Affiche picto retard uniquement si non brouillon et non resilie
2010-09-07 02:38:03 +02:00
}
print '</td></tr>' ;
2007-02-03 23:40:04 +01:00
2010-09-07 03:32:20 +02:00
// Third party Dolibarr
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> societe -> enabled ))
2010-09-07 03:32:20 +02:00
{
print '<tr><td>' ;
print '<table class="nobordernopadding" width="100%"><tr><td>' ;
print $langs -> trans ( " LinkedToDolibarrThirdParty " );
print '</td>' ;
2012-11-13 12:32:05 +01:00
if ( $action != 'editthirdparty' && $user -> rights -> adherent -> creer ) print '<td align="right"><a href="' . $_SERVER [ " PHP_SELF " ] . '?action=editthirdparty&rowid=' . $object -> id . '">' . img_edit ( $langs -> trans ( 'SetLinkToThirdParty' ), 1 ) . '</a></td>' ;
2010-09-07 03:32:20 +02:00
print '</tr></table>' ;
print '</td><td class="valeur">' ;
2012-11-13 12:32:05 +01:00
if ( $action == 'editthirdparty' )
2010-09-07 03:32:20 +02:00
{
$htmlname = 'socid' ;
print '<form method="POST" action="' . $_SERVER [ 'PHP_SELF' ] . '" name="form' . $htmlname . '">' ;
2012-03-04 01:09:39 +01:00
print '<input type="hidden" name="rowid" value="' . $object -> id . '">' ;
2010-09-07 03:32:20 +02:00
print '<input type="hidden" name="action" value="set' . $htmlname . '">' ;
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">' ;
print '<tr><td>' ;
2012-03-04 01:09:39 +01:00
print $form -> select_company ( $object -> fk_soc , 'socid' , '' , 1 );
2010-09-07 03:32:20 +02:00
print '</td>' ;
print '<td align="left"><input type="submit" class="button" value="' . $langs -> trans ( " Modify " ) . '"></td>' ;
print '</tr></table></form>' ;
}
else
{
2012-03-04 01:09:39 +01:00
if ( $object -> fk_soc )
2010-09-07 03:32:20 +02:00
{
$company = new Societe ( $db );
2012-03-04 01:09:39 +01:00
$result = $company -> fetch ( $object -> fk_soc );
2010-09-07 03:32:20 +02:00
print $company -> getNomUrl ( 1 );
}
else
{
print $langs -> trans ( " NoThirdPartyAssociatedToMember " );
}
}
print '</td></tr>' ;
}
// Login Dolibarr
print '<tr><td>' ;
print '<table class="nobordernopadding" width="100%"><tr><td>' ;
print $langs -> trans ( " LinkedToDolibarrUser " );
print '</td>' ;
2012-09-29 12:07:07 +02:00
if ( $action != 'editlogin' && $user -> rights -> adherent -> creer ) print '<td align="right"><a href="' . $_SERVER [ " PHP_SELF " ] . '?action=editlogin&rowid=' . $object -> id . '">' . img_edit ( $langs -> trans ( 'SetLinkToUser' ), 1 ) . '</a></td>' ;
2010-09-07 03:32:20 +02:00
print '</tr></table>' ;
print '</td><td class="valeur">' ;
2012-09-29 12:07:07 +02:00
if ( $action == 'editlogin' )
2010-09-07 03:32:20 +02:00
{
/* $include = array ();
2010-09-09 01:50:52 +02:00
if ( empty ( $user -> rights -> user -> user -> creer )) // If can edit only itself user, we can link to itself only
{
2012-03-04 01:09:39 +01:00
$include = array ( $object -> user_id , $user -> id );
2010-09-09 01:50:52 +02:00
} */
2015-02-10 10:45:48 +01:00
$form -> form_users ( $_SERVER [ 'PHP_SELF' ] . '?rowid=' . $object -> id , $object -> user_id , 'userid' , '' );
2010-09-07 03:32:20 +02:00
}
else
{
2012-03-04 01:09:39 +01:00
if ( $object -> user_id )
2010-09-07 03:32:20 +02:00
{
2015-02-10 10:45:48 +01:00
$form -> form_users ( $_SERVER [ 'PHP_SELF' ] . '?rowid=' . $object -> id , $object -> user_id , 'none' );
2010-09-07 03:32:20 +02:00
}
else print $langs -> trans ( " NoDolibarrAccess " );
}
print '</td></tr>' ;
2010-09-06 20:56:13 +02:00
print " </table> \n " ;
print '</form>' ;
2007-02-03 23:40:04 +01:00
2010-09-06 20:56:13 +02:00
dol_fiche_end ();
2007-02-03 23:40:04 +01:00
2007-09-05 09:43:43 +02:00
2015-04-27 11:46:30 +02:00
dol_htmloutput_errors ( $errmsg , $errmsgs );
2007-09-05 09:43:43 +02:00
2010-09-05 01:58:11 +02:00
2010-09-06 20:56:13 +02:00
/*
* Barre d ' actions
*/
2007-02-03 23:40:04 +01:00
2010-09-06 20:56:13 +02:00
// Lien nouvelle cotisation si non brouillon et non resilie
if ( $user -> rights -> adherent -> cotisation -> creer )
{
2011-02-26 10:51:53 +01:00
if ( $action != 'addsubscription' && $action != 'create_thirdparty' )
2010-09-09 01:50:52 +02:00
{
2010-09-07 02:38:03 +02:00
print '<div class="tabsAction">' ;
2013-04-03 18:37:54 +02:00
if ( $object -> statut > 0 ) print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER [ " PHP_SELF " ] . '?rowid=' . $rowid . '&action=addsubscription">' . $langs -> trans ( " AddSubscription " ) . " </a></div> " ;
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag ( $langs -> trans ( " ValidateBefore " )) . '">' . $langs -> trans ( " AddSubscription " ) . '</a></div>' ;
2007-02-03 23:40:04 +01:00
2010-09-06 20:56:13 +02:00
print " <br> \n " ;
2007-02-03 23:40:04 +01:00
2010-09-07 02:38:03 +02:00
print '</div>' ;
print '<br>' ;
2010-09-09 01:50:52 +02:00
}
2010-08-29 17:25:39 +02:00
}
2007-02-03 23:40:04 +01:00
2008-11-15 01:10:42 +01:00
2010-09-06 20:56:13 +02:00
/*
* List of subscriptions
*/
2011-02-26 10:51:53 +01:00
if ( $action != 'addsubscription' && $action != 'create_thirdparty' )
2010-08-29 17:25:39 +02:00
{
2013-02-23 15:26:39 +01:00
$sql = " SELECT d.rowid, d.firstname, d.lastname, d.societe, " ;
2010-09-06 20:56:13 +02:00
$sql .= " c.rowid as crowid, c.cotisation, " ;
2013-03-22 17:10:17 +01:00
$sql .= " c.datec, " ;
2014-05-05 00:42:52 +02:00
$sql .= " c.dateadh as dateh, " ;
2010-09-06 20:56:13 +02:00
$sql .= " c.datef, " ;
$sql .= " c.fk_bank, " ;
$sql .= " b.rowid as bid, " ;
$sql .= " ba.rowid as baid, ba.label, ba.bank " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " adherent as d, " . MAIN_DB_PREFIX . " cotisation as c " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " bank as b ON c.fk_bank = b.rowid " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " bank_account as ba ON b.fk_account = ba.rowid " ;
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid= " . $rowid ;
$result = $db -> query ( $sql );
if ( $result )
{
2010-09-09 01:50:52 +02:00
$cotisationstatic = new Cotisation ( $db );
$accountstatic = new Account ( $db );
$num = $db -> num_rows ( $result );
$i = 0 ;
print " <table class= \" noborder \" width= \" 100% \" > \n " ;
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " Ref " ) . '</td>' ;
2013-03-22 17:10:17 +01:00
print '<td align="center">' . $langs -> trans ( " DateCreation " ) . '</td>' ;
print '<td align="center">' . $langs -> trans ( " DateStart " ) . '</td>' ;
2010-09-09 01:50:52 +02:00
print '<td align="center">' . $langs -> trans ( " DateEnd " ) . '</td>' ;
print '<td align="right">' . $langs -> trans ( " Amount " ) . '</td>' ;
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> banque -> enabled ))
2010-09-09 01:50:52 +02:00
{
print '<td align="right">' . $langs -> trans ( " Account " ) . '</td>' ;
}
print " </tr> \n " ;
$var = True ;
while ( $i < $num )
{
$objp = $db -> fetch_object ( $result );
$var =! $var ;
2013-06-20 09:18:12 +02:00
print " <tr " . $bc [ $var ] . " > " ;
2010-09-09 01:50:52 +02:00
$cotisationstatic -> ref = $objp -> crowid ;
$cotisationstatic -> id = $objp -> crowid ;
print '<td>' . $cotisationstatic -> getNomUrl ( 1 ) . '</td>' ;
2013-03-22 17:10:17 +01:00
print '<td align="center">' . dol_print_date ( $db -> jdate ( $objp -> datec ), 'dayhour' ) . " </td> \n " ;
2014-05-05 00:42:52 +02:00
print '<td align="center">' . dol_print_date ( $db -> jdate ( $objp -> dateh ), 'day' ) . " </td> \n " ;
2010-09-09 01:50:52 +02:00
print '<td align="center">' . dol_print_date ( $db -> jdate ( $objp -> datef ), 'day' ) . " </td> \n " ;
print '<td align="right">' . price ( $objp -> cotisation ) . '</td>' ;
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> banque -> enabled ))
2010-09-09 01:50:52 +02:00
{
print '<td align="right">' ;
if ( $objp -> bid )
{
$accountstatic -> label = $objp -> label ;
$accountstatic -> id = $objp -> baid ;
print $accountstatic -> getNomUrl ( 1 );
}
else
{
print ' ' ;
}
print '</td>' ;
}
print " </tr> " ;
$i ++ ;
}
print " </table> " ;
2010-09-06 20:56:13 +02:00
}
else
{
2010-09-09 01:50:52 +02:00
dol_print_error ( $db );
2010-09-06 20:56:13 +02:00
}
2010-08-29 17:25:39 +02:00
2011-11-30 19:42:08 +01:00
// Link for paypal payment
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> paypal -> enabled ))
2011-11-30 19:42:08 +01:00
{
2012-08-23 02:04:35 +02:00
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php' ;
2012-03-04 01:09:39 +01:00
print showPaypalPaymentUrl ( 'membersubscription' , $object -> ref );
2011-11-30 19:42:08 +01:00
}
}
2010-08-29 17:25:39 +02:00
2010-09-06 20:56:13 +02:00
/*
* Add new subscription form
*/
2011-02-26 10:51:53 +01:00
if (( $action == 'addsubscription' || $action == 'create_thirdparty' ) && $user -> rights -> adherent -> cotisation -> creer )
2010-09-06 20:56:13 +02:00
{
2010-09-09 01:50:52 +02:00
print '<br>' ;
2010-09-06 20:56:13 +02:00
2010-09-09 01:50:52 +02:00
print_fiche_titre ( $langs -> trans ( " NewCotisation " ));
2010-08-29 17:25:39 +02:00
2012-12-09 20:54:45 +01:00
// Define default choice to select
$bankdirect = 0 ; // 1 means option by default is write to bank direct with no invoice
$invoiceonly = 0 ; // 1 means option by default is invoice only
$bankviainvoice = 0 ; // 1 means option by default is write to bank via invoice
if ( GETPOST ( 'paymentsave' ))
{
if ( GETPOST ( 'paymentsave' ) == 'bankdirect' ) $bankdirect = 1 ;
if ( GETPOST ( 'paymentsave' ) == 'invoiceonly' ) $invoiceonly = 1 ;
if ( GETPOST ( 'paymentsave' ) == 'bankviainvoice' ) $bankviainvoice = 1 ;
}
else
{
2014-04-06 14:22:08 +02:00
if ( ! empty ( $conf -> global -> ADHERENT_BANK_USE ) && $conf -> global -> ADHERENT_BANK_USE == 'bankviainvoice' && ! empty ( $conf -> banque -> enabled ) && ! empty ( $conf -> societe -> enabled ) && ! empty ( $conf -> facture -> enabled )) $bankviainvoice = 1 ;
2013-03-06 17:16:26 +01:00
else if ( ! empty ( $conf -> global -> ADHERENT_BANK_USE ) && $conf -> global -> ADHERENT_BANK_USE == 'bankdirect' && ! empty ( $conf -> banque -> enabled )) $bankdirect = 1 ;
2014-04-06 14:22:08 +02:00
else if ( ! empty ( $conf -> global -> ADHERENT_BANK_USE ) && $conf -> global -> ADHERENT_BANK_USE == 'invoiceonly' && ! empty ( $conf -> banque -> enabled ) && ! empty ( $conf -> societe -> enabled ) && ! empty ( $conf -> facture -> enabled )) $invoiceonly = 1 ;
2012-12-09 20:54:45 +01:00
}
2010-09-06 20:56:13 +02:00
2010-09-09 01:50:52 +02:00
print " \n \n <!-- Form add subscription --> \n " ;
2010-09-06 20:56:13 +02:00
2010-09-09 01:50:52 +02:00
if ( $conf -> use_javascript_ajax )
{
2012-12-09 20:54:45 +01:00
//var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE));
2010-09-06 20:56:13 +02:00
print " \n " . '<script type="text/javascript" language="javascript">' ;
2012-09-29 12:07:07 +02:00
print ' $ ( document ) . ready ( function () {
2012-12-09 20:54:45 +01:00
$ ( " .bankswitchclass, .bankswitchclass2 " ) . '.(($bankdirect||$bankviainvoice)?' show () ':' hide () ').' ;
2012-09-29 12:07:07 +02:00
$ ( " #none, #invoiceonly " ) . click ( function () {
$ ( " .bankswitchclass " ) . hide ();
$ ( " .bankswitchclass2 " ) . hide ();
2010-09-06 20:56:13 +02:00
});
2012-09-29 12:07:07 +02:00
$ ( " #bankdirect, #bankviainvoice " ) . click ( function () {
$ ( " .bankswitchclass " ) . show ();
$ ( " .bankswitchclass2 " ) . show ();
2010-09-06 20:56:13 +02:00
});
2012-09-29 12:07:07 +02:00
$ ( " #selectoperation " ) . change ( function () {
var code = $ ( this ) . val ();
if ( code == " CHQ " )
2011-02-26 03:17:29 +01:00
{
2012-09-29 12:07:07 +02:00
$ ( " .fieldrequireddyn " ) . addClass ( " fieldrequired " );
if ( $ ( " #fieldchqemetteur " ) . val () == " " )
2011-02-26 11:18:29 +01:00
{
2012-09-29 12:07:07 +02:00
$ ( " #fieldchqemetteur " ) . val ( $ ( " #memberlabel " ) . val ());
2011-02-26 11:18:29 +01:00
}
2011-02-26 03:23:01 +01:00
}
else
{
2012-09-29 12:07:07 +02:00
$ ( " .fieldrequireddyn " ) . removeClass ( " fieldrequired " );
2011-02-26 03:17:29 +01:00
}
});
2010-09-10 00:45:05 +02:00
' ;
2012-09-29 12:07:07 +02:00
if ( GETPOST ( 'paymentsave' )) print '$("#' . GETPOST ( 'paymentsave' ) . '").attr("checked",true);' ;
2010-09-10 00:45:05 +02:00
print '});' ;
2010-09-09 01:50:52 +02:00
print '</script>' . " \n " ;
}
2011-02-26 10:51:53 +01:00
// Confirm create third party
2012-09-29 12:07:07 +02:00
if ( $action == 'create_thirdparty' )
2011-02-26 10:51:53 +01:00
{
2012-03-04 01:09:39 +01:00
$name = $object -> getFullName ( $langs );
2011-02-26 10:51:53 +01:00
if ( ! empty ( $name ))
{
2014-06-28 01:53:56 +02:00
if ( $object -> morphy == 'mor' && ! empty ( $object -> societe )) $name = $object -> societe . ' (' . $name . ')' ;
else if ( $object -> societe ) $name .= ' (' . $object -> societe . ')' ;
2011-02-26 10:51:53 +01:00
}
else
{
2012-03-04 01:09:39 +01:00
$name = $object -> societe ;
2011-02-26 10:51:53 +01:00
}
2011-03-06 14:55:47 +01:00
2011-02-26 10:51:53 +01:00
// Create a form array
2012-09-29 12:07:07 +02:00
$formquestion = array ( array ( 'label' => $langs -> trans ( " NameToCreate " ), 'type' => 'text' , 'name' => 'companyname' , 'value' => $name ));
2011-03-06 14:55:47 +01:00
2013-09-06 11:51:24 +02:00
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?rowid= " . $object -> id , $langs -> trans ( " CreateDolibarrThirdParty " ), $langs -> trans ( " ConfirmCreateThirdParty " ), " confirm_create_thirdparty " , $formquestion , 1 );
2011-02-26 10:51:53 +01:00
}
2011-03-06 14:55:47 +01:00
2012-09-29 12:07:07 +02:00
print '<form name="cotisation" method="POST" action="' . $_SERVER [ " PHP_SELF " ] . '">' ;
2010-09-09 01:50:52 +02:00
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<input type="hidden" name="action" value="cotisation">' ;
print '<input type="hidden" name="rowid" value="' . $rowid . '">' ;
2012-03-04 01:09:39 +01:00
print '<input type="hidden" name="memberlabel" id="memberlabel" value="' . dol_escape_htmltag ( $object -> getFullName ( $langs )) . '">' ;
2013-03-09 20:34:38 +01:00
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="' . dol_escape_htmltag ( $object -> societe ) . '">' ;
2010-09-09 01:50:52 +02:00
print " <table class= \" border \" width= \" 100% \" > \n " ;
2012-04-30 15:01:25 +02:00
$today = dol_now ();
2010-09-09 01:50:52 +02:00
$datefrom = 0 ;
$dateto = 0 ;
2011-03-23 19:25:53 +01:00
$paymentdate =- 1 ;
// Date payment
2012-11-13 12:32:05 +01:00
if ( GETPOST ( 'paymentyear' ) && GETPOST ( 'paymentmonth' ) && GETPOST ( 'paymentday' ))
2011-03-23 19:25:53 +01:00
{
2012-11-13 12:32:05 +01:00
$paymentdate = dol_mktime ( 0 , 0 , 0 , GETPOST ( 'paymentmonth' ), GETPOST ( 'paymentday' ), GETPOST ( 'paymentyear' ));
2011-03-23 19:25:53 +01:00
}
2010-09-09 01:50:52 +02:00
// Date start subscription
print '<tr><td width="30%" class="fieldrequired">' . $langs -> trans ( " DateSubscription " ) . '</td><td>' ;
2012-11-13 12:32:05 +01:00
if ( GETPOST ( 'reday' ))
2010-09-09 01:50:52 +02:00
{
2012-11-13 12:32:05 +01:00
$datefrom = dol_mktime ( 0 , 0 , 0 , GETPOST ( 'remonth' ), GETPOST ( 'reday' ), GETPOST ( 'reyear' ));
2010-09-09 01:50:52 +02:00
}
if ( ! $datefrom )
{
2012-03-04 01:09:39 +01:00
if ( $object -> datefin > 0 )
2010-09-09 01:50:52 +02:00
{
2012-03-04 01:09:39 +01:00
$datefrom = dol_time_plus_duree ( $object -> datefin , 1 , 'd' );
2010-09-09 01:50:52 +02:00
}
else
2012-12-31 13:39:42 +01:00
{
//$datefrom=dol_now();
$datefrom = $object -> datevalid ;
2010-09-09 01:50:52 +02:00
}
}
2012-12-31 13:39:42 +01:00
$form -> select_date ( $datefrom , '' , '' , '' , '' , " cotisation " , 1 , 1 );
2010-09-09 01:50:52 +02:00
print " </td></tr> " ;
// Date end subscription
2012-11-13 12:32:05 +01:00
if ( GETPOST ( 'endday' ))
2010-09-09 01:50:52 +02:00
{
2012-11-13 12:32:05 +01:00
$dateto = dol_mktime ( 0 , 0 , 0 , GETPOST ( 'endmonth' ), GETPOST ( 'endday' ), GETPOST ( 'endyear' ));
2010-09-09 01:50:52 +02:00
}
if ( ! $dateto )
{
$dateto =- 1 ; // By default, no date is suggested
}
print '<tr><td>' . $langs -> trans ( " DateEndSubscription " ) . '</td><td>' ;
2011-11-08 10:18:45 +01:00
$form -> select_date ( $dateto , 'end' , '' , '' , '' , " cotisation " );
2010-09-09 01:50:52 +02:00
print " </td></tr> " ;
if ( $adht -> cotisation )
{
// Amount
2012-11-13 12:32:05 +01:00
print '<tr><td class="fieldrequired">' . $langs -> trans ( " Amount " ) . '</td><td><input type="text" name="cotisation" size="6" value="' . GETPOST ( 'cotisation' ) . '"> ' . $langs -> trans ( " Currency " . $conf -> currency ) . '</td></tr>' ;
2010-09-09 01:50:52 +02:00
// Label
2014-11-29 20:41:09 +01:00
print '<tr><td>' . $langs -> trans ( " Label " ) . '</td>' ;
print '<td><input name="label" type="text" size="32" value="' ;
if ( empty ( $conf -> global -> MEMBER_NO_DEFAULT_LABEL )) print $langs -> trans ( " Subscription " ) . ' ' . dol_print_date (( $datefrom ? $datefrom : time ()), " %Y " );
print '"></td></tr>' ;
2010-09-09 01:50:52 +02:00
2010-09-10 00:45:05 +02:00
// Complementary action
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> banque -> enabled ) || ! empty ( $conf -> facture -> enabled ))
2010-09-09 01:50:52 +02:00
{
2010-09-06 20:56:13 +02:00
$company = new Societe ( $db );
2012-03-04 01:09:39 +01:00
if ( $object -> fk_soc )
2010-09-06 20:56:13 +02:00
{
2012-03-04 01:09:39 +01:00
$result = $company -> fetch ( $object -> fk_soc );
2010-09-06 20:56:13 +02:00
}
2007-02-03 23:40:04 +01:00
2010-09-06 20:56:13 +02:00
// Title payments
//print '<tr><td colspan="2"><b>'.$langs->trans("Payment").'</b></td></tr>';
2007-09-04 19:53:11 +02:00
2013-03-22 17:10:17 +01:00
// No more action
2010-09-06 20:56:13 +02:00
print '<tr><td valign="top" class="fieldrequired">' . $langs -> trans ( 'MoreActions' );
print '</td>' ;
print '<td>' ;
2012-12-09 20:54:45 +01:00
print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"' . ( empty ( $bankdirect ) && empty ( $invoiceonly ) && empty ( $bankviainvoice ) ? ' checked="checked"' : '' ) . '> ' . $langs -> trans ( " None " ) . '<br>' ;
2013-03-22 17:10:17 +01:00
// Add entry into bank accoun
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> banque -> enabled ))
2010-09-06 20:56:13 +02:00
{
2012-09-29 12:07:07 +02:00
print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"' . ( ! empty ( $bankdirect ) ? ' checked="checked"' : '' );
2010-09-06 20:56:13 +02:00
print '> ' . $langs -> trans ( " MoreActionBankDirect " ) . '<br>' ;
}
2013-03-22 17:10:17 +01:00
// Add invoice with no payments
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> societe -> enabled ) && ! empty ( $conf -> facture -> enabled ))
2010-09-06 20:56:13 +02:00
{
2012-12-09 20:54:45 +01:00
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"' . ( ! empty ( $invoiceonly ) ? ' checked="checked"' : '' );
2014-04-06 14:22:08 +02:00
//if (empty($object->fk_soc)) print ' disabled="disabled"';
2012-01-31 12:18:43 +01:00
print '> ' . $langs -> trans ( " MoreActionInvoiceOnly " );
2012-03-04 01:09:39 +01:00
if ( $object -> fk_soc ) print ' (' . $langs -> trans ( " ThirdParty " ) . ': ' . $company -> getNomUrl ( 1 ) . ')' ;
2011-03-06 14:55:47 +01:00
else
2013-03-22 17:10:17 +01:00
{
2014-04-06 14:22:08 +02:00
print ' (' ;
if ( empty ( $object -> fk_soc )) print img_warning ( $langs -> trans ( " NoThirdPartyAssociatedToMember " ));
print $langs -> trans ( " NoThirdPartyAssociatedToMember " );
2012-03-04 01:09:39 +01:00
print ' - <a href="' . $_SERVER [ " PHP_SELF " ] . '?rowid=' . $object -> id . '&action=create_thirdparty">' ;
2011-02-26 10:51:53 +01:00
print $langs -> trans ( " CreateDolibarrThirdParty " );
print '</a>)' ;
}
2014-12-01 13:26:05 +01:00
if ( empty ( $conf -> global -> ADHERENT_VAT_FOR_SUBSCRIPTIONS ) || $conf -> global -> ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry' ) print '. ' . $langs -> trans ( " NoVatOnSubscription " , 0 );
if ( ! empty ( $conf -> global -> ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS ) && ( ! empty ( $conf -> product -> enabled ) || ! empty ( $conf -> service -> enabled )))
{
$prodtmp = new Product ( $db );
$prodtmp -> fetch ( $conf -> global -> ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS );
print '. ' . $langs -> trans ( " ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS " , $prodtmp -> getNomUrl ( 0 ));
}
2010-09-06 20:56:13 +02:00
print '<br>' ;
}
2013-03-22 17:10:17 +01:00
// Add invoice with payments
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> banque -> enabled ) && ! empty ( $conf -> societe -> enabled ) && ! empty ( $conf -> facture -> enabled ))
2010-09-06 20:56:13 +02:00
{
2012-12-09 20:54:45 +01:00
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"' . ( ! empty ( $bankviainvoice ) ? ' checked="checked"' : '' );
2014-04-06 14:22:08 +02:00
//if (empty($object->fk_soc)) print ' disabled="disabled"';
2012-01-31 12:18:43 +01:00
print '> ' . $langs -> trans ( " MoreActionBankViaInvoice " );
2012-03-04 01:09:39 +01:00
if ( $object -> fk_soc ) print ' (' . $langs -> trans ( " ThirdParty " ) . ': ' . $company -> getNomUrl ( 1 ) . ')' ;
2011-03-06 14:55:47 +01:00
else
2013-03-22 17:10:17 +01:00
{
2014-04-06 14:22:08 +02:00
print ' (' ;
if ( empty ( $object -> fk_soc )) print img_warning ( $langs -> trans ( " NoThirdPartyAssociatedToMember " ));
print $langs -> trans ( " NoThirdPartyAssociatedToMember " );
2012-03-04 01:09:39 +01:00
print ' - <a href="' . $_SERVER [ " PHP_SELF " ] . '?rowid=' . $object -> id . '&action=create_thirdparty">' ;
2011-02-26 10:51:53 +01:00
print $langs -> trans ( " CreateDolibarrThirdParty " );
print '</a>)' ;
}
2014-12-01 13:26:05 +01:00
if ( empty ( $conf -> global -> ADHERENT_VAT_FOR_SUBSCRIPTIONS ) || $conf -> global -> ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry' ) print '. ' . $langs -> trans ( " NoVatOnSubscription " , 0 );
if ( ! empty ( $conf -> global -> ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS ) && ( ! empty ( $conf -> product -> enabled ) || ! empty ( $conf -> service -> enabled )))
{
$prodtmp = new Product ( $db );
$prodtmp -> fetch ( $conf -> global -> ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS );
print '. ' . $langs -> trans ( " ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS " , $prodtmp -> getNomUrl ( 0 ));
}
2010-09-06 20:56:13 +02:00
print '<br>' ;
}
print '</td></tr>' ;
2007-09-04 19:53:11 +02:00
2010-09-09 01:50:52 +02:00
// Bank account
print '<tr class="bankswitchclass"><td class="fieldrequired">' . $langs -> trans ( " FinancialAccount " ) . '</td><td>' ;
2012-11-13 12:32:05 +01:00
$form -> select_comptes ( GETPOST ( 'accountid' ), 'accountid' , 0 , '' , 1 );
2010-09-09 01:50:52 +02:00
print " </td></tr> \n " ;
// Payment mode
print '<tr class="bankswitchclass"><td class="fieldrequired">' . $langs -> trans ( " PaymentMode " ) . '</td><td>' ;
2012-11-13 12:32:05 +01:00
$form -> select_types_paiements ( GETPOST ( 'operation' ), 'operation' , '' , 2 );
2010-09-09 01:50:52 +02:00
print " </td></tr> \n " ;
2011-03-23 19:25:53 +01:00
// Date of payment
print '<tr class="bankswitchclass"><td class="fieldrequired">' . $langs -> trans ( " DatePayment " ) . '</td><td>' ;
2012-11-13 12:32:05 +01:00
$form -> select_date ( isset ( $paymentdate ) ? $paymentdate :- 1 , 'payment' , 0 , 0 , 1 , 'cotisation' , 1 , 1 );
2011-03-23 19:25:53 +01:00
print " </td></tr> \n " ;
2010-09-09 01:50:52 +02:00
2010-09-10 00:56:41 +02:00
print '<tr class="bankswitchclass2"><td>' . $langs -> trans ( 'Numero' );
2010-09-09 01:50:52 +02:00
print ' <em>(' . $langs -> trans ( " ChequeOrTransferNumber " ) . ')</em>' ;
print '</td>' ;
2012-11-13 12:32:05 +01:00
print '<td><input id="fieldnum_chq" name="num_chq" type="text" size="8" value="' . ( ! GETPOST ( 'num_chq' ) ? '' : GETPOST ( 'num_chq' )) . '"></td></tr>' ;
2010-09-09 01:50:52 +02:00
2011-02-26 03:23:01 +01:00
print '<tr class="bankswitchclass2 fieldrequireddyn"><td>' . $langs -> trans ( 'CheckTransmitter' );
2010-09-09 01:50:52 +02:00
print ' <em>(' . $langs -> trans ( " ChequeMaker " ) . ')</em>' ;
print '</td>' ;
2012-11-13 12:32:05 +01:00
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="' . ( ! GETPOST ( 'chqemetteur' ) ? '' : GETPOST ( 'chqemetteur' )) . '"></td></tr>' ;
2010-09-09 01:50:52 +02:00
2010-09-10 00:56:41 +02:00
print '<tr class="bankswitchclass2"><td>' . $langs -> trans ( 'Bank' );
2010-09-09 01:50:52 +02:00
print ' <em>(' . $langs -> trans ( " ChequeBank " ) . ')</em>' ;
print '</td>' ;
2012-11-13 12:32:05 +01:00
print '<td><input id="chqbank" name="chqbank" size="32" type="text" value="' . ( ! GETPOST ( 'chqbank' ) ? '' : GETPOST ( 'chqbank' )) . '"></td></tr>' ;
2010-09-09 01:50:52 +02:00
}
}
2010-08-29 17:25:39 +02:00
2010-09-06 20:56:13 +02:00
print '<tr><td colspan="2"> </td>' ;
2008-11-15 01:10:42 +01:00
2010-09-06 20:56:13 +02:00
print '<tr><td width="30%">' . $langs -> trans ( " SendAcknowledgementByMail " ) . '</td>' ;
2010-09-09 01:50:52 +02:00
print '<td>' ;
2012-03-04 01:09:39 +01:00
if ( ! $object -> email )
2010-09-09 01:50:52 +02:00
{
print $langs -> trans ( " NoEMail " );
}
else
{
2010-09-06 20:56:13 +02:00
$adht = new AdherentType ( $db );
2012-03-04 01:09:39 +01:00
$adht -> fetch ( $object -> typeid );
2010-09-06 20:56:13 +02:00
2012-03-04 01:09:39 +01:00
$subjecttosend = $object -> makeSubstitution ( $conf -> global -> ADHERENT_MAIL_COTIS_SUBJECT );
$texttosend = $object -> makeSubstitution ( $adht -> getMailOnSubscription ());
2010-09-06 20:56:13 +02:00
2012-11-13 12:32:05 +01:00
$tmp = '<input name="sendmail" type="checkbox"' . ( GETPOST ( 'sendmail' ) ? GETPOST ( 'sendmail' ) : ( ! empty ( $conf -> global -> ADHERENT_DEFAULT_SENDINFOBYMAIL ) ? ' checked="checked"' : '' )) . '>' ;
2010-09-06 20:56:13 +02:00
$helpcontent = '' ;
$helpcontent .= '<b>' . $langs -> trans ( " MailFrom " ) . '</b>: ' . $conf -> global -> ADHERENT_MAIL_FROM . '<br>' . " \n " ;
2012-03-04 01:09:39 +01:00
$helpcontent .= '<b>' . $langs -> trans ( " MailRecipient " ) . '</b>: ' . $object -> email . '<br>' . " \n " ;
2012-08-29 00:29:47 +02:00
$helpcontent .= '<b>' . $langs -> trans ( " MailTopic " ) . '</b>:<br>' . " \n " ;
2010-09-06 20:56:13 +02:00
$helpcontent .= $subjecttosend . " \n " ;
$helpcontent .= " <br> " ;
2012-08-29 00:29:47 +02:00
$helpcontent .= '<b>' . $langs -> trans ( " MailText " ) . '</b>:<br>' ;
2010-09-06 20:56:13 +02:00
$helpcontent .= dol_htmlentitiesbr ( $texttosend ) . " \n " ;
2011-11-08 10:18:45 +01:00
print $form -> textwithpicto ( $tmp , $helpcontent , 1 , 'help' );
2010-09-09 01:50:52 +02:00
}
print '</td></tr>' ;
2010-09-06 20:56:13 +02:00
print '</table>' ;
print '<br>' ;
2010-08-29 17:25:39 +02:00
2014-11-25 20:13:43 +01:00
print '<div class="center">' ;
2010-09-09 01:50:52 +02:00
print '<input type="submit" class="button" name="add" value="' . $langs -> trans ( " AddSubscription " ) . '">' ;
2014-11-25 20:13:43 +01:00
print ' ' ;
2010-09-09 01:50:52 +02:00
print '<input type="submit" class="button" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '">' ;
2014-11-25 20:13:43 +01:00
print '</div>' ;
2007-02-03 23:40:04 +01:00
2010-09-09 01:50:52 +02:00
print '</form>' ;
2007-02-03 23:40:04 +01:00
2010-09-09 01:50:52 +02:00
print " \n <!-- End form subscription --> \n \n " ;
2010-09-06 20:56:13 +02:00
}
2007-02-03 23:40:04 +01:00
2010-09-06 20:56:13 +02:00
//print '</td></tr>';
//print '</table>';
}
else
{
$langs -> load ( " errors " );
print $langs -> trans ( " ErrorRecordNotFound " );
2007-02-03 23:40:04 +01:00
}
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-03-04 01:09:39 +01:00
$db -> close ();