33require
'../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
52$langs->loadLangs(array(
"companies",
"bills",
"members",
"users",
"mails",
'other'));
54$action =
GETPOST(
'action',
'aZ09');
55$confirm =
GETPOST(
'confirm',
'alpha');
56$contextpage =
GETPOST(
'contextpage',
'aZ09');
57$optioncss =
GETPOST(
'optioncss',
'aZ');
61$ref =
GETPOST(
'ref',
'alphanohtml');
63$cancel =
GETPOST(
'cancel',
'alpha');
67$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
68$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
70if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
74$offset = $limit * $page;
80 $sortfield =
"c.rowid";
91$extrafields->fetch_name_optionals_label(
$object->table_element);
96$hookmanager->initHooks(array(
'subscription'));
108if ($id > 0 || !empty($ref)) {
110 $result =
$object->fetch($id, $ref);
113 $canadduser = ($user->admin || $user->hasRight(
"user",
"user",
"creer"));
117 $caneditfielduser = ((($user->id ==
$object->user_id) && $user->hasRight(
"user",
"self",
"creer"))
118 || (($user->id !=
$object->user_id) && $user->hasRight(
"user",
"user",
"creer")));
119 $caneditpassworduser = ((($user->id ==
$object->user_id) && $user->hasRight(
"user",
"self",
"password"))
120 || (($user->id !=
$object->user_id) && $user->hasRight(
"user",
"user",
"password")));
125$permissiontoaddmember = $user->hasRight(
'adherent',
'creer');
126$permissiontoeditextra = $permissiontoaddmember;
127if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
129 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
140$parameters = array();
141$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
146if (empty($reshook) && $action ==
'update_extras' && $permissiontoeditextra) {
149 $attribute_name =
GETPOST(
'attribute',
'aZ09');
152 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
157 $result =
$object->updateExtraField($attribute_name,
'MEMBER_MODIFY');
164 $action =
'edit_extras';
169if (empty($reshook) && $action ==
'confirm_create_thirdparty' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
173 $result = $company->create_from_member($object,
GETPOST(
'companyname',
'alpha'),
GETPOST(
'companyalias',
'alpha'),
GETPOST(
'customercode',
'alpha'));
176 $langs->load(
"errors");
181 $action =
'createsubscription';
188if (empty($reshook) && $action ==
'setuserid' && ($user->hasRight(
'user',
'self',
'creer') || $user->hasRight(
'user',
'user',
'creer'))) {
190 if (!$user->hasRight(
'user',
'user',
'creer')) {
193 setEventMessages($langs->trans(
"ErrorUserPermissionAllowsToLinksToItselfOnly"),
null,
'errors');
208if (empty($reshook) && $action ==
'setsocid' && $permissiontoaddmember) {
211 $sql =
"SELECT rowid FROM " . MAIN_DB_PREFIX .
"adherent";
212 $sql .=
" WHERE fk_soc = " . ((int)
GETPOSTINT(
'socid'));
213 $resql =
$db->query($sql);
215 $obj =
$db->fetch_object($resql);
216 if ($obj && $obj->rowid > 0) {
218 $othermember->fetch($obj->rowid);
222 setEventMessages($langs->trans(
"ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name),
null,
'errors');
236if (empty($reshook) && $user->hasRight(
'adherent',
'cotisation',
'creer') && $action ==
'subscription' && !$cancel) {
239 $langs->load(
"banks");
241 $result =
$object->fetch($rowid);
242 $result = $adht->fetch(
$object->typeid);
245 $datesubscription = 0;
247 $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
248 $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
264 $operation =
GETPOST(
"operation",
"alphanohtml");
265 $num_chq =
GETPOST(
"num_chq",
"alphanohtml");
266 $emetteur_nom =
GETPOST(
"chqemetteur");
267 $emetteur_banque =
GETPOST(
"chqbank");
268 $option =
GETPOST(
"paymentsave");
269 if (empty($option)) {
272 $sendalsoemail =
GETPOST(
"sendmail",
'alpha');
275 if (!$datesubscription) {
277 $langs->load(
"errors");
278 $errmsg = $langs->trans(
"ErrorBadDateFormat", $langs->transnoentitiesnoconv(
"DateSubscription"));
280 $action =
'createsubscription';
282 if (
GETPOST(
'end') && !$datesubend) {
284 $langs->load(
"errors");
285 $errmsg = $langs->trans(
"ErrorBadDateFormat", $langs->transnoentitiesnoconv(
"DateEndSubscription"));
287 $action =
'createsubscription';
292 if (($option ==
'bankviainvoice' || $option ==
'bankdirect') && !$paymentdate) {
294 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DatePayment"));
296 $action =
'createsubscription';
300 if ($adht->subscription) {
301 if (!is_numeric($amount)) {
303 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount"));
306 $action =
'createsubscription';
312 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label"));
315 $action =
'createsubscription';
317 if (
GETPOST(
"paymentsave") !=
'invoiceonly' && !
GETPOST(
"operation")) {
318 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"PaymentMode"));
321 $action =
'createsubscription';
324 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"FinancialAccount"));
327 $action =
'createsubscription';
331 $errmsg = $langs->trans(
"ErrorDoNotProvideAccountsIfNullAmount");
334 $action =
'createsubscription';
342 if (!$error && $action ==
'subscription') {
346 $crowid =
$object->subscription($datesubscription, (
float) $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
354 $result =
$object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, (
float) $amount, $num_chq, $emetteur_nom, $emetteur_banque);
367 $action =
'createsubscription';
377 if (
$object->email && $sendalsoemail) {
379 'datesubscription' => $datesubscription,
381 'ccountid' => $accountid,
382 'operation' => $operation,
384 'num_chq' => $num_chq,
385 'emetteur_nom' => $emetteur_nom,
386 'emetteur_banque' => $emetteur_banque,
387 'datesubend' => $datesubend
389 $reshook = $hookmanager->executeHooks(
'sendMail', $parameters, $object, $action);
394 if (empty($reshook)) {
399 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
403 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ?
$mysoc->default_lang :
$object->thirdparty->default_lang);
405 $outputlangs->loadLangs(array(
"main",
"members"));
408 $arraydefaultmessage =
null;
411 if (!empty($labeltouse)) {
412 $arraydefaultmessage = $formmail->getEMailTemplate(
$db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
415 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
416 $subject = (
string) $arraydefaultmessage->topic;
417 $msg = (
string) $arraydefaultmessage->content;
420 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null, $object);
427 $listofpaths = array();
428 $listofnames = array();
429 $listofmimes = array();
430 if (is_object(
$object->invoice) && (!is_object($arraydefaultmessage) || intval($arraydefaultmessage->joinfiles))) {
431 $invoicediroutput =
$conf->facture->dir_output;
433 $file = $fileparams[
'fullname'];
435 $listofpaths = array($file);
436 $listofnames = array(basename($file));
440 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/subscription.php'.
"\r\n";
442 $result =
$object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames,
"",
"", 0, -1,
'', $moreinheader);
476$title = $langs->trans(
"Member").
" - ".$langs->trans(
"Subscriptions");
477$help_url =
"EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder";
479llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-member page-card_subscription');
483if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
484 $param .=
'&contextpage='.urlencode($contextpage);
486if ($limit > 0 && $limit !=
$conf->liste_limit) {
487 $param .=
'&limit='.((int) $limit);
489$param .=
'&id='.$rowid;
490if ($optioncss !=
'') {
491 $param .=
'&optioncss='.urlencode($optioncss);
498 $langs->load(
"errors");
499 print $langs->trans(
"ErrorRecordNotFound");
505$defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
506$defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
518print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
519print
'<input type="hidden" name="token" value="'.newToken().
'">';
520print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
524$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/adherents/list.php', [
'restore_lastsearch_values' => 1]).
'">'.$langs->trans(
"BackToList").
'</a>';
526$morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/adherents/vcard.php?id='.
$object->id.
'" class="refid">';
527$morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
528$morehtmlref .=
'</a>';
530dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
532print
'<div class="fichecenter">';
533print
'<div class="fichehalfleft">';
535print
'<div class="underbanner clearboth"></div>';
536print
'<table class="border centpercent tableforfield">';
540 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag(
$object->login).
'</td></tr>';
544print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Type").
'</td>';
545print
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
548print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
549print
'<td class="valeur" >'.$object->getmorphylib(
'', 1).
'</td>';
556print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.
$object->getCivilityLabel().
'</td>';
561 print
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
563 print preg_replace(
'/./i',
'*',
$object->pass);
566 print
'<!-- '.$langs->trans(
"Crypted").
': '.
$object->pass_indatabase_crypted.
' -->';
568 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
570 if (!empty(
$object->pass_indatabase) && empty(
$object->user_id)) {
571 $langs->load(
"errors");
572 $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
573 print
' '.$form->textwithpicto(
'', $htmltext, 1,
'warning');
579print
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
583 print
" ".img_warning($langs->trans(
"Late"));
586 if (
$object->need_subscription == 0) {
587 print $langs->trans(
"SubscriptionNotNeeded");
588 } elseif (!$adht->subscription) {
589 print $langs->trans(
"SubscriptionNotRecorded");
591 print
" ".img_warning($langs->trans(
"Late"));
594 print $langs->trans(
"SubscriptionNotReceived");
596 print
" ".img_warning($langs->trans(
"Late"));
606print
'<div class="fichehalfright">';
607print
'<div class="underbanner clearboth"></div>';
609print
'<table class="border tableforfield centpercent">';
612if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
613 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
614 print
'<td colspan="2">';
615 print $form->showCategories(
$object->id, Categorie::TYPE_MEMBER, 1);
620print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date(
$object->birth,
'day').
'</td></tr>';
624 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
625 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
628 $langs->load(
"languages");
629 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
636$linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((
isModEnabled(
'multicompany')) ?
'?entity='.
$conf->entity :
'');
637print
'<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>';
641include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
646 print
'<table class="nobordernopadding centpercent"><tr><td>';
647 print $langs->trans(
"LinkedToDolibarrThirdParty");
649 if ($action !=
'editthirdparty' && $user->hasRight(
'adherent',
'creer')) {
650 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>';
652 print
'</tr></table>';
653 print
'</td><td colspan="2" class="valeur">';
654 if ($action ==
'editthirdparty') {
656 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
657 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
658 print
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
659 print
'<input type="hidden" name="token" value="'.newToken().
'">';
660 print
'<table class="nobordernopadding">';
662 print $form->select_company(
$object->socid,
'socid',
'', 1);
664 print
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
665 print
'</tr></table></form>';
669 $result = $company->fetch(
$object->socid);
670 print $company->getNomUrl(1);
673 $tmparray = $company->getOutstandingBills(
'customer');
674 if (!empty($tmparray[
'refs'])) {
675 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']).
')';
680 print
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
688print
'<table class="nobordernopadding centpercent"><tr><td>';
689print $langs->trans(
"LinkedToDolibarrUser");
691if ($action !=
'editlogin' && $user->hasRight(
'adherent',
'creer')) {
692 print
'<td class="right">';
693 if ($user->hasRight(
"user",
"user",
"creer")) {
694 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editlogin&token='.
newToken().
'&rowid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetLinkToUser'), 1).
'</a>';
698print
'</tr></table>';
699print
'</td><td colspan="2" class="valeur">';
700if ($action ==
'editlogin') {
701 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.
$object->id, (
string)
$object->user_id,
'userid', array());
705 $linkeduser->fetch(
$object->user_id);
706 print $linkeduser->getNomUrl(-1);
708 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
715print
"</div></div>\n";
716print
'<div class="clearboth"></div>';
726if ($user->hasRight(
'adherent',
'cotisation',
'creer')) {
727 if ($action !=
'createsubscription' && $action !=
'create_thirdparty') {
728 print
'<div class="tabsAction">';
731 print
'<div class="inline-block divButAction"><a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'rowid' => $rowid,
'action' =>
'createsubscription'],
true).
'">'.$langs->trans(
"AddSubscription").
"</a></div>";
733 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"AddSubscription").
'</a></div>';
743if ($action !=
'createsubscription' && $action !=
'create_thirdparty') {
744 $sql =
"SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,";
745 $sql .=
" c.rowid as crowid, c.subscription,";
746 $sql .=
" c.datec, c.fk_type as cfk_type,";
747 $sql .=
" c.dateadh as dateh, c.note as clabel,";
749 $sql .=
" c.fk_bank,";
750 $sql .=
" b.rowid as bid,";
751 $sql .=
" ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code";
752 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"subscription as c";
753 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON c.fk_bank = b.rowid";
754 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON b.fk_account = ba.rowid";
755 $sql .=
" WHERE d.rowid = c.fk_adherent AND d.rowid=".((int) $rowid);
756 $sql .=
$db->order($sortfield, $sortorder);
758 $result =
$db->query($sql);
762 $num =
$db->num_rows($result);
764 print
'<div class="div-table-responsive-no-min">';
765 print
'<table class="noborder centpercent">'.
"\n";
767 print
'<tr class="liste_titre">';
769 print_liste_field_titre(
'DateCreation', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
771 print_liste_field_titre(
'DateStart', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
772 print_liste_field_titre(
'DateEnd', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
776 print_liste_field_titre(
'Account', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
786 $objp =
$db->fetch_object($result);
788 $adh->id = $objp->rowid;
789 $adh->typeid = $objp->type;
791 $subscriptionstatic->ref = $objp->crowid;
792 $subscriptionstatic->id = $objp->crowid;
793 $subscriptionstatic->note_public = $objp->clabel;
795 $typeid = $objp->cfk_type;
797 $adht->fetch($typeid);
800 print
'<tr class="oddeven">';
801 print
'<td>'.$subscriptionstatic->getNomUrl(1).
'</td>';
802 print
'<td class="center nowraponall">'.dol_print_date(
$db->jdate($objp->datec),
'dayhour').
"</td>\n";
803 print
'<td class="center tdoverflowmax125">';
805 print $adht->getNomUrl(1);
808 print
'<td class="center">'.dol_print_date(
$db->jdate($objp->dateh),
'day').
"</td>\n";
809 print
'<td class="center">'.dol_print_date(
$db->jdate($objp->datef),
'day').
"</td>\n";
810 print
'<td class="right amount">'.price($objp->subscription).
'</td>';
811 print
'<td class="left">'.$objp->clabel.
'</td>';
813 print
'<td class="tdoverflowmax100 right">';
815 $accountstatic->label = $objp->label;
816 $accountstatic->id = $objp->baid;
817 $accountstatic->number = $objp->number;
818 $accountstatic->account_number = $objp->account_number;
819 $accountstatic->currency_code = $objp->currency_code;
821 if (
isModEnabled(
'accounting') && $objp->fk_accountancy_journal > 0) {
823 $accountingjournal->fetch($objp->fk_accountancy_journal);
825 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
828 $accountstatic->ref = $objp->ref;
829 print $accountstatic->getNomUrl(1);
844 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
855if (($action !=
'createsubscription' && $action !=
'create_thirdparty')) {
858 include_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
859 $validpaymentmethod = getValidOnlinePaymentMethods(
'');
860 $useonlinepayment = count($validpaymentmethod);
862 if ($useonlinepayment) {
865 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
866 print showOnlinePaymentUrl(
'membersubscription',
$object->ref);
874if (($action ==
'createsubscription' || $action ==
'create_thirdparty') && $user->hasRight(
'adherent',
'cotisation',
'creer')) {
884 if (
GETPOST(
'paymentsave') ==
'bankdirect') {
887 if (
GETPOST(
'paymentsave') ==
'invoiceonly') {
890 if (
GETPOST(
'paymentsave') ==
'bankviainvoice') {
903 print
"\n\n<!-- Form add subscription -->\n";
905 if (
$conf->use_javascript_ajax) {
907 print
"\n".
'<script type="text/javascript">';
908 print
'$(document).ready(function () {
909 $(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ?
'show()' :
'hide()').
';
910 $("#none, #invoiceonly").click(function() {
911 $(".bankswitchclass").hide();
912 $(".bankswitchclass2").hide();
914 $("#bankdirect, #bankviainvoice").click(function() {
915 $(".bankswitchclass").show();
916 $(".bankswitchclass2").show();
918 $("#selectoperation").change(function() {
919 var code = $(this).val();
922 $(".fieldrequireddyn").addClass("fieldrequired");
923 if ($("#fieldchqemetteur").val() == "")
925 $("#fieldchqemetteur").val($("#memberlabel").val());
930 $(".fieldrequireddyn").removeClass("fieldrequired");
935 print
'$("#'.GETPOST(
'paymentsave',
'aZ09').
'").prop("checked", true);';
938 print
'</script>'.
"\n";
943 if ($action ==
'create_thirdparty') {
945 $fullname =
$object->getFullName($langs);
947 if (
$object->morphy ==
'mor') {
948 $companyname =
$object->company;
949 if (!empty($fullname)) {
950 $companyalias = $fullname;
953 $companyname = $fullname;
954 if (!empty(
$object->company)) {
955 $companyalias =
$object->company;
960 $formquestion = array(
961 array(
'label' => $langs->trans(
"NameToCreate"),
'type' =>
'text',
'name' =>
'companyname',
'value' => $companyname,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"'),
962 array(
'label' => $langs->trans(
"AliasNames"),
'type' =>
'text',
'name' =>
'companyalias',
'value' => $companyalias,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"')
967 $tmpcompany->name = (
string) $companyname;
968 $tmpcompany->get_codeclient($tmpcompany, 0);
969 $customercode = $tmpcompany->code_client;
970 $formquestion[] = array(
971 'label' => $langs->trans(
"CustomerCode"),
973 'name' =>
'customercode',
974 'value' => $customercode,
975 'morecss' =>
'minwidth300',
976 'moreattr' =>
'maxlength="128"',
981 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".
$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"),
"confirm_create_thirdparty", $formquestion, 1);
985 print
'<form name="subscription" method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
986 print
'<input type="hidden" name="token" value="'.newToken().
'">';
987 print
'<input type="hidden" name="action" value="subscription">';
988 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
989 print
'<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag(
$object->getFullName($langs)).
'">';
990 print
'<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag(
$object->company).
'">';
994 print
'<div class="div-table-responsive">';
995 print
'<table class="border centpercent">'.
"\n";
1007 print
'<td class="fieldrequired">'.$langs->trans(
"DateSubscription").
'</td><td>';
1032 print $form->selectDate($datefrom,
'', 0, 0, 0,
"subscription", 1, 1);
1042 } elseif (
getDolGlobalInt(
'MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) {
1048 print
'<tr><td>'.$langs->trans(
"DateEndSubscription").
'</td><td>';
1049 print $form->selectDate($dateto,
'end', 0, 0, 0,
"subscription", 1, 0);
1052 if ($adht->subscription) {
1054 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td>';
1055 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".
getDolCurrency()) .
'</td></tr>';
1058 print
'<tr><td>'.$langs->trans(
"Note").
'</td>';
1059 print
'<td><input name="label" type="text" size="32" value="';
1061 print $langs->trans(
"Subscription").
' '.
dol_print_date(($datefrom ? $datefrom : time()),
"%Y");
1063 print
'"></td></tr>';
1069 $result = $company->fetch(
$object->socid);
1073 print
'<tr><td class="tdtop fieldrequired">'.$langs->trans(
'MoreActions');
1075 print
'<td class="line-height-large">';
1077 print
'<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice) ?
' checked' :
'').
'>';
1078 print
'<label for="none"> '.$langs->trans(
"None").
'</label><br>';
1081 print
'<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(!empty($bankdirect) ?
' checked' :
'');
1082 print
'><label for="bankdirect"> '.$langs->trans(
"MoreActionBankDirect").
'</label><br>';
1086 print
'<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ?
' checked' :
'');
1088 print
'><label for="invoiceonly"> '.$langs->trans(
"MoreActionInvoiceOnly");
1090 print
' ('.$langs->trans(
"ThirdParty").
': '.$company->getNomUrl(1).
')';
1094 print
img_warning($langs->trans(
"NoThirdPartyAssociatedToMember"));
1096 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1097 print
' - <a href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.
$object->id.
'&action=create_thirdparty">';
1098 print $langs->trans(
"CreateDolibarrThirdParty");
1102 print
'. <span class="opacitymedium">'.$langs->trans(
"NoVatOnSubscription", 0).
'</span>';
1106 $result = $prodtmp->fetch(
getDolGlobalInt(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'));
1110 print
'. '.$langs->transnoentitiesnoconv(
"ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1));
1112 print
'</label><br>';
1116 print
'<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(!empty($bankviainvoice) ?
' checked' :
'');
1118 print
'><label for="bankviainvoice"> '.$langs->trans(
"MoreActionBankViaInvoice");
1120 print
' ('.$langs->trans(
"ThirdParty").
': '.$company->getNomUrl(1).
')';
1124 print
img_warning($langs->trans(
"NoThirdPartyAssociatedToMember"));
1126 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1127 print
' - <a href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.
$object->id.
'&action=create_thirdparty">';
1128 print $langs->trans(
"CreateDolibarrThirdParty");
1132 print
'. <span class="opacitymedium">'.$langs->trans(
"NoVatOnSubscription", 0).
'</span>';
1136 $result = $prodtmp->fetch(
getDolGlobalInt(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'));
1140 print
'. '.$langs->transnoentitiesnoconv(
"ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1));
1142 print
'</label><br>';
1147 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"FinancialAccount").
'</td><td>';
1148 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
1149 $form->select_comptes(
GETPOST(
'accountid'),
'accountid', 0,
'', 2,
'', 0,
'minwidth200');
1150 print
"</td></tr>\n";
1153 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"PaymentMode").
'</td><td>';
1154 print $form->select_types_paiements(
GETPOST(
'operation'),
'operation',
'', 2, 1, 0, 0, 1,
'minwidth200', 1);
1155 print
"</td></tr>\n";
1158 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
1159 print $form->selectDate(isset($paymentdate) ? $paymentdate : -1,
'payment', 0, 0, 1,
'subscription', 1, 1);
1160 print
"</td></tr>\n";
1162 print
'<tr class="bankswitchclass2"><td>'.$langs->trans(
'Numero');
1163 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
1165 print
'<td><input id="fieldnum_chq" name="num_chq" type="text" size="8" value="'.(!
GETPOST(
'num_chq') ?
'' :
GETPOST(
'num_chq')).
'"></td></tr>';
1167 print
'<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans(
'CheckTransmitter');
1168 print
' <em>('.$langs->trans(
"ChequeMaker").
')</em>';
1170 print
'<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="'.(!
GETPOST(
'chqemetteur') ?
'' :
GETPOST(
'chqemetteur')).
'"></td></tr>';
1172 print
'<tr class="bankswitchclass2"><td>'.$langs->trans(
'Bank');
1173 print
' <em>('.$langs->trans(
"ChequeBank").
')</em>';
1175 print
'<td><input id="chqbank" name="chqbank" size="32" type="text" value="'.(!
GETPOST(
'chqbank') ?
'' :
GETPOST(
'chqbank')).
'"></td></tr>';
1179 print
'<tr><td></td><td></td></tr>';
1181 print
'<tr><td>'.$langs->trans(
"SendAcknowledgementByMail").
'</td>';
1184 print $langs->trans(
"NoEMail");
1187 $adht->fetch(
$object->typeid);
1194 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1198 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ?
$mysoc->default_lang :
$object->thirdparty->default_lang);
1200 $outputlangs->loadLangs(array(
"main",
"members"));
1202 $arraydefaultmessage =
null;
1205 if (!empty($labeltouse)) {
1206 $arraydefaultmessage = $formmail->getEMailTemplate(
$db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1209 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1210 $subject = (
string) $arraydefaultmessage->topic;
1211 $msg = (
string) $arraydefaultmessage->content;
1214 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null, $object);
1219 $tmp =
'<input name="sendmail" type="checkbox"'.(GETPOST(
'sendmail',
'alpha') ?
' checked' : (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
' checked' :
'')).
'>';
1221 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM',
$conf->email_from).
'<br>'.
"\n";
1222 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.
$object->email.
'<br>'.
"\n";
1223 $helpcontent .=
'<b>'.$langs->trans(
"MailTopic").
'</b>:<br>'.
"\n";
1224 if ($subjecttosend) {
1225 $helpcontent .= $subjecttosend.
"\n";
1227 $langs->load(
"errors");
1228 $helpcontent .=
'<span class="error">'.$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"Module310Name")).
'</span>'.
"\n";
1230 $helpcontent .=
"<br>";
1231 $helpcontent .=
'<b>'.$langs->trans(
"MailText").
'</b>:<br>';
1235 $langs->load(
"errors");
1236 $helpcontent .=
'<span class="error">'.$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"Module310Name")).
'</span>'.
"\n";
1239 print $form->textwithpicto($tmp, $helpcontent, 1,
'help',
'', 0, 2,
'helpemailtosend');
1248 print
'<div class="center">';
1249 $parameters = array();
1250 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1251 if (empty($reshook)) {
1252 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"AddSubscription").
'">';
1253 print
' ';
1254 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1260 print
"\n<!-- End form subscription -->\n\n";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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_now($mode='gmt')
Return date for now.
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...
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.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
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...
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
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...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object information.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount
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.