Skip to content

Commit

Permalink
NEW|add member civility to the labels (#31710)
Browse files Browse the repository at this point in the history
* Update carte.php

add member civility to the labels, as described on https://www.dolibarr.fr/forum/t/personnaliser-champs-a-imprimer-sur-etiquettes-pdf-des-adherents/47668

But I don't know how to do to add extrafields. If anybody has an idea to get me on the track...

* Update carte.php

as proposed by @hregis

* added member extrafield

added member extrafields to display extrafields values

* Update carte.php

* Update carte.php

* Update carte.php

* Update carte.php

* Update carte.php

* Update carte.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
  • Loading branch information
AlainRnet and eldy authored Nov 7, 2024
1 parent d8c4f67 commit 32640c4
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions htdocs/adherents/cartes/carte.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
$arrayofmembers = array();

// request taking into account member with up to date subscriptions
$sql = "SELECT d.rowid, d.ref, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql = "SELECT d.rowid, d.ref, d.civility, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql .= " t.libelle as type,";
$sql .= " c.code as country_code, c.label as country";
Expand Down Expand Up @@ -138,27 +138,31 @@

// List of values to scan for a replacement
$substitutionarray = array(
'__ID__' => $objp->rowid,
'__REF__' => $objp->ref,
'__LOGIN__' => empty($objp->login) ? '' : $objp->login,
'__FIRSTNAME__' => empty($objp->firstname) ? '' : $objp->firstname,
'__LASTNAME__' => empty($objp->lastname) ? '' : $objp->lastname,
'__FULLNAME__' => $adherentstatic->getFullName($langs),
'__COMPANY__' => empty($objp->company) ? '' : $objp->company,
'__ADDRESS__' => empty($objp->address) ? '' : $objp->address,
'__ZIP__' => empty($objp->zip) ? '' : $objp->zip,
'__TOWN__' => empty($objp->town) ? '' : $objp->town,
'__COUNTRY__' => empty($objp->country) ? '' : $objp->country,
'__COUNTRY_CODE__' => empty($objp->country_code) ? '' : $objp->country_code,
'__EMAIL__' => empty($objp->email) ? '' : $objp->email,
'__BIRTH__' => dol_print_date($objp->birth, 'day'),
'__TYPE__' => empty($objp->type) ? '' : $objp->type,
'__MEMBER_ID__' => $objp->rowid,
'__MEMBER_REF__' => $objp->ref,
'__MEMBER_LOGIN__' => empty($objp->login) ? '' : $objp->login,
'__MEMBER_TITLE__' => empty($objp->civility) ? '' : $langs->trans("Civility".$objp->civility),
'__MEMBER_FIRSTNAME__' => empty($objp->firstname) ? '' : $objp->firstname,
'__MEMBER_LASTNAME__' => empty($objp->lastname) ? '' : $objp->lastname,
'__MEMBER_FULLNAME__' => $adherentstatic->getFullName($langs),
'__MEMBER_COMPANY__' => empty($objp->company) ? '' : $objp->company,
'__MEMBER_ADDRESS__' => empty($objp->address) ? '' : $objp->address,
'__MEMBER_ZIP__' => empty($objp->zip) ? '' : $objp->zip,
'__MEMBER_TOWN__' => empty($objp->town) ? '' : $objp->town,
'__MEMBER_COUNTRY__' => empty($objp->country) ? '' : $objp->country,
'__MEMBER_COUNTRY_CODE__' => empty($objp->country_code) ? '' : $objp->country_code,
'__MEMBER_EMAIL__' => empty($objp->email) ? '' : $objp->email,
'__MEMBER_BIRTH__' => dol_print_date($objp->birth, 'day'),
'__MEMBER_TYPE__' => empty($objp->type) ? '' : $objp->type,
'__YEAR__' => $year,
'__MONTH__' => $month,
'__DAY__' => $day,
'__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT,
'__SERVER__' => "https://".$_SERVER["SERVER_NAME"]."/"
);
foreach ($adherentstatic->array_options as $key => $val) {
$substitutionarray['__'.strtoupper($key).'__'] = $val;
}
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);

// For business cards
Expand Down Expand Up @@ -201,7 +205,7 @@
// For labels
if ($mode == 'label') {
if (!getDolGlobalString('ADHERENT_ETIQUETTE_TEXT')) {
$conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
$conf->global->ADHERENT_ETIQUETTE_TEXT = "__MEMBER_CIVILITY__\n__MEMBER_FULLNAME__\n__MEMBER_ADDRESS__\n__MEMBER_ZIP__ __MEMBER_TOWN__\n__MEMBER_COUNTRY__";
}
$textleft = make_substitutions(getDolGlobalString('ADHERENT_ETIQUETTE_TEXT'), $substitutionarray);
$textheader = '';
Expand Down

0 comments on commit 32640c4

Please sign in to comment.