2007-02-03 23:40:04 +01:00
< ? php
2018-01-10 13:02:05 +01:00
/* Copyright ( C ) 2001 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2012-09-29 12:07:07 +02:00
* Copyright ( C ) 2002 - 2003 Jean - Louis Bergamo < jlb @ j1b . org >
2018-01-10 13:02:05 +01:00
* Copyright ( C ) 2004 - 2018 Laurent Destailleur < eldy @ users . sourceforge . net >
2017-10-09 12:38:44 +02:00
* Copyright ( C ) 2012 - 2017 Regis Houssin < regis . houssin @ capnetworks . com >
2016-09-24 06:48:40 +02:00
* Copyright ( C ) 2015 - 2016 Alexandre Spangaro < aspangaro . dolibarr @ gmail . 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
*/
/**
2016-09-24 06:48:40 +02:00
* \file htdocs / adherents / subscription . 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' ;
2016-09-24 06:48:40 +02:00
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php' ;
2017-10-11 11:42:39 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php' ;
2007-02-03 23:40:04 +01:00
2018-01-10 13:02:05 +01:00
$langs -> loadLangs ( array ( " companies " , " bills " , " members " , " users " , " mails " , 'other' ));
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' );
2018-01-10 13:02:05 +01:00
$rowid = GETPOST ( 'rowid' , 'int' ) ? GETPOST ( 'rowid' , 'int' ) : GETPOST ( 'id' , 'int' );
2012-04-15 11:28:21 +02:00
$typeid = GETPOST ( 'typeid' , 'int' );
2018-01-10 13:02:05 +01:00
// Load variable for pagination
$limit = GETPOST ( 'limit' , 'int' ) ? GETPOST ( 'limit' , 'int' ) : $conf -> liste_limit ;
$sortfield = GETPOST ( 'sortfield' , 'alpha' );
$sortorder = GETPOST ( 'sortorder' , 'alpha' );
$page = GETPOST ( 'page' , 'int' );
if ( empty ( $page ) || $page == - 1 ) { $page = 0 ; } // If $page is not defined, or '' or -1
$offset = $limit * $page ;
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
// Default sort order (if not yet defined by previous GETPOST)
if ( ! $sortfield ) $sortfield = " c.rowid " ;
if ( ! $sortorder ) $sortorder = " DESC " ;
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 );
2016-06-24 00:45:35 +02:00
// fetch optionals attributes and labels
$extralabels = $extrafields -> fetch_name_optionals_label ( $object -> table_element );
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 ;
}
2017-06-10 12:56:28 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
2017-04-15 08:35:23 +02:00
$hookmanager -> initHooks ( array ( 'subscription' ));
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 ));
2018-01-10 13:02:05 +01:00
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 )
{
2018-03-05 21:46:24 +01:00
// Creation of thirdparty
2011-02-26 10:51:53 +01:00
$company = new Societe ( $db );
2018-12-18 21:00:06 +01:00
$result = $company -> create_from_member ( $object , GETPOST ( 'companyname' , 'alpha' ), GETPOST ( 'companyalias' , 'alpha' ), GETPOST ( 'customercode' , 'alpha' ));
2011-03-06 14:55:47 +01:00
2011-02-26 10:51:53 +01:00
if ( $result < 0 )
{
$langs -> load ( " errors " );
2015-10-23 12:58:30 +02:00
setEventMessages ( $company -> error , $company -> errors , 'errors' );
2011-02-26 10:51:53 +01:00
}
else
{
$action = 'addsubscription' ;
}
}
else
{
2017-08-23 16:53:29 +02:00
setEventMessages ( $object -> error , $object -> errors , 'errors' );
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 ++ ;
2015-10-23 12:58:30 +02:00
setEventMessages ( $langs -> trans ( " ErrorUserPermissionAllowsToLinksToItselfOnly " ), null , '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 ++ ;
2015-10-23 12:58:30 +02:00
setEventMessages ( $langs -> trans ( " ErrorMemberIsAlreadyLinkedToThisThirdParty " , $othermember -> getFullName ( $langs ), $othermember -> login , $thirdparty -> name ), null , '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 = '' ;
}
}
}
}
2016-09-24 06:48:40 +02:00
if ( $user -> rights -> adherent -> cotisation -> creer && $action == 'subscription' && ! $_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
2018-03-05 21:46:24 +01:00
$result = $object -> fetch ( $rowid );
$result = $adht -> fetch ( $object -> typeid );
2010-09-09 01:50:52 +02:00
// Subscription informations
2016-09-24 06:48:40 +02:00
$datesubscription = 0 ;
2010-09-09 01:50:52 +02:00
$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 " ])
{
2016-09-24 06:48:40 +02:00
$datesubscription = dol_mktime ( 0 , 0 , 0 , $_POST [ " remonth " ], $_POST [ " reday " ], $_POST [ " reyear " ]);
2010-09-09 01:50:52 +02:00
}
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 " ]);
}
2018-03-05 21:46:24 +01:00
$amount = price2num ( GETPOST ( " subscription " , 'alpha' )); // Amount of subscription
2010-09-09 01:50:52 +02:00
$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' ;
2018-03-05 21:46:24 +01:00
$sendalsoemail = GETPOST ( " sendmail " , 'alpha' );
2011-03-23 19:39:05 +01:00
// Check parameters
2016-09-24 06:48:40 +02:00
if ( ! $datesubscription )
2010-09-09 01:50:52 +02:00
{
$error ++ ;
2011-08-27 18:41:30 +02:00
$langs -> load ( " errors " );
$errmsg = $langs -> trans ( " ErrorBadDateFormat " , $langs -> transnoentitiesnoconv ( " DateSubscription " ));
2017-08-23 16:53:29 +02:00
setEventMessages ( $errmsg , null , 'errors' );
2011-08-27 18:41:30 +02:00
$action = 'addsubscription' ;
}
if ( GETPOST ( 'end' ) && ! $datesubend )
{
$error ++ ;
$langs -> load ( " errors " );
$errmsg = $langs -> trans ( " ErrorBadDateFormat " , $langs -> transnoentitiesnoconv ( " DateEndSubscription " ));
2017-08-23 16:53:29 +02:00
setEventMessages ( $errmsg , null , 'errors' );
2010-09-09 01:50:52 +02:00
$action = 'addsubscription' ;
}
if ( ! $datesubend )
{
2016-09-24 06:48:40 +02:00
$datesubend = dol_time_plus_duree ( dol_time_plus_duree ( $datesubscription , $defaultdelay , $defaultdelayunit ), - 1 , 'd' );
2010-09-09 01:50:52 +02:00
}
2011-03-23 19:39:05 +01:00
if (( $option == 'bankviainvoice' || $option == 'bankdirect' ) && ! $paymentdate )
{
$error ++ ;
$errmsg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentitiesnoconv ( " DatePayment " ));
2017-08-23 16:53:29 +02:00
setEventMessages ( $errmsg , null , 'errors' );
2011-03-23 19:39:05 +01:00
$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
2016-09-26 01:15:17 +02:00
if ( ! $error && $adht -> subscription ) // Member type need subscriptions
2010-09-09 01:50:52 +02:00
{
2017-08-23 16:53:29 +02:00
if ( ! is_numeric ( $amount ))
2010-09-09 01:50:52 +02:00
{
// If field is '' or not a numeric value
$errmsg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Amount " ));
2017-08-23 16:53:29 +02:00
setEventMessages ( $errmsg , null , 'errors' );
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
{
2016-09-24 06:48:40 +02:00
if ( $_POST [ " subscription " ])
2010-09-09 01:50:52 +02:00
{
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 " ));
2018-03-05 21:46:24 +01:00
if ( $_POST [ " paymentsave " ] != 'invoiceonly' && ! ( $_POST [ " accountid " ] > 0 )) $errmsg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " FinancialAccount " ));
2010-09-09 01:50:52 +02:00
}
else
{
if ( $_POST [ " accountid " ]) $errmsg = $langs -> trans ( " ErrorDoNotProvideAccountsIfNullAmount " );
}
2017-08-23 16:53:29 +02:00
if ( $errmsg )
{
2018-03-05 21:46:24 +01:00
$error ++ ;
2017-08-23 16:53:29 +02:00
setEventMessages ( $errmsg , null , 'errors' );
2018-03-05 15:43:48 +01:00
$error ++ ;
2017-08-23 16:53:29 +02:00
$action = 'addsubscription' ;
}
2010-09-09 01:50:52 +02:00
}
}
}
2018-03-05 21:46:24 +01:00
// Record the subscription then complementary actions
2016-09-24 06:48:40 +02:00
if ( ! $error && $action == 'subscription' )
2010-09-09 01:50:52 +02:00
{
$db -> begin ();
2010-09-10 00:45:05 +02:00
// Create subscription
2018-03-05 21:46:24 +01:00
$crowid = $object -> subscription ( $datesubscription , $amount , $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 )
{
2018-03-05 21:46:24 +01:00
$result = $object -> subscriptionComplementaryActions ( $crowid , $option , $accountid , $datesubscription , $paymentdate , $operation , $label , $amount , $num_chq , $emetteur_nom , $emetteur_banque );
if ( $result < 0 )
{
$error ++ ;
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
2018-03-08 15:01:34 +01:00
else
{
// If an invoice was created, it is into $object->invoice
}
2010-09-09 01:50:52 +02:00
}
if ( ! $error )
{
2018-08-09 20:41:15 +02:00
$db -> commit ();
2010-09-09 01:50:52 +02:00
}
else
{
$db -> rollback ();
$action = 'addsubscription' ;
}
2018-03-08 15:01:34 +01:00
if ( ! $error )
{
setEventMessages ( " SubscriptionRecorded " , null , 'mesgs' );
}
2010-09-09 01:50:52 +02:00
// Send email
if ( ! $error )
{
2010-09-05 21:22:00 +02:00
// Send confirmation Email
2018-03-05 21:46:24 +01:00
if ( $object -> email && $sendalsoemail )
2010-09-05 21:22:00 +02:00
{
2018-03-23 19:35:25 +01:00
$subject = '' ;
$msg = '' ;
// Send subscription email
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php' ;
$formmail = new FormMail ( $db );
// Set output language
$outputlangs = new Translate ( '' , $conf );
$outputlangs -> setDefaultLang ( empty ( $object -> thirdparty -> default_lang ) ? $mysoc -> default_lang : $object -> thirdparty -> default_lang );
$outputlangs -> loadLangs ( array ( " main " , " members " ));
2018-12-18 21:27:16 +01:00
// Get email content from templae
2018-03-23 19:35:25 +01:00
$arraydefaultmessage = null ;
$labeltouse = $conf -> global -> ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION ;
if ( ! empty ( $labeltouse )) $arraydefaultmessage = $formmail -> getEMailTemplate ( $db , 'member' , $user , $outputlangs , 0 , 1 , $labeltouse );
if ( ! empty ( $labeltouse ) && is_object ( $arraydefaultmessage ) && $arraydefaultmessage -> id > 0 )
{
$subject = $arraydefaultmessage -> topic ;
$msg = $arraydefaultmessage -> content ;
}
$substitutionarray = getCommonSubstitutionArray ( $outputlangs , 0 , null , $object );
complete_substitutions_array ( $substitutionarray , $outputlangs , $object );
$subjecttosend = make_substitutions ( $subject , $substitutionarray , $outputlangs );
$texttosend = make_substitutions ( dol_concatdesc ( $msg , $adht -> getMailOnSubscription ()), $substitutionarray , $outputlangs );
2010-09-05 21:22:00 +02:00
2018-03-08 15:01:34 +01:00
// Attach a file ?
$file = '' ;
$listofpaths = array ();
$listofnames = array ();
$listofmimes = array ();
if ( is_object ( $object -> invoice ))
{
$invoicediroutput = $conf -> facture -> dir_output ;
$fileparams = dol_most_recent_file ( $invoicediroutput . '/' . $object -> invoice -> ref , preg_quote ( $object -> invoice -> ref , '/' ) . '[^\-]+' );
$file = $fileparams [ 'fullname' ];
$listofpaths = array ( $file );
$listofnames = array ( basename ( $file ));
$listofmimes = array ( dol_mimetype ( $file ));
}
2018-10-06 20:51:35 +02:00
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php' . " \r \n " ;
$result = $object -> send_an_email ( $texttosend , $subjecttosend , $listofpaths , $listofnames , $listofmimes , " " , " " , 0 , - 1 , '' , $moreinheader );
2015-04-27 11:46:30 +02:00
if ( $result < 0 )
{
$errmsg = $object -> error ;
2018-03-08 15:01:34 +01:00
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
else
{
setEventMessages ( $langs -> trans ( " EmailSentToMember " , $object -> email ), null , 'mesgs' );
2015-04-27 11:46:30 +02:00
}
2010-09-05 21:22:00 +02:00
}
2018-03-08 15:01:34 +01:00
else
{
setEventMessages ( $langs -> trans ( " NoEmailSentToMember " ), null , 'mesgs' );
}
2018-03-05 21:46:24 +01:00
}
2010-09-05 21:22:00 +02:00
2018-03-05 21:46:24 +01:00
// Clean some POST vars
if ( ! $error )
{
2016-09-24 06:48:40 +02:00
$_POST [ " subscription " ] = '' ;
2010-09-05 21:22:00 +02:00
$_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 ();
2016-08-29 22:07:21 +02:00
$title = $langs -> trans ( " Member " ) . " - " . $langs -> trans ( " Subscriptions " );
$helpurl = " EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros " ;
llxHeader ( " " , $title , $helpurl );
2007-02-03 23:40:04 +01:00
2018-01-10 13:02:05 +01:00
$param = '' ;
if ( ! empty ( $contextpage ) && $contextpage != $_SERVER [ " PHP_SELF " ]) $param .= '&contextpage=' . urlencode ( $contextpage );
if ( $limit > 0 && $limit != $conf -> liste_limit ) $param .= '&limit=' . urlencode ( $limit );
$param .= '&id=' . $rowid ;
if ( $optioncss != '' ) $param .= '&optioncss=' . urlencode ( $optioncss );
// Add $param from extra fields
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
2015-05-14 20:49:22 +02:00
if ( $rowid > 0 )
2010-09-06 20:56:13 +02:00
{
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
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 . '">' ;
2015-05-14 20:49:22 +02:00
2017-05-22 10:58:20 +02:00
dol_fiche_head ( $head , 'subscription' , $langs -> trans ( " Member " ), - 1 , 'user' );
2015-05-14 20:49:22 +02:00
2017-10-03 16:00:52 +02:00
$linkback = '<a href="' . DOL_URL_ROOT . '/adherents/list.php?restore_lastsearch_values=1">' . $langs -> trans ( " BackToList " ) . '</a>' ;
2017-06-07 16:44:04 +02:00
2015-10-16 16:14:33 +02:00
dol_banner_tab ( $object , 'rowid' , $linkback );
2017-06-07 16:44:04 +02:00
2015-10-16 16:14:33 +02:00
print '<div class="fichecenter">' ;
2015-10-16 20:16:28 +02:00
print '<div class="fichehalfleft">' ;
2017-06-07 16:44:04 +02:00
2015-10-16 16:14:33 +02:00
print '<div class="underbanner clearboth"></div>' ;
print '<table class="border" width="100%">' ;
2011-06-16 23:15:45 +02:00
2015-10-16 20:16:28 +02:00
// Login
if ( empty ( $conf -> global -> ADHERENT_LOGIN_NOT_REQUIRED ))
{
2016-07-27 07:24:36 +02:00
print '<tr><td class="titlefield">' . $langs -> trans ( " Login " ) . ' / ' . $langs -> trans ( " Id " ) . '</td><td class="valeur">' . $object -> login . ' </td></tr>' ;
2015-10-16 20:16:28 +02:00
}
2011-03-06 14:55:47 +01:00
2015-10-16 20:16:28 +02:00
// Type
2016-07-27 07:24:36 +02:00
print '<tr><td class="titlefield">' . $langs -> trans ( " Type " ) . '</td><td class="valeur">' . $adht -> getNomUrl ( 1 ) . " </td></tr> \n " ;
2015-10-16 16:14:33 +02:00
2015-10-16 20:16:28 +02:00
// Morphy
print '<tr><td>' . $langs -> trans ( " Nature " ) . '</td><td class="valeur" >' . $object -> getmorphylib () . '</td>' ;
print '</tr>' ;
2011-03-06 14:55:47 +01:00
2015-10-16 20:16:28 +02:00
// Company
print '<tr><td>' . $langs -> trans ( " Company " ) . '</td><td class="valeur">' . $object -> societe . '</td></tr>' ;
2011-03-06 14:55:47 +01:00
2015-10-16 20:16:28 +02:00
// Civility
print '<tr><td>' . $langs -> trans ( " UserTitle " ) . '</td><td class="valeur">' . $object -> getCivilityLabel () . ' </td>' ;
print '</tr>' ;
// Password
if ( empty ( $conf -> global -> ADHERENT_LOGIN_NOT_REQUIRED ))
{
print '<tr><td>' . $langs -> trans ( " Password " ) . '</td><td>' . preg_replace ( '/./i' , '*' , $object -> pass );
if (( ! empty ( $object -> pass ) || ! empty ( $object -> pass_crypted )) && empty ( $object -> user_id ))
{
$langs -> load ( " errors " );
$htmltext = $langs -> trans ( " WarningPasswordSetWithNoAccount " );
print ' ' . $form -> textwithpicto ( '' , $htmltext , 1 , 'warning' );
}
print '</td></tr>' ;
}
2011-03-06 14:55:47 +01:00
2015-10-16 20:16:28 +02:00
print '</table>' ;
2017-06-07 16:44:04 +02:00
2015-10-16 20:16:28 +02:00
print '</div>' ;
print '<div class="fichehalfright"><div class="ficheaddleft">' ;
2017-06-07 16:44:04 +02:00
2015-10-16 20:16:28 +02:00
print '<div class="underbanner clearboth"></div>' ;
print '<table class="border tableforfield" width="100%">' ;
2017-06-07 16:44:04 +02:00
2015-10-16 20:16:28 +02:00
// Birthday
2016-07-27 07:24:36 +02:00
print '<tr><td class="titlefield">' . $langs -> trans ( " Birthday " ) . '</td><td class="valeur">' . dol_print_date ( $object -> birth , 'day' ) . '</td></tr>' ;
2007-02-03 23:40:04 +01:00
2015-10-16 20:16:28 +02:00
// Public
print '<tr><td>' . $langs -> trans ( " Public " ) . '</td><td class="valeur">' . yn ( $object -> public ) . '</td></tr>' ;
2013-07-10 17:29:54 +02:00
2015-10-16 20:16:28 +02:00
// Categories
if ( ! empty ( $conf -> categorie -> enabled ) && ! empty ( $user -> rights -> categorie -> lire ))
{
print '<tr><td>' . $langs -> trans ( " Categories " ) . '</td>' ;
print '<td colspan="2">' ;
print $form -> showCategories ( $object -> id , 'member' , 1 );
print '</td></tr>' ;
}
2017-06-07 16:44:04 +02:00
// Other attributes
$cols = 2 ;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php' ;
2015-10-16 20:16:28 +02:00
2016-06-26 12:07:24 +02:00
// Date end subscription
print '<tr><td>' . $langs -> trans ( " SubscriptionEndDate " ) . '</td><td class="valeur">' ;
if ( $object -> datefin )
{
print dol_print_date ( $object -> datefin , 'day' );
if ( $object -> hasDelay ()) {
print " " . img_warning ( $langs -> trans ( " Late " ));
}
}
else
{
2016-09-24 06:48:40 +02:00
if ( ! $adht -> subscription )
2016-06-26 12:07:24 +02:00
{
print $langs -> trans ( " SubscriptionNotRecorded " );
if ( $object -> statut > 0 ) print " " . img_warning ( $langs -> trans ( " Late " )); // Affiche picto retard uniquement si non brouillon et non resilie
}
else
{
print $langs -> trans ( " SubscriptionNotReceived " );
if ( $object -> statut > 0 ) print " " . img_warning ( $langs -> trans ( " Late " )); // Affiche picto retard uniquement si non brouillon et non resilie
}
}
print '</td></tr>' ;
2017-06-07 16:44:04 +02:00
2015-10-16 20:16:28 +02:00
// Third party Dolibarr
if ( ! empty ( $conf -> societe -> enabled ))
{
print '<tr><td>' ;
print '<table class="nobordernopadding" width="100%"><tr><td>' ;
print $langs -> trans ( " LinkedToDolibarrThirdParty " );
print '</td>' ;
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>' ;
print '</tr></table>' ;
print '</td><td colspan="2" class="valeur">' ;
if ( $action == 'editthirdparty' )
{
$htmlname = 'socid' ;
print '<form method="POST" action="' . $_SERVER [ 'PHP_SELF' ] . '" name="form' . $htmlname . '">' ;
print '<input type="hidden" name="rowid" value="' . $object -> id . '">' ;
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>' ;
print $form -> select_company ( $object -> fk_soc , 'socid' , '' , 1 );
print '</td>' ;
print '<td align="left"><input type="submit" class="button" value="' . $langs -> trans ( " Modify " ) . '"></td>' ;
print '</tr></table></form>' ;
}
else
{
if ( $object -> fk_soc )
{
$company = new Societe ( $db );
$result = $company -> fetch ( $object -> fk_soc );
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>' ;
if ( $action != 'editlogin' && $user -> rights -> adherent -> creer )
{
print '<td align="right">' ;
if ( $user -> rights -> user -> user -> creer )
{
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=editlogin&rowid=' . $object -> id . '">' . img_edit ( $langs -> trans ( 'SetLinkToUser' ), 1 ) . '</a>' ;
}
print '</td>' ;
}
print '</tr></table>' ;
print '</td><td colspan="2" class="valeur">' ;
if ( $action == 'editlogin' )
{
$form -> form_users ( $_SERVER [ 'PHP_SELF' ] . '?rowid=' . $object -> id , $object -> user_id , 'userid' , '' );
}
else
{
if ( $object -> user_id )
{
$form -> form_users ( $_SERVER [ 'PHP_SELF' ] . '?rowid=' . $object -> id , $object -> user_id , 'none' );
}
else print $langs -> trans ( " NoDolibarrAccess " );
}
print '</td></tr>' ;
2007-02-03 23:40:04 +01:00
2010-09-06 20:56:13 +02:00
print " </table> \n " ;
2007-02-03 23:40:04 +01:00
2015-10-16 20:16:28 +02:00
print " </div></div></div> \n " ;
print '<div style="clear:both"></div>' ;
2017-06-07 16:44:04 +02:00
2010-09-06 20:56:13 +02:00
dol_fiche_end ();
2007-02-03 23:40:04 +01:00
2015-05-14 20:49:22 +02:00
print '</form>' ;
2007-09-05 09:43:43 +02:00
2010-09-06 20:56:13 +02:00
/*
2018-01-10 13:02:05 +01:00
* Action buttons
2010-09-06 20:56:13 +02:00
*/
2007-02-03 23:40:04 +01:00
2016-09-26 01:15:17 +02:00
// Button to create a new subscription if member no draft neither resiliated
2010-09-06 20:56:13 +02:00
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-07 02:38:03 +02:00
print '</div>' ;
2010-09-09 01:50:52 +02:00
}
2010-08-29 17:25:39 +02:00
}
2007-02-03 23:40:04 +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, " ;
2016-09-24 06:48:40 +02:00
$sql .= " c.rowid as crowid, c.subscription, " ;
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, " ;
2017-07-17 05:58:27 +02:00
$sql .= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number " ;
2016-09-24 06:48:40 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " adherent as d, " . MAIN_DB_PREFIX . " subscription as c " ;
2010-09-06 20:56:13 +02:00
$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 ;
2018-01-10 13:02:05 +01:00
$sql .= $db -> order ( $sortfield , $sortorder );
2010-09-06 20:56:13 +02:00
$result = $db -> query ( $sql );
if ( $result )
{
2016-09-24 06:48:40 +02:00
$subscriptionstatic = new Subscription ( $db );
2010-09-09 01:50:52 +02:00
$num = $db -> num_rows ( $result );
$i = 0 ;
2016-12-17 19:21:48 +01:00
print '<table class="noborder" width="100%">' . " \n " ;
2010-09-09 01:50:52 +02:00
print '<tr class="liste_titre">' ;
2018-01-10 13:02:05 +01:00
print_liste_field_titre ( 'Ref' , $_SERVER [ " PHP_SELF " ], 'c.rowid' , '' , $param , '' , $sortfield , $sortorder );
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 " ;
2017-10-11 11:42:39 +02:00
$accountstatic = new Account ( $db );
2017-11-15 11:39:11 +01:00
2010-09-09 01:50:52 +02:00
while ( $i < $num )
{
$objp = $db -> fetch_object ( $result );
2017-11-15 11:39:11 +01:00
2016-09-24 06:48:40 +02:00
$subscriptionstatic -> ref = $objp -> crowid ;
$subscriptionstatic -> id = $objp -> crowid ;
2017-11-15 11:39:11 +01:00
print '<tr class="oddeven">' ;
2016-09-24 06:48:40 +02:00
print '<td>' . $subscriptionstatic -> 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 " ;
2016-09-24 06:48:40 +02:00
print '<td align="right">' . price ( $objp -> subscription ) . '</td>' ;
2017-10-10 07:56:10 +02:00
if ( ! empty ( $conf -> banque -> enabled ))
{
print '<td align="right">' ;
if ( $objp -> bid )
{
$accountstatic -> label = $objp -> label ;
$accountstatic -> id = $objp -> baid ;
$accountstatic -> number = $objp -> number ;
$accountstatic -> account_number = $objp -> account_number ;
2017-07-17 05:58:27 +02:00
2017-10-10 07:37:39 +02:00
if ( ! empty ( $conf -> accounting -> enabled ))
{
$accountingjournal = new AccountingJournal ( $db );
$accountingjournal -> fetch ( $objp -> fk_accountancy_journal );
2017-07-17 05:58:27 +02:00
2017-10-10 07:37:39 +02:00
$accountstatic -> accountancy_journal = $accountingjournal -> getNomUrl ( 0 , 1 , 1 , '' , 1 );
}
2017-07-17 05:58:27 +02:00
2016-12-17 19:21:48 +01:00
$accountstatic -> ref = $objp -> ref ;
2010-09-09 01:50:52 +02:00
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
}
2017-09-12 12:18:26 +02:00
}
2010-09-06 20:56:13 +02:00
2010-08-29 17:25:39 +02:00
2017-11-15 11:39:11 +01:00
if (( $action != 'addsubscription' && $action != 'create_thirdparty' ))
2017-09-12 12:18:26 +02:00
{
2017-11-15 11:39:11 +01:00
// Shon online payment link
$useonlinepayment = ( ! empty ( $conf -> paypal -> enabled ) || ! empty ( $conf -> stripe -> enabled ) || ! empty ( $conf -> paybox -> enabled ));
2017-02-22 06:33:52 +01:00
2017-11-15 11:39:11 +01:00
if ( $useonlinepayment )
{
print '<br>' ;
2010-08-29 17:25:39 +02:00
2017-11-15 11:39:11 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php' ;
print showOnlinePaymentUrl ( 'membersubscription' , $object -> ref );
print '<br>' ;
}
}
2017-09-12 12:18:26 +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
2015-09-24 18:33:48 +02:00
print load_fiche_titre ( $langs -> trans ( " NewCotisation " ));
2010-08-29 17:25:39 +02:00
2018-03-05 21:46:24 +01:00
// Define default choice for complementary actions
2012-12-09 20:54:45 +01:00
$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
2018-03-05 21:46:24 +01:00
{
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 ;
2018-03-05 21:46:24 +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 ;
2018-03-05 21:46:24 +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
' ;
2015-05-12 14:22:00 +02:00
if ( GETPOST ( 'paymentsave' )) print '$("#' . GETPOST ( 'paymentsave' ) . '").prop("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
{
2017-10-09 12:38:44 +02:00
$companyalias = '' ;
$fullname = $object -> getFullName ( $langs );
if ( $object -> morphy == 'mor' )
2011-02-26 10:51:53 +01:00
{
2017-10-09 12:38:44 +02:00
$companyname = $object -> societe ;
if ( ! empty ( $fullname )) $companyalias = $fullname ;
2011-02-26 10:51:53 +01:00
}
else
{
2017-10-09 12:38:44 +02:00
$companyname = $fullname ;
if ( ! empty ( $object -> societe )) $companyalias = $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
2017-10-09 12:38:44 +02:00
$formquestion = array (
2017-10-09 15:49:10 +02:00
array ( 'label' => $langs -> trans ( " NameToCreate " ), 'type' => 'text' , 'name' => 'companyname' , 'value' => $companyname , 'morecss' => 'minwidth300' , 'moreattr' => 'maxlength="128"' ),
array ( 'label' => $langs -> trans ( " AliasNames " ), 'type' => 'text' , 'name' => 'companyalias' , 'value' => $companyalias , 'morecss' => 'minwidth300' , 'moreattr' => 'maxlength="128"' )
2017-10-09 12:38:44 +02:00
);
2018-12-18 21:00:06 +01:00
// If customer code was forced to "required", we ask it at creation to avoid error later
if ( ! empty ( $conf -> global -> MAIN_COMPANY_CODE_ALWAYS_REQUIRED ))
{
$tmpcompany = new Societe ( $db );
$tmpcompany -> name = $companyname ;
$customercode = $tmpcompany -> get_codeclient ( $tmpcompany , 0 );
$formquestion [] = array ( 'label' => $langs -> trans ( " CustomerCode " ), 'type' => 'text' , 'name' => 'customercode' , 'value' => $customercode , 'morecss' => 'minwidth300' , 'moreattr' => 'maxlength="128"' );
}
2018-12-18 21:27:16 +01:00
// @TODO Add other extrafields mandatory for thirdparty creation
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
2016-09-24 06:48:40 +02:00
print '<form name="subscription" method="POST" action="' . $_SERVER [ " PHP_SELF " ] . '">' ;
2010-09-09 01:50:52 +02:00
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
2016-09-24 06:48:40 +02:00
print '<input type="hidden" name="action" value="subscription">' ;
2010-09-09 01:50:52 +02:00
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
2015-05-20 06:25:43 +02:00
dol_fiche_head ( '' );
print " <table class= \" border \" width= \" 100% \" > \n " ;
print '<tbody>' ;
$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
2018-01-10 13:02:05 +01:00
print '<tr>' ;
2010-09-09 01:50:52 +02:00
// Date start subscription
2018-01-10 13:02:05 +01:00
print '<td 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 )
{
2018-03-05 21:46:24 +01:00
$datefrom = $object -> datevalid ;
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
}
}
2016-09-24 06:48:40 +02:00
print $form -> select_date ( $datefrom , '' , '' , '' , '' , " subscription " , 1 , 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>' ;
2016-09-24 06:48:40 +02:00
print $form -> select_date ( $dateto , 'end' , '' , '' , '' , " subscription " , 1 , 0 , 1 );
2010-09-09 01:50:52 +02:00
print " </td></tr> " ;
2016-09-24 06:48:40 +02:00
if ( $adht -> subscription )
2010-09-09 01:50:52 +02:00
{
// Amount
2016-09-24 06:48:40 +02:00
print '<tr><td class="fieldrequired">' . $langs -> trans ( " Amount " ) . '</td><td><input type="text" name="subscription" size="6" value="' . GETPOST ( 'subscription' ) . '"> ' . $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
2017-01-22 12:13:32 +01:00
print '<tr><td class="tdtop fieldrequired">' . $langs -> trans ( 'MoreActions' );
2010-09-06 20:56:13 +02:00
print '</td>' ;
print '<td>' ;
2015-05-07 11:39:26 +02:00
print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"' . ( empty ( $bankdirect ) && empty ( $invoiceonly ) && empty ( $bankviainvoice ) ? ' 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
{
2015-05-07 11:39:26 +02:00
print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"' . ( ! empty ( $bankdirect ) ? ' 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
{
2015-05-07 11:39:26 +02:00
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"' . ( ! empty ( $invoiceonly ) ? ' checked' : '' );
2015-05-07 11:57:23 +02:00
//if (empty($object->fk_soc)) print ' 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 );
2017-10-10 07:37:39 +02:00
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 -> transnoentitiesnoconv ( " ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS " , $prodtmp -> getNomUrl ( 1 )); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
}
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
{
2015-05-07 11:39:26 +02:00
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"' . ( ! empty ( $bankviainvoice ) ? ' checked' : '' );
2015-05-07 11:57:23 +02:00
//if (empty($object->fk_soc)) print ' 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 );
2017-10-10 07:37:39 +02:00
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 -> transnoentitiesnoconv ( " ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS " , $prodtmp -> getNomUrl ( 1 )); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
}
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>' ;
2016-09-24 06:48:40 +02:00
print $form -> select_date ( isset ( $paymentdate ) ? $paymentdate :- 1 , 'payment' , 0 , 0 , 1 , 'subscription' , 1 , 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
2018-03-23 19:35:25 +01:00
// Send subscription email
$subject = '' ;
$msg = '' ;
// Send subscription email
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php' ;
$formmail = new FormMail ( $db );
// Set output language
$outputlangs = new Translate ( '' , $conf );
$outputlangs -> setDefaultLang ( empty ( $object -> thirdparty -> default_lang ) ? $mysoc -> default_lang : $object -> thirdparty -> default_lang );
$outputlangs -> loadLangs ( array ( " main " , " members " ));
// Get email content fro mtemplae
$arraydefaultmessage = null ;
$labeltouse = $conf -> global -> ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION ;
if ( ! empty ( $labeltouse )) $arraydefaultmessage = $formmail -> getEMailTemplate ( $db , 'member' , $user , $outputlangs , 0 , 1 , $labeltouse );
if ( ! empty ( $labeltouse ) && is_object ( $arraydefaultmessage ) && $arraydefaultmessage -> id > 0 )
{
$subject = $arraydefaultmessage -> topic ;
$msg = $arraydefaultmessage -> content ;
}
$substitutionarray = getCommonSubstitutionArray ( $outputlangs , 0 , null , $object );
complete_substitutions_array ( $substitutionarray , $outputlangs , $object );
$subjecttosend = make_substitutions ( $subject , $substitutionarray , $outputlangs );
$texttosend = make_substitutions ( dol_concatdesc ( $msg , $adht -> getMailOnSubscription ()), $substitutionarray , $outputlangs );
2010-09-06 20:56:13 +02:00
2018-03-05 21:46:24 +01:00
$tmp = '<input name="sendmail" type="checkbox"' . ( GETPOST ( 'sendmail' , 'alpha' ) ? ' checked' : ( ! empty ( $conf -> global -> ADHERENT_DEFAULT_SENDINFOBYMAIL ) ? ' 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 " ;
2018-03-08 15:01:34 +01:00
print $form -> textwithpicto ( $tmp , $helpcontent , 1 , 'help' , '' , 0 , 2 , 'helpemailtosend' );
2010-09-09 01:50:52 +02:00
}
print '</td></tr>' ;
2015-05-20 06:25:43 +02:00
print '</tbody>' ;
2010-09-06 20:56:13 +02:00
print '</table>' ;
2015-05-20 06:25:43 +02:00
dol_fiche_end ();
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 ();