*
* PHP version 5
*
- * Copyright © 2012-2014 The Galette Team
+ * Copyright © 2012-2021 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
'position' => 11,
'category' => FieldsCategories::ADH_CATEGORY_CONTACT
),
- /** TODO remove second address... */
- 'adresse2_adh' => array(
- 'label' => _T("Address (continuation)"),
- 'propname' => 'address_continuation',
- 'required' => false,
- 'visible' => FieldsConfig::USER_WRITE,
- 'position' => 12,
- 'category' => FieldsCategories::ADH_CATEGORY_CONTACT
- ),
'cp_adh' => array(
'label' => _T("Zip Code:"),
'propname' => 'zipcode',
ddn_adh date default '1901-01-01',
sexe_adh tinyint(1) NOT NULL default '0',
adresse_adh text NOT NULL,
- adresse2_adh varchar(150) default NULL, -- TODO: remove
cp_adh varchar(10) NOT NULL default '',
ville_adh varchar(200) NOT NULL default '',
pays_adh varchar(200) default NULL,
ddn_adh date DEFAULT '19010101',
sexe_adh smallint DEFAULT '0' NOT NULL,
adresse_adh text DEFAULT '' NOT NULL,
- adresse2_adh character varying(150) DEFAULT NULL, -- TODO: remove
cp_adh character varying(10) DEFAULT '' NOT NULL,
ville_adh character varying(200) DEFAULT '' NOT NULL,
pays_adh character varying(200) DEFAULT NULL,
INSERT INTO galette_socials (id_adh, type, url) SELECT id_adh, 'icq', icq_adh FROM galette_adherents WHERE icq_adh != '';
INSERT INTO galette_socials (id_adh, type, url) SELECT id_adh, 'msn', msn_adh FROM galette_adherents WHERE msn_adh != '';
INSERT INTO galette_socials (id_adh, type, url) SELECT id_adh, 'jabber', jabber_adh FROM galette_adherents WHERE jabber_adh != '';
+
+-- drop adresse2_adh field
+UPDATE galette_adherents SET adresse2_adh = NULL WHERE adresse2_adh = '';
+UPDATE galette_adherents SET adresse_adh = CONCAT_WS("\n", adresse_adh, adresse2_adh);
+
-- cleanup members table
ALTER TABLE galette_adherents DROP column url_adh;
ALTER TABLE galette_adherents DROP column icq_adh;
ALTER TABLE galette_adherents DROP column msn_adh;
ALTER TABLE galette_adherents DROP column jabber_adh;
+ALTER TABLE galette_adherents DROP column adresse2_adh;
+
-- cleanup fields config
-DELETE FROM galette_fields_config WHERE field_id IN ('url_adh', 'icq_adh', 'msn_adh', 'jabber_adh');
+DELETE FROM galette_fields_config WHERE field_id IN ('url_adh', 'icq_adh', 'msn_adh', 'jabber_adh', 'adresse2_adh');
+
-- add num_adh column
ALTER TABLE galette_adherents ADD COLUMN num_adh varchar(255) DEFAULT NULL;
INSERT INTO galette_socials (id_adh, type, url) SELECT id_adh, 'icq', icq_adh FROM galette_adherents WHERE icq_adh != '';
INSERT INTO galette_socials (id_adh, type, url) SELECT id_adh, 'msn', msn_adh FROM galette_adherents WHERE msn_adh != '';
INSERT INTO galette_socials (id_adh, type, url) SELECT id_adh, 'jabber', jabber_adh FROM galette_adherents WHERE jabber_adh != '';
+
+-- drop adresse2_adh field
+UPDATE galette_adherents SET adresse2_adh = NULL WHERE adresse2_adh = '';
+UPDATE galette_adherents SET adresse_adh = CONCAT_WS('\n', adresse_adh, adresse2_adh);
+
-- cleanup members table
ALTER TABLE galette_adherents DROP column url_adh;
ALTER TABLE galette_adherents DROP column icq_adh;
ALTER TABLE galette_adherents DROP column msn_adh;
ALTER TABLE galette_adherents DROP column jabber_adh;
+ALTER TABLE galette_adherents DROP column adresse2_adh;
+
-- cleanup fields config table
-DELETE FROM galette_fields_config WHERE field_id IN ('url_adh', 'icq_adh', 'msn_adh', 'jabber_adh');
+DELETE FROM galette_fields_config WHERE field_id IN ('url_adh', 'icq_adh', 'msn_adh', 'jabber_adh', 'adresse2_adh');
-- add num_adh column
ALTER TABLE galette_adherents ADD COLUMN num_adh character varying (255) DEFAULT NULL;
_T("%name association's %status")
) . "\n";
$_address = $adh->address;
- if ($adh->address_continuation && $adh->address_continuation != '') {
- $_address .= "\n" . $adh->address_continuation;
- }
+
$replacements = array(
$adh->sfullname . "\n",
$_complement,
* @property string $name
* @property string $surname
* @property string $nickname
- * @property string $birthdate Localized birth date
- * @property string $rbirthdate Raw birth date
+ * @property string $birthdate Localized birthdate
+ * @property string $rbirthdate Raw birthdate
* @property string $birth_place
* @property integer $gender
* @property string $sgender Gender label
* @property integer $status
* @property string $sstatus Status label
* @property string $address
- * @property string $address_continuation
* @property string $zipcode
* @property string $town
* @property string $country
* @property string $sactive yes/no
* @property string $sfullname
* @property string $sname
- * @property string $saddress Concatened address and continuation
+ * @property string $saddress
* @property string $contribstatus State of member contributions
* @property string $days_remaining
* @property-read integer $parent_id
private $_status;
//Contact information
private $_address;
- private $_address_continuation; /** TODO: remove */
private $_zipcode;
private $_town;
private $_country;
private $parent_fields = [
'adresse_adh',
- 'adresse2_adh',
'cp_adh',
'ville_adh',
'email_adh'
$this->_status = (int)$r->id_statut;
//Contact information
$this->_address = $r->adresse_adh;
- /** TODO: remove and merge with address */
- $this->_address_continuation = $r->adresse2_adh;
$this->_zipcode = $r->cp_adh;
$this->_town = $r->ville_adh;
$this->_country = $r->pays_adh;
case 'sstatus':
$status = new Status($this->zdb);
return $status->getLabel($this->_status);
- break;
case 'sfullname':
return $this->getNameWithCase(
$this->_name,
$this->_surname,
(isset($this->_title) ? $this->title : false)
);
- break;
case 'saddress':
$address = $this->_address;
- if ($this->_address_continuation !== '' && $this->_address_continuation !== null) {
- $address .= "\n" . $this->_address_continuation;
- }
return $address;
- break;
case 'sname':
return $this->getNameWithCase($this->_name, $this->_surname);
- break;
case 'rbirthdate':
return $this->_birthdate;
- break;
case 'sgender':
switch ($this->gender) {
case self::MAN:
default:
return _T('Unspecified');
}
- break;
case 'contribstatus':
return $this->getDues();
- break;
}
}
} else {
return null;
}
- break;
case 'address':
- case 'address_continuation':
return $this->$rname ?? '';
- break;
case 'birthdate':
case 'creation_date':
case 'modification_date':
break;
case 'parent_id':
return ($this->_parent instanceof Adherent) ? (int)$this->_parent->id : (int)$this->_parent;
- break;
default:
if (!property_exists($this, $rname)) {
Analog::log(
} else {
return $this->$rname;
}
- break;
}
}
return $address ?? '';
}
- /**
- * Get member address continuation.
- * If member does not have an address, but is attached to another member, we'll take information from its parent.
- *
- * @return string
- */
- public function getAddressContinuation(): string
- {
- $address = $this->_address;
- $address_continuation = $this->_address_continuation;
- if (empty($address) && $this->hasParent()) {
- $this->loadParent();
- $address_continuation = $this->parent->address_continuation;
- }
-
- return $address_continuation ?? '';
- }
-
/**
* Get member zipcode.
* If member does not have an address, but is attached to another member, we'll take information from its parent.
'mdp_adh',
'titre_adh',
'sexe_adh',
- 'prenom_adh',
- 'adresse2_adh'
+ 'prenom_adh'
);
/**
*/
private $non_list_elements = array(
'mdp_adh',
- 'adresse2_adh',
'info_adh',
'info_public_adh',
'nom_adh',
global $login;
$address = $member->getAddress();
- if ($member->getAddressContinuation() !== '') {
- $address .= '<br/>' . $member->getAddressContinuation();
- }
if ($member->isMan()) {
$gender = _T("Man");
$this->SetFont(self::FONT, '', $this->preferences->pref_etiq_corps);
$this->SetXY($x, $y + $this->line_h);
- //calculte font size to display address and address continuation
+ //calculte font size to display address
$max_text_size = $this->preferences->pref_etiq_hsize;
- $text = mb_strlen($member->address) > mb_strlen($member->address_continuation) ?
- $member->address : $member->address_continuation;
$this->fixSize(
- $text,
+ $member->address,
$max_text_size,
$this->preferences->pref_etiq_corps
);
$this->Cell($this->lw, $this->line_h, $member->address, 0, 0, 'L', 0);
- // Print second line of address
- $this->SetXY($x, $y + $this->line_h * 2);
- $this->Cell(
- $this->lw,
- $this->line_h,
- $member->address_continuation,
- 0,
- 0,
- 'L',
- 0
- );
+
// Print zip code and town
$this->SetFont(self::FONT, 'B', $this->preferences->pref_etiq_corps);
$text = $member->zipcode . ' - ' . $member->town;
'(' .
'LOWER(adresse_adh) LIKE ' . $token
. ' OR ' .
- 'LOWER(adresse2_adh) LIKE ' . $token
- . ' OR ' .
'cp_adh LIKE ' . $token
. ' OR ' .
'LOWER(ville_adh) LIKE ' . $token
{include file="forms_types/picture.tpl"}
{/if}
{foreach item=entry from=$fieldset->elements}
- {if $entry->field_id neq 'adresse2_adh'}
- {assign var="template" value="text.tpl"}
- {assign var="title" value=null}
- {assign var="tip" value=null}
- {assign var="size" value=null}
- {assign var="propname" value=$entry->propname}
- {assign var="value" value=null}
- {assign var="checked" value=null}
- {assign var="example" value=null}
+ {assign var="template" value="text.tpl"}
+ {assign var="title" value=null}
+ {assign var="tip" value=null}
+ {assign var="size" value=null}
+ {assign var="propname" value=$entry->propname}
+ {assign var="value" value=null}
+ {assign var="checked" value=null}
+ {assign var="example" value=null}
- {if $entry->type eq constant('Galette\Entity\FieldsConfig::TYPE_BOOL')}
- {assign var="template" value="checkbox.tpl"}
- {assign var="value" value="1"}
- {/if}
- {if $entry->field_id eq 'titre_adh'}
- {assign var="template" value="titles.tpl"}
- {assign var="value" value=$member->title}
- {/if}
- {if $entry->field_id eq 'pref_lang'}
- {assign var="template" value="lang.tpl"}
- {/if}
- {if $entry->field_id eq 'sexe_adh'}
- {assign var="template" value="gender.tpl"}
- {/if}
- {if $entry->field_id eq 'societe_adh'}
- {assign var="template" value="company.tpl"}
- {/if}
- {if $entry->field_id|strpos:'date_' === 0 or $entry->field_id eq 'ddn_adh'}
- {assign var="template" value="date.tpl"}
- {/if}
- {if $entry->field_id eq 'adresse_adh'}
- {assign var="template" value="address.tpl"}
- {/if}
- {if $entry->field_id eq 'mdp_adh'}
- {if !$self_adh}
- {assign var="template" value="password.tpl"}
- {else}
- {assign var="template" value="captcha.tpl"}
- {/if}
+ {if $entry->type eq constant('Galette\Entity\FieldsConfig::TYPE_BOOL')}
+ {assign var="template" value="checkbox.tpl"}
+ {assign var="value" value="1"}
+ {/if}
+ {if $entry->field_id eq 'titre_adh'}
+ {assign var="template" value="titles.tpl"}
+ {assign var="value" value=$member->title}
+ {/if}
+ {if $entry->field_id eq 'pref_lang'}
+ {assign var="template" value="lang.tpl"}
+ {/if}
+ {if $entry->field_id eq 'sexe_adh'}
+ {assign var="template" value="gender.tpl"}
+ {/if}
+ {if $entry->field_id eq 'societe_adh'}
+ {assign var="template" value="company.tpl"}
+ {/if}
+ {if $entry->field_id|strpos:'date_' === 0 or $entry->field_id eq 'ddn_adh'}
+ {assign var="template" value="date.tpl"}
+ {/if}
+ {if $entry->field_id eq 'adresse_adh'}
+ {assign var="template" value="address.tpl"}
+ {/if}
+ {if $entry->field_id eq 'mdp_adh'}
+ {if !$self_adh}
+ {assign var="template" value="password.tpl"}
+ {else}
+ {assign var="template" value="captcha.tpl"}
{/if}
- {if $entry->field_id eq 'info_adh'
- or $entry->field_id eq 'info_public_adh'}
- {assign var="template" value="textarea.tpl"}
- {if $entry->field_id eq 'info_adh'}
- {assign var="example" value={_T string="This comment is only displayed for admins and staff members."}}
- {else}
- {if $login->isAdmin() or $login->isStaff()}
- {assign var="example" value={_T string="This comment is reserved to the member."}}
- {/if}
+ {/if}
+ {if $entry->field_id eq 'info_adh'
+ or $entry->field_id eq 'info_public_adh'}
+ {assign var="template" value="textarea.tpl"}
+ {if $entry->field_id eq 'info_adh'}
+ {assign var="example" value={_T string="This comment is only displayed for admins and staff members."}}
+ {else}
+ {if $login->isAdmin() or $login->isStaff()}
+ {assign var="example" value={_T string="This comment is reserved to the member."}}
{/if}
{/if}
- {if $entry->field_id eq 'activite_adh'}
- {assign var="template" value="account.tpl"}
- {/if}
- {if $entry->field_id eq 'id_statut'}
- {assign var="template" value="status.tpl"}
- {/if}
-
- {if $entry->field_id eq 'gpgid'}
- {assign var="size" value="8"}
- {/if}
- {if $entry->field_id eq 'email_adh'}
- {assign var="size" value="30"}
- {/if}
- {if $entry->field_id eq 'fingerprint'}
- {assign var="size" value="40"}
- {/if}
- {if $entry->field_id eq 'bool_display_info'}
- {assign var="title" value={_T string="Do member want to appear publically?"}}
- {assign var="tip" value={_T string="If you check this box (and if you are up to date with your contributions), your full name and other information will be publically visible on the members list.<br/>If you've uploaded a photo, it will be displayed on the trombinoscope page.<br/>Note that administrators can disabled public pages, this setting will have no effect in that case."}}
- {assign var="checked" value=$member->appearsInMembersList()}
- {/if}
- {if $entry->field_id eq 'login_adh'}
- {assign var="example" value={_T string="(at least %i characters)" pattern="/%i/" replace=2}}
- {/if}
+ {/if}
+ {if $entry->field_id eq 'activite_adh'}
+ {assign var="template" value="account.tpl"}
+ {/if}
+ {if $entry->field_id eq 'id_statut'}
+ {assign var="template" value="status.tpl"}
+ {/if}
- {if $entry->field_id eq 'bool_admin_adh'}
- {assign var="checked" value=$member->isAdmin()}
- {/if}
- {if $entry->field_id eq 'bool_exempt_adh'}
- {assign var="checked" value=$member->isDueFree()}
- {/if}
- {if $entry->field_id eq 'parent_id'}
- {assign var="value" value=$member->parent->id}
- {/if}
- {if $entry->field_id eq 'activite_adh'}
- {assign var="value" value=$member->isActive()}
- {/if}
+ {if $entry->field_id eq 'gpgid'}
+ {assign var="size" value="8"}
+ {/if}
+ {if $entry->field_id eq 'email_adh'}
+ {assign var="size" value="30"}
+ {/if}
+ {if $entry->field_id eq 'fingerprint'}
+ {assign var="size" value="40"}
+ {/if}
+ {if $entry->field_id eq 'bool_display_info'}
+ {assign var="title" value={_T string="Do member want to appear publically?"}}
+ {assign var="tip" value={_T string="If you check this box (and if you are up to date with your contributions), your full name and other information will be publically visible on the members list.<br/>If you've uploaded a photo, it will be displayed on the trombinoscope page.<br/>Note that administrators can disabled public pages, this setting will have no effect in that case."}}
+ {assign var="checked" value=$member->appearsInMembersList()}
+ {/if}
+ {if $entry->field_id eq 'login_adh'}
+ {assign var="example" value={_T string="(at least %i characters)" pattern="/%i/" replace=2}}
+ {/if}
- {* If value has not been set, take the generic value *}
- {if !$value and $propname != 'password'}
- {assign var="value" value=$member->$propname}
- {/if}
+ {if $entry->field_id eq 'bool_admin_adh'}
+ {assign var="checked" value=$member->isAdmin()}
+ {/if}
+ {if $entry->field_id eq 'bool_exempt_adh'}
+ {assign var="checked" value=$member->isDueFree()}
+ {/if}
+ {if $entry->field_id eq 'parent_id'}
+ {assign var="value" value=$member->parent->id}
+ {/if}
+ {if $entry->field_id eq 'activite_adh'}
+ {assign var="value" value=$member->isActive()}
+ {/if}
- {if !isset($masschange)}
- {assign var="masschange" value=false}
- {/if}
+ {* If value has not been set, take the generic value *}
+ {if !$value and $propname != 'password'}
+ {assign var="value" value=$member->$propname}
+ {/if}
- {include
- file="forms_types/$template"
- name=$entry->field_id
- id=$entry->field_id
- value=$value
- required=$entry->required
- readonly=$entry->readonly
- disabled=$entry->disabled
- label=$entry->label
- title=$title
- size=$size
- tip=$tip
- compile_id="input_{$entry->field_id}"
- checked=$checked
- masschange=$masschange
- }
+ {if !isset($masschange)}
+ {assign var="masschange" value=false}
{/if}
+
+ {include
+ file="forms_types/$template"
+ name=$entry->field_id
+ id=$entry->field_id
+ value=$value
+ required=$entry->required
+ readonly=$entry->readonly
+ disabled=$entry->disabled
+ label=$entry->label
+ title=$title
+ size=$size
+ tip=$tip
+ compile_id="input_{$entry->field_id}"
+ checked=$checked
+ masschange=$masschange
+ }
+
{/foreach}
{if isset($groups) and $groups|@count != 0 and $fieldset@last and (!isset($masschange) or $masschange == false)}
{include file="forms_types/groups.tpl"}
notag=true
elt_class="large"
}
-{if isset($fieldset->elements['adresse2_adh'])}
-<br/>
-{assign var="address2" value=$fieldset->elements['adresse2_adh']}
-{include
- file="forms_types/text.tpl"
- name=$address2->field_id
- id=$address2->field_id
- value=$member->address_continuation|escape
- required=$address2->required
- disabled=$address2->disabled
- label=$address2->label
- notag=true
- elt_class="large"
-}
-{/if}
</p>
$this->array($categorized[\Galette\Entity\FieldsCategories::ADH_CATEGORY_GALETTE])
->hasSize(11);
$this->array($categorized[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT])
- ->hasSize(11);
+ ->hasSize(10);
}
/**
$fields = $fields_config->getCategorizedFields();
//town
- $town = &$fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT][3];
+ $town = &$fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT][2];
$this->boolean($town['required'])->isTrue();
$this->integer($town['visible'])->isIdenticalTo(\Galette\Entity\FieldsConfig::USER_WRITE);
$town['visible'] = \Galette\Entity\FieldsConfig::NOBODY;
//gsm
- $gsm = $fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT][6];
+ $gsm = $fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT][5];
$gsm['position'] = count($fields[1]);
- unset($fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT][6]);
+ unset($fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT][5]);
$gsm['category'] = \Galette\Entity\FieldsCategories::ADH_CATEGORY_IDENTITY;
$fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_IDENTITY][] = $gsm;
$fields_config->load();
$fields = $fields_config->getCategorizedFields();
- $town = $fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT][3];
+ $town = $fields[\Galette\Entity\FieldsCategories::ADH_CATEGORY_CONTACT][2];
$this->boolean($town['required'])->isFalse();
$this->integer($town['visible'])->isIdenticalTo(\Galette\Entity\FieldsConfig::NOBODY);
$this->object($elements['fieldsets'][1])->isInstanceOf('\stdClass');
$this->integer($elements['fieldsets'][1]->id)->isIdenticalTo(3);
- $this->array($elements['fieldsets'][1]->elements)->hasSize(9);
+ $this->array($elements['fieldsets'][1]->elements)->hasSize(8);
$this->object($elements['fieldsets'][2])->isInstanceOf('\stdClass');
$this->integer($elements['fieldsets'][2]->id)->isIdenticalTo(2);
$this->object($elements['fieldsets'][1])->isInstanceOf('\stdClass');
$this->integer($elements['fieldsets'][1]->id)->isIdenticalTo(3);
- $this->array($elements['fieldsets'][1]->elements)->hasSize(9);
+ $this->array($elements['fieldsets'][1]->elements)->hasSize(8);
$mail = $elements['fieldsets'][1]->elements['email_adh'];
$this->boolean($mail->required)->isFalse(); //email is not required per default
$this->object($elements['fieldsets'][1])->isInstanceOf('\stdClass');
$this->integer($elements['fieldsets'][1]->id)->isIdenticalTo(3);
- $this->array($elements['fieldsets'][1]->elements)->hasSize(9);
+ $this->array($elements['fieldsets'][1]->elements)->hasSize(8);
$mail = $elements['fieldsets'][1]->elements['email_adh'];
$this->boolean($mail->required)->isTrue(); //email is required for self subscription
$this->string($adh->sname)->isIdenticalTo('DURAND René');
$this->string($adh->getAddress())->isIdenticalTo($expecteds['adresse_adh']);
- $this->string($adh->getAddressContinuation())->isEmpty();
$this->string($adh->getZipcode())->isIdenticalTo($expecteds['cp_adh']);
$this->string($adh->getTown())->isIdenticalTo($expecteds['ville_adh']);
$this->string($adh->getCountry())->isIdenticalTo($expecteds['pays_adh']);
$this->string($adh->sname)->isIdenticalTo('HOARAU Lucas');
$this->string($adh->getAddress())->isIdenticalTo($expecteds['adresse_adh']);
- $this->string($adh->getAddressContinuation())->isEmpty();
$this->string($adh->getZipcode())->isIdenticalTo($expecteds['cp_adh']);
$this->string($adh->getTown())->isIdenticalTo($expecteds['ville_adh']);
$this->string($adh->getCountry())->isIdenticalTo($expecteds['pays_adh']);