33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
53$langs->loadLangs(array(
"companies",
"bills",
"members",
"users",
"mails",
'other'));
55$action =
GETPOST(
'action',
'aZ09');
56$confirm =
GETPOST(
'confirm',
'alpha');
57$contextpage =
GETPOST(
'contextpage',
'aZ09');
58$optioncss =
GETPOST(
'optioncss',
'aZ');
62$ref =
GETPOST(
'ref',
'alphanohtml');
68$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
69$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
71if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
75$offset = $limit * $page;
81 $sortfield =
"c.rowid";
92$extrafields->fetch_name_optionals_label(
$object->table_element);
97$hookmanager->initHooks(array(
'subscription'));
109if ($id > 0 || !empty($ref)) {
111 $result =
$object->fetch($id, $ref);
114 $canadduser = ($user->admin || $user->hasRight(
"user",
"user",
"creer"));
118 $caneditfielduser = ((($user->id ==
$object->user_id) && $user->hasRight(
"user",
"self",
"creer"))
119 || (($user->id !=
$object->user_id) && $user->hasRight(
"user",
"user",
"creer")));
120 $caneditpassworduser = ((($user->id ==
$object->user_id) && $user->hasRight(
"user",
"self",
"password"))
121 || (($user->id !=
$object->user_id) && $user->hasRight(
"user",
"user",
"password")));
126$permissiontoaddmember = $user->hasRight(
'adherent',
'creer');
136$parameters = array();
137$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
143if (empty($reshook) && $action ==
'confirm_create_thirdparty' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
147 $result = $company->create_from_member($object,
GETPOST(
'companyname',
'alpha'),
GETPOST(
'companyalias',
'alpha'),
GETPOST(
'customercode',
'alpha'));
150 $langs->load(
"errors");
153 $action =
'addsubscription';
160if (empty($reshook) && $action ==
'setuserid' && ($user->hasRight(
'user',
'self',
'creer') || $user->hasRight(
'user',
'user',
'creer'))) {
162 if (!$user->hasRight(
'user',
'user',
'creer')) {
165 setEventMessages($langs->trans(
"ErrorUserPermissionAllowsToLinksToItselfOnly"),
null,
'errors');
180if (empty($reshook) && $action ==
'setsocid' && $permissiontoaddmember) {
183 $sql =
"SELECT rowid FROM " . MAIN_DB_PREFIX .
"adherent";
184 $sql .=
" WHERE fk_soc = " . ((int)
GETPOSTINT(
'socid'));
185 $resql = $db->query($sql);
187 $obj = $db->fetch_object($resql);
188 if ($obj && $obj->rowid > 0) {
190 $othermember->fetch($obj->rowid);
191 $thirdparty =
new Societe($db);
194 setEventMessages($langs->trans(
"ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name),
null,
'errors');
208if (empty($reshook) && $user->hasRight(
'adherent',
'cotisation',
'creer') && $action ==
'subscription' && !$cancel) {
211 $langs->load(
"banks");
213 $result =
$object->fetch($rowid);
214 $result = $adht->fetch(
$object->typeid);
217 $datesubscription = 0;
219 $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
220 $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
236 $operation =
GETPOST(
"operation",
"alphanohtml");
237 $num_chq =
GETPOST(
"num_chq",
"alphanohtml");
238 $emetteur_nom =
GETPOST(
"chqemetteur");
239 $emetteur_banque =
GETPOST(
"chqbank");
240 $option =
GETPOST(
"paymentsave");
241 if (empty($option)) {
244 $sendalsoemail =
GETPOST(
"sendmail",
'alpha');
247 if (!$datesubscription) {
249 $langs->load(
"errors");
250 $errmsg = $langs->trans(
"ErrorBadDateFormat", $langs->transnoentitiesnoconv(
"DateSubscription"));
252 $action =
'addsubscription';
254 if (
GETPOST(
'end') && !$datesubend) {
256 $langs->load(
"errors");
257 $errmsg = $langs->trans(
"ErrorBadDateFormat", $langs->transnoentitiesnoconv(
"DateEndSubscription"));
259 $action =
'addsubscription';
264 if (($option ==
'bankviainvoice' || $option ==
'bankdirect') && !$paymentdate) {
266 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DatePayment"));
268 $action =
'addsubscription';
272 if ($adht->subscription) {
273 if (!is_numeric($amount)) {
275 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount"));
278 $action =
'addsubscription';
281 if (isModEnabled(
'bank') &&
GETPOST(
"paymentsave") !=
'none') {
284 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label"));
287 $action =
'addsubscription';
289 if (
GETPOST(
"paymentsave") !=
'invoiceonly' && !
GETPOST(
"operation")) {
290 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"PaymentMode"));
293 $action =
'addsubscription';
296 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"FinancialAccount"));
299 $action =
'addsubscription';
303 $errmsg = $langs->trans(
"ErrorDoNotProvideAccountsIfNullAmount");
306 $action =
'addsubscription';
314 if (!$error && $action ==
'subscription') {
318 $crowid =
$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
326 $result =
$object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque);
339 $action =
'addsubscription';
349 if (
$object->email && $sendalsoemail) {
351 'datesubscription' => $datesubscription,
353 'ccountid' => $accountid,
354 'operation' => $operation,
356 'num_chq' => $num_chq,
357 'emetteur_nom' => $emetteur_nom,
358 'emetteur_banque' => $emetteur_banque,
359 'datesubend' => $datesubend
361 $reshook = $hookmanager->executeHooks(
'sendMail', $parameters, $object, $action);
366 if (empty($reshook)) {
371 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
375 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang);
377 $outputlangs->loadLangs(array(
"main",
"members"));
380 $arraydefaultmessage =
null;
383 if (!empty($labeltouse)) {
384 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
387 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
388 $subject = $arraydefaultmessage->topic;
389 $msg = $arraydefaultmessage->content;
399 $listofpaths = array();
400 $listofnames = array();
401 $listofmimes = array();
402 if (is_object(
$object->invoice) && (!is_object($arraydefaultmessage) || intval($arraydefaultmessage->joinfiles))) {
403 $invoicediroutput =
$conf->facture->dir_output;
405 $file = $fileparams[
'fullname'];
407 $listofpaths = array($file);
408 $listofnames = array(basename($file));
412 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/subscription.php'.
"\r\n";
414 $result =
$object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames,
"",
"", 0, -1,
'', $moreinheader);
444$form =
new Form($db);
448$title = $langs->trans(
"Member").
" - ".$langs->trans(
"Subscriptions");
449$help_url =
"EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder";
451llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-member page-card_subscription');
455if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
456 $param .=
'&contextpage='.urlencode($contextpage);
458if ($limit > 0 && $limit !=
$conf->liste_limit) {
459 $param .=
'&limit='.((int) $limit);
461$param .=
'&id='.$rowid;
462if ($optioncss !=
'') {
463 $param .=
'&optioncss='.urlencode($optioncss);
470 $langs->load(
"errors");
471 print $langs->trans(
"ErrorRecordNotFound");
477$defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
478$defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
486if (isModEnabled(
'societe')) {
490print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
491print
'<input type="hidden" name="token" value="'.newToken().
'">';
492print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
496$linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
498$morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/adherents/vcard.php?id='.
$object->id.
'" class="refid">';
499$morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
500$morehtmlref .=
'</a>';
502dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
504print
'<div class="fichecenter">';
505print
'<div class="fichehalfleft">';
507print
'<div class="underbanner clearboth"></div>';
508print
'<table class="border centpercent tableforfield">';
512 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag(
$object->login).
'</td></tr>';
516print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td>';
517print
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
520print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
521print
'<td class="valeur" >'.$object->getmorphylib(
'', 1).
'</td>';
528print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.
$object->getCivilityLabel().
'</td>';
533 print
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
535 print preg_replace(
'/./i',
'*',
$object->pass);
538 print
'<!-- '.$langs->trans(
"Crypted").
': '.
$object->pass_indatabase_crypted.
' -->';
540 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
542 if (!empty(
$object->pass_indatabase) && empty(
$object->user_id)) {
543 $langs->load(
"errors");
544 $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
545 print
' '.$form->textwithpicto(
'', $htmltext, 1,
'warning');
551print
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
555 print
" ".img_warning($langs->trans(
"Late"));
558 if (
$object->need_subscription == 0) {
559 print $langs->trans(
"SubscriptionNotNeeded");
560 } elseif (!$adht->subscription) {
561 print $langs->trans(
"SubscriptionNotRecorded");
563 print
" ".img_warning($langs->trans(
"Late"));
566 print $langs->trans(
"SubscriptionNotReceived");
568 print
" ".img_warning($langs->trans(
"Late"));
578print
'<div class="fichehalfright">';
579print
'<div class="underbanner clearboth"></div>';
581print
'<table class="border tableforfield centpercent">';
584if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
585 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
586 print
'<td colspan="2">';
587 print $form->showCategories(
$object->id, Categorie::TYPE_MEMBER, 1);
592print
'<tr><td class="titlefield">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date(
$object->birth,
'day').
'</td></tr>';
596 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
597 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
600 $langs->load(
"languages");
601 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
608$linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((isModEnabled(
'multicompany')) ?
'?entity='.
$conf->entity :
'');
609print
'<tr><td>'.$form->textwithpicto($langs->trans(
"MembershipPublic"), $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist), 1,
'help',
'', 0, 3,
'publicfile').
'</td><td class="valeur">'.
yn(
$object->public).
'</td></tr>';
613include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
616if (isModEnabled(
'societe')) {
618 print
'<table class="nobordernopadding centpercent"><tr><td>';
619 print $langs->trans(
"LinkedToDolibarrThirdParty");
621 if ($action !=
'editthirdparty' && $user->hasRight(
'adherent',
'creer')) {
622 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editthirdparty&token='.
newToken().
'&rowid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetLinkToThirdParty'), 1).
'</a></td>';
624 print
'</tr></table>';
625 print
'</td><td colspan="2" class="valeur">';
626 if ($action ==
'editthirdparty') {
628 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
629 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
630 print
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
631 print
'<input type="hidden" name="token" value="'.newToken().
'">';
632 print
'<table class="nobordernopadding">';
634 print $form->select_company(
$object->fk_soc,
'socid',
'', 1);
636 print
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
637 print
'</tr></table></form>';
641 $result = $company->fetch(
$object->socid);
642 print $company->getNomUrl(1);
645 $tmparray = $company->getOutstandingBills(
'customer');
646 if (!empty($tmparray[
'refs'])) {
647 print
' - '.img_picto($langs->trans(
"Invoices"),
'bill',
'class="paddingright"').
'<a href="'.DOL_URL_ROOT.
'/compta/facture/list.php?socid='.
$object->socid.
'">'.$langs->trans(
"Invoices").
' ('.count($tmparray[
'refs']).
')';
652 print
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
660print
'<table class="nobordernopadding centpercent"><tr><td>';
661print $langs->trans(
"LinkedToDolibarrUser");
663if ($action !=
'editlogin' && $user->hasRight(
'adherent',
'creer')) {
664 print
'<td class="right">';
665 if ($user->hasRight(
"user",
"user",
"creer")) {
666 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editlogin&token='.
newToken().
'&rowid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetLinkToUser'), 1).
'</a>';
670print
'</tr></table>';
671print
'</td><td colspan="2" class="valeur">';
672if ($action ==
'editlogin') {
673 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.
$object->id,
$object->user_id,
'userid', array());
676 $linkeduser =
new User($db);
677 $linkeduser->fetch(
$object->user_id);
678 print $linkeduser->getNomUrl(-1);
680 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
687print
"</div></div>\n";
688print
'<div class="clearboth"></div>';
698if ($user->hasRight(
'adherent',
'cotisation',
'creer')) {
699 if ($action !=
'addsubscription' && $action !=
'create_thirdparty') {
700 print
'<div class="tabsAction">';
703 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$rowid.
'&action=addsubscription&token='.
newToken().
'">'.$langs->trans(
"AddSubscription").
"</a></div>";
705 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"AddSubscription").
'</a></div>';
715if ($action !=
'addsubscription' && $action !=
'create_thirdparty') {
716 $sql =
"SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,";
717 $sql .=
" c.rowid as crowid, c.subscription,";
718 $sql .=
" c.datec, c.fk_type as cfk_type,";
719 $sql .=
" c.dateadh as dateh,";
721 $sql .=
" c.fk_bank,";
722 $sql .=
" b.rowid as bid,";
723 $sql .=
" ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code";
724 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"subscription as c";
725 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON c.fk_bank = b.rowid";
726 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON b.fk_account = ba.rowid";
727 $sql .=
" WHERE d.rowid = c.fk_adherent AND d.rowid=".((int) $rowid);
728 $sql .= $db->order($sortfield, $sortorder);
730 $result = $db->query($sql);
734 $num = $db->num_rows($result);
736 print
'<table class="noborder centpercent">'.
"\n";
738 print
'<tr class="liste_titre">';
740 print_liste_field_titre(
'DateCreation', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
742 print_liste_field_titre(
'DateStart', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
743 print_liste_field_titre(
'DateEnd', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
745 if (isModEnabled(
'bank')) {
746 print_liste_field_titre(
'Account', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
750 $accountstatic =
new Account($db);
756 $objp = $db->fetch_object($result);
758 $adh->id = $objp->rowid;
759 $adh->typeid = $objp->type;
761 $subscriptionstatic->ref = $objp->crowid;
762 $subscriptionstatic->id = $objp->crowid;
764 $typeid = $objp->cfk_type;
766 $adht->fetch($typeid);
769 print
'<tr class="oddeven">';
770 print
'<td>'.$subscriptionstatic->getNomUrl(1).
'</td>';
771 print
'<td class="center">'.dol_print_date($db->jdate($objp->datec),
'dayhour').
"</td>\n";
772 print
'<td class="center">';
774 print $adht->getNomUrl(1);
777 print
'<td class="center">'.dol_print_date($db->jdate($objp->dateh),
'day').
"</td>\n";
778 print
'<td class="center">'.dol_print_date($db->jdate($objp->datef),
'day').
"</td>\n";
779 print
'<td class="right amount">'.price($objp->subscription).
'</td>';
780 if (isModEnabled(
'bank')) {
781 print
'<td class="right">';
783 $accountstatic->label = $objp->label;
784 $accountstatic->id = $objp->baid;
785 $accountstatic->number = $objp->number;
786 $accountstatic->account_number = $objp->account_number;
787 $accountstatic->currency_code = $objp->currency_code;
789 if (isModEnabled(
'accounting') && $objp->fk_accountancy_journal > 0) {
791 $accountingjournal->fetch($objp->fk_accountancy_journal);
793 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
796 $accountstatic->ref = $objp->ref;
797 print $accountstatic->getNomUrl(1);
809 if (isModEnabled(
'bank')) {
812 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
822if (($action !=
'addsubscription' && $action !=
'create_thirdparty')) {
825 include_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
826 $validpaymentmethod = getValidOnlinePaymentMethods(
'');
827 $useonlinepayment = count($validpaymentmethod);
829 if ($useonlinepayment) {
832 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
833 print showOnlinePaymentUrl(
'membersubscription',
$object->ref);
841if (($action ==
'addsubscription' || $action ==
'create_thirdparty') && $user->hasRight(
'adherent',
'cotisation',
'creer')) {
851 if (
GETPOST(
'paymentsave') ==
'bankdirect') {
854 if (
GETPOST(
'paymentsave') ==
'invoiceonly') {
857 if (
GETPOST(
'paymentsave') ==
'bankviainvoice') {
861 if (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'bankviainvoice' && isModEnabled(
'bank') && isModEnabled(
'societe') && isModEnabled(
'invoice')) {
863 } elseif (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'bankdirect' && isModEnabled(
'bank')) {
865 } elseif (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'invoiceonly' && isModEnabled(
'bank') && isModEnabled(
'societe') && isModEnabled(
'invoice')) {
870 print
"\n\n<!-- Form add subscription -->\n";
872 if (
$conf->use_javascript_ajax) {
874 print
"\n".
'<script type="text/javascript">';
875 print
'$(document).ready(function () {
876 $(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ?
'show()' :
'hide()').
';
877 $("#none, #invoiceonly").click(function() {
878 $(".bankswitchclass").hide();
879 $(".bankswitchclass2").hide();
881 $("#bankdirect, #bankviainvoice").click(function() {
882 $(".bankswitchclass").show();
883 $(".bankswitchclass2").show();
885 $("#selectoperation").change(function() {
886 var code = $(this).val();
889 $(".fieldrequireddyn").addClass("fieldrequired");
890 if ($("#fieldchqemetteur").val() == "")
892 $("#fieldchqemetteur").val($("#memberlabel").val());
897 $(".fieldrequireddyn").removeClass("fieldrequired");
902 print
'$("#'.GETPOST(
'paymentsave',
'aZ09').
'").prop("checked", true);';
905 print
'</script>'.
"\n";
910 if ($action ==
'create_thirdparty') {
912 $fullname =
$object->getFullName($langs);
914 if (
$object->morphy ==
'mor') {
915 $companyname =
$object->company;
916 if (!empty($fullname)) {
917 $companyalias = $fullname;
920 $companyname = $fullname;
921 if (!empty(
$object->company)) {
922 $companyalias =
$object->company;
927 $formquestion = array(
928 array(
'label' => $langs->trans(
"NameToCreate"),
'type' =>
'text',
'name' =>
'companyname',
'value' => $companyname,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"'),
929 array(
'label' => $langs->trans(
"AliasNames"),
'type' =>
'text',
'name' =>
'companyalias',
'value' => $companyalias,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"')
933 $tmpcompany =
new Societe($db);
934 $tmpcompany->name = $companyname;
935 $tmpcompany->get_codeclient($tmpcompany, 0);
936 $customercode = $tmpcompany->code_client;
937 $formquestion[] = array(
938 'label' => $langs->trans(
"CustomerCode"),
940 'name' =>
'customercode',
941 'value' => $customercode,
942 'morecss' =>
'minwidth300',
943 'moreattr' =>
'maxlength="128"',
948 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".
$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"),
"confirm_create_thirdparty", $formquestion, 1);
952 print
'<form name="subscription" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
953 print
'<input type="hidden" name="token" value="'.newToken().
'">';
954 print
'<input type="hidden" name="action" value="subscription">';
955 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
956 print
'<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag(
$object->getFullName($langs)).
'">';
957 print
'<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag(
$object->company).
'">';
961 print
'<div class="div-table-responsive">';
962 print
'<table class="border centpercent">'.
"\n";
974 print
'<td class="fieldrequired">'.$langs->trans(
"DateSubscription").
'</td><td>';
999 print $form->selectDate($datefrom,
'', 0, 0, 0,
"subscription", 1, 1);
1009 } elseif (
getDolGlobalInt(
'MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) {
1015 print
'<tr><td>'.$langs->trans(
"DateEndSubscription").
'</td><td>';
1016 print $form->selectDate($dateto,
'end', 0, 0, 0,
"subscription", 1, 0);
1019 if ($adht->subscription) {
1021 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td>';
1022 print
'<td><input autofocus class="width50" type="text" name="subscription" value="'.(GETPOSTISSET(
'subscription') ?
GETPOST(
'subscription') : (is_null($adht->amount) ?
'' :
price($adht->amount, 0,
'', 0))).
'"> '.$langs->trans(
"Currency".
$conf->currency) .
'</td></tr>';
1025 print
'<tr><td>'.$langs->trans(
"Label").
'</td>';
1026 print
'<td><input name="label" type="text" size="32" value="';
1028 print $langs->trans(
"Subscription").
' '.
dol_print_date(($datefrom ? $datefrom : time()),
"%Y");
1030 print
'"></td></tr>';
1033 if ((isModEnabled(
'bank') || isModEnabled(
'invoice')) && !
getDolGlobalString(
'ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS')) {
1036 $result = $company->fetch(
$object->socid);
1040 print
'<tr><td class="tdtop fieldrequired">'.$langs->trans(
'MoreActions');
1042 print
'<td class="line-height-large">';
1044 print
'<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice) ?
' checked' :
'').
'>';
1045 print
'<label for="none"> '.$langs->trans(
"None").
'</label><br>';
1047 if (isModEnabled(
'bank')) {
1048 print
'<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(!empty($bankdirect) ?
' checked' :
'');
1049 print
'><label for="bankdirect"> '.$langs->trans(
"MoreActionBankDirect").
'</label><br>';
1052 if (isModEnabled(
'societe') && isModEnabled(
'invoice')) {
1053 print
'<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ?
' checked' :
'');
1055 print
'><label for="invoiceonly"> '.$langs->trans(
"MoreActionInvoiceOnly");
1057 print
' ('.$langs->trans(
"ThirdParty").
': '.$company->getNomUrl(1).
')';
1061 print
img_warning($langs->trans(
"NoThirdPartyAssociatedToMember"));
1063 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1064 print
' - <a href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.
$object->id.
'&action=create_thirdparty">';
1065 print $langs->trans(
"CreateDolibarrThirdParty");
1069 print
'. <span class="opacitymedium">'.$langs->trans(
"NoVatOnSubscription", 0).
'</span>';
1071 if (
getDolGlobalString(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled(
'product') || isModEnabled(
'service'))) {
1073 $result = $prodtmp->fetch(
getDolGlobalString(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'));
1077 print
'. '.$langs->transnoentitiesnoconv(
"ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1));
1079 print
'</label><br>';
1082 if (isModEnabled(
'bank') && isModEnabled(
'societe') && isModEnabled(
'invoice')) {
1083 print
'<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(!empty($bankviainvoice) ?
' checked' :
'');
1085 print
'><label for="bankviainvoice"> '.$langs->trans(
"MoreActionBankViaInvoice");
1087 print
' ('.$langs->trans(
"ThirdParty").
': '.$company->getNomUrl(1).
')';
1091 print
img_warning($langs->trans(
"NoThirdPartyAssociatedToMember"));
1093 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1094 print
' - <a href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.
$object->id.
'&action=create_thirdparty">';
1095 print $langs->trans(
"CreateDolibarrThirdParty");
1099 print
'. <span class="opacitymedium">'.$langs->trans(
"NoVatOnSubscription", 0).
'</span>';
1101 if (
getDolGlobalString(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled(
'product') || isModEnabled(
'service'))) {
1103 $result = $prodtmp->fetch(
getDolGlobalString(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'));
1107 print
'. '.$langs->transnoentitiesnoconv(
"ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1));
1109 print
'</label><br>';
1114 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"FinancialAccount").
'</td><td>';
1115 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
1116 $form->select_comptes(
GETPOST(
'accountid'),
'accountid', 0,
'', 2,
'', 0,
'minwidth200');
1117 print
"</td></tr>\n";
1120 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"PaymentMode").
'</td><td>';
1121 print $form->select_types_paiements(
GETPOST(
'operation'),
'operation',
'', 2, 1, 0, 0, 1,
'minwidth200', 1);
1122 print
"</td></tr>\n";
1125 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
1126 print $form->selectDate(isset($paymentdate) ? $paymentdate : -1,
'payment', 0, 0, 1,
'subscription', 1, 1);
1127 print
"</td></tr>\n";
1129 print
'<tr class="bankswitchclass2"><td>'.$langs->trans(
'Numero');
1130 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
1132 print
'<td><input id="fieldnum_chq" name="num_chq" type="text" size="8" value="'.(!
GETPOST(
'num_chq') ?
'' :
GETPOST(
'num_chq')).
'"></td></tr>';
1134 print
'<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans(
'CheckTransmitter');
1135 print
' <em>('.$langs->trans(
"ChequeMaker").
')</em>';
1137 print
'<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="'.(!
GETPOST(
'chqemetteur') ?
'' :
GETPOST(
'chqemetteur')).
'"></td></tr>';
1139 print
'<tr class="bankswitchclass2"><td>'.$langs->trans(
'Bank');
1140 print
' <em>('.$langs->trans(
"ChequeBank").
')</em>';
1142 print
'<td><input id="chqbank" name="chqbank" size="32" type="text" value="'.(!
GETPOST(
'chqbank') ?
'' :
GETPOST(
'chqbank')).
'"></td></tr>';
1146 print
'<tr><td></td><td></td></tr>';
1148 print
'<tr><td>'.$langs->trans(
"SendAcknowledgementByMail").
'</td>';
1151 print $langs->trans(
"NoEMail");
1154 $adht->fetch(
$object->typeid);
1161 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1165 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang);
1167 $outputlangs->loadLangs(array(
"main",
"members"));
1169 $arraydefaultmessage =
null;
1172 if (!empty($labeltouse)) {
1173 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1176 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1177 $subject = $arraydefaultmessage->topic;
1178 $msg = $arraydefaultmessage->content;
1186 $tmp =
'<input name="sendmail" type="checkbox"'.(GETPOST(
'sendmail',
'alpha') ?
' checked' : (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
' checked' :
'')).
'>';
1188 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1189 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.
$object->email.
'<br>'.
"\n";
1190 $helpcontent .=
'<b>'.$langs->trans(
"MailTopic").
'</b>:<br>'.
"\n";
1191 if ($subjecttosend) {
1192 $helpcontent .= $subjecttosend.
"\n";
1194 $langs->load(
"errors");
1195 $helpcontent .=
'<span class="error">'.$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"Module310Name")).
'</span>'.
"\n";
1197 $helpcontent .=
"<br>";
1198 $helpcontent .=
'<b>'.$langs->trans(
"MailText").
'</b>:<br>';
1202 $langs->load(
"errors");
1203 $helpcontent .=
'<span class="error">'.$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"Module310Name")).
'</span>'.
"\n";
1206 print $form->textwithpicto($tmp, $helpcontent, 1,
'help',
'', 0, 2,
'helpemailtosend');
1215 print
'<div class="center">';
1216 $parameters = array();
1217 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1218 if (empty($reshook)) {
1219 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"AddSubscription").
'">';
1220 print
' ';
1221 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1227 print
"\n<!-- End form subscription -->\n\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts.
Class to manage accounting journals.
Class to manage members of a foundation.
const STATUS_VALIDATED
Validated status.
Class to manage members type.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage subscriptions of foundation members.
Class to manage translations.
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_most_recent_file($dir, $regexfilter='', $excludefilter=array('(\.meta|_preview.*\.png) $', '^\.'), $nohook=0, $mode=0)
Return file(s) into a directory (by default most recent)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.